Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>F# actually has some very nice constructs for creating event-driven UI applications, such as <a href="http://blogs.msdn.com/dsyme/articles/FSharpCompositionalEvents.aspx" rel="nofollow noreferrer">First Class Events</a>, <a href="http://msdn.microsoft.com/en-us/library/dd233237(VS.100).aspx" rel="nofollow noreferrer">Object Expressions</a>, calling property setters from a constructor e.g.: </p> <p><code>new Form(Text="My Window Title", Width=600, Height=400)</code>,</p> <p>and much else.</p> <p>However, creating a <em>forms designer</em> in VS reqiures a CodeDom for your language. The current CodeDom architecture works great, as long as your language looks <em>exactly</em> like C# or VB; it does not lend itself well to generation of F# code (this from a webcast or interview that I can't locate right now). It also requires partial classes, which if I recall correctly, are not supported in the language as of Beta 1. Rather than focus on designer support in the first release, the F# team decided to spend their resources on enhancing other parts of the language, such as asynchronous and parallel programming, etc.</p> <p>What this means is that you have at least 4 choices for creating UI in F#:</p> <ul> <li>Write all UI code by hand, which is fine for simple apps;</li> <li>Create your F# code as a library to handle the "hard parts," like asynchronous and parallel code, or computation centric code, and call it from C#/VB;</li> <li>Create your UI code as a C#/VB library, and both drive it from F# and delegate event handling to F#; or</li> <li>Use a <a href="http://www.devx.com/enterprise/Article/40481" rel="nofollow noreferrer">DSL</a> or <a href="http://www.devx.com/enterprise/Article/40481/0/page/2" rel="nofollow noreferrer">Computation Expression (monad)</a> to simplify building the UI by hand (just discovered this while looking for other links in this answer).</li> </ul> <p>Of these, calling a C# UI library from F# may be the most flexible while still retaining a familiar paradigm. But, using computation expressions for quickly building UI by hand is certainly worth looking at.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload