Metro style Apps with F#? - f#

In the Build 2011 keynote and demos, they were always talking about C++, C#, Visual Basic and JavaScript. Can't I build Metro style Apps with F#? Or is it safe to say that if it works with C#, then it works with F# as well?

Or is it eligible to say if it works with C# then it works with F# as well?
Yes, that's how it is supposed to work. In addition to javascript and C/C++, any CLS compliant language that runs on top of the CLR will have access to the WinRT API.
Unfortunately in the VS 2011 Express edition you don't get tooling support but I guess this will be added progressively or to other editions:

Don talks about this a little around 7:40 into his talk.
http://channel9.msdn.com/Events/BUILD/BUILD2011/SAC-904T

I had the same question and created a blog post: Create a Metro App in F# (NOT)
There are a few issues:
You cannot reference ordinary .NET dll’s (even in C#). They have to
be have recompiled with a “reference” to the WinRT. Because of this
you cannot reference the F# dll. I think this will be solved when F#
3.0 get released (source: Understanding F# slide from Don Syme at
build).
The ability from F# to create Metro apps. This has to be
built by the F# team. This is an open question. This is the all-F#
approach (In WPF it is today possible but not recommended).
Tool support for creation Metro front-end projects. This will be not the case for the
F# 3.0 release. (source: Understanding F# slide from Don Syme at
build).

Using Visual Studio 11 Developer Preview (Full, not Express), I was able to reference and run F# code from a C# Metro style application with the following caveats:
You will get a build warning saying that the project can't be referenced, even though Visual Studio will still allow you to add it.
You must remove all references to all DLL's in the F# project, including FSharp.Core.
By following these steps it is possible to run F# code from a C# Metro style application, but it is nearly impossible to write any useful code in F# without references to the core language libraries. Let's hope they update the libraries to be WinRT compatible soon.

The question has been answered here:
Windows 8 and F#
Although you cannot create and design Metro apps directly in F#, you can still create so called Portable library in F# with all Models and ViewModels and use it in another Metro projects. It's not ideal, but it works.

I ported my stock chart library for .NET3.5-4.0 to Portable library,it works quite well on Metro with C# Metro application and some my Metro UI bridge.
I'm convinced that I can use F# to make Metro application in many parts.

Related

Is it possible to develop f# using Visual Studio Express 2015 for Desktop?

I have been doing some programming in VB.NET on Visual Studio Express 2015 for Desktop. I recently started looking into F# and like the functional paradigm. As a result I have been trying to find a way to use VSE2015 as my IDE for F#. However, I have hit some problems. First of all, it has been difficult to find out if it is officially supported. The .NET blog suggests that it is (at least version 3.1.1, and the announcement for 4.0 RTM does not mention otherwise), but when I try to install F# Tools (4.0) it seems to choke on some components called VWD and WD(?). 3.1.1 seems to install OK, but then I still can't open any F# projects (fsproj). When I try to install FSharpVSPowerTools, it tells me that my platform is not supported.
Am I trying to do something that is not possible? Have I missed some steps? Any pointers would be appreciated. Thanks.
(Incidentally, I can't use the Community edition because of the licensing restrictions)
Edit: I have tried VS Code, but it works differently from VSE, and I would have to do a whole more learning. In addition, I want to use the VS template for creating XLL's. Edit 2: it has been pointed out that you can reference excel-dna in VS Code, but setting it up is not as straightforward as in VSE2015 (at least for VB.NET and C#.NET.

Redistributable version of FSharp.Core.dll?

I have developed a commercial extension for the Unity3D game engine in F#, it's a piece of code which extends the editor with advanced node/graph editing features. F# is perfect for this due to the nature of immutability and DU's.
But, to my question: I realized that the license for the FSharp.Core.dll which comes with Microsoft .NET/Visual Studio probably doesn't allow you to re-distribute it with a commercial project? How would I go about finding out if this is the case or not, and if it's not is there any way to create my own compiled version of FSharp.Core.dll which would run on Unity3D?
The reason I ask is because Unity3D uses Mono 2.6 (albeit a modified version, to my understanding) under the hood, and there is no FSharp.Core.dll bundled with the editor, so I need to supply my own with my extension.
See: Is F# 3.0 runtime redistributable?
The answer is of course Yes. The language would be pretty useless if its core library wasn't re-distributable...

Is it possible to integrate Lua to Delphi and run on windows phone

I have a Mac app needs to migrate to windows. The app was created using objc and Lua.
I use Delphi to develop app for Windows.
Is it possible to integrate Lua to Delphi in and develop for windows phone7?
Welcome any comment
Thanks
To answer your first question, YES you can use Lua in Delphi. Simon J. Stuart has an incredible blog/website where he has created a number of really useful stuff for Delphi developers. His Lua4Delphi suite will help you integrate Lua scripting into your Windows application. Go to: http://www.lakraven.com/ or http://www.simonjstuart.com to check out the rest of Simon's stuff ... highly recommended!
With regards to the second part of your question (writing a Delphi app for WP7), that would be NO ... you're out of luck there (as Mason mentioned above).
It's definitely possible to integrate Lua with Delphi, but good luck getting it to run on Windows Phone 7. WP7 will only run apps built in the Silverlight or XNA frameworks.
Windows Phone 7 is not possible now, and is not likely to be possible in the near future, using Delphi, or even with Delphi Prism. Key elements of Microsoft's WP7 SDK are limited to the two current .NET core languages (C# and Vb.net). If Microsoft decided to help out remObjects a little bit, then a delphi Prism targetting Windows Phone 7 could become a possibility, but that is out of RemObject's hands, and its unlikely that Microsoft will be interested in helping them join in on the WP7 platform. Perhaps with sufficient engineering dollars, someone could figure out a way to force their way into the WP7 SDK.
Lua is a pretty simple C library, and it should be possible to put it into a DLL and load it into your delphi program. You could write your application in windows, with delphi, and use LUA scripting, and if you find a .NET "lua interpreter", like LUA.net, you might investigate integrating that into a WP7 app that you wrote entirely in C#.

F# on/in SharpDevelop?

Is there an F# compiler (plugin?) for SharpDevelop? I use SharpDevelop on my netbook for hobby development and it would be cool to program in f# on it.
If you install the F# compiler, SharpDevelop 3.0 automatically supports it. (Oh well. At least people will get a good answer now.)
On Windows, I settled on Visual Studio Shell and the May F# CTP.
There's a rather old (Aug 2008) F# Plugin for MonoDevelop. Read more on its Wiki page.
For the F# compiler, download the xip file from the F# May 2009 CTP page. there are certain known issues with running it on Mono, just search for "F# Mono" for more info.
Now Visual Studio 2010 supports F#. However, that doesn't include the Express editions, so if you're looking for F# IDEs for free, then there's a MonoDevelop plugin (which needs v2.6 IIRC), you can install Visual Studio Shell Integrated and add FSharp to that, or SharpDevelop.
Of these, I'd probably recommend the Visual Studio Shell over the others as it seems to have the best integration between the editor window and the F# Console window. However, if you're interested in doing things cross-platform, then look at MonoDevelop, as you can make sure that something will work on Mono.

Web Project for F#

I am building a project system for Visual Studio MVC web projects with controllers written in F#. It comes along pretty cool. I can build and run the apps, but I have a problem with FSharp Language Service.
In the editor it shows the syntax colorization and diagnostic as it should. With one problem - it does not pick up project references. Even though during build it picks them up and successfully builds the project, on the screen it shows the objects/namespaces from the referenced assemblies/projects as unresolved.
If somebody out here has some knowledge about integrating with F# Language service - please help me make it work
In response to Tomas:
The code for F# controllers is in the project file and as I already mentioned I can compile and run it. Originally we kept the F# code in a separate project and desire to get rid of this extra complexity is what prompted this project. It is not a ASP.MVC though it is Bistro MVC.
Edit
BistroMVC now solves this problem in the latest version of the Bistro Designer which is based on the F# project extender
Do you keep your F# source code as part of the Web Project? I'm not sure if this is even possible for ASP.NET MVC, but it was possible in ASP.NET WebForms. With WebForms projects, it didn't work very well (because F# wasn't aware of the project context). I believe it was possible to overcome this with a hacky #if like this:
#if EDITING
#r "Your.Referenced.Library.dll"
#endif
This would serve only as a hint to the editor... However it is much better idea (if it is possible) to write F# controllers in a separate F# project. In that case you shouldn't have any issues (at least I hope so!)
Can you describe what you're doing in more detail? Is this a "flavoring", or a new project system? Are other aspects of the 'project environment' picked up? For example, if you have F# code with
#if DEBUG
let x = 3
#else
let x = 4
#endif
does the coloring change when you change the VS solution from Debug to Release?
(Offhand I am unsure if it will be possible to fully integrate the F# language service into a user-defined project system; if you want more of a discussion, you can email fsbugs#microsoft.com and I'll respond there.)

Resources