Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is F# lacking for OO or imperative?
    primarykey
    data
    text
    <p>Many times I hear that F# is not suited to particular tasks, such as UI. "Use the right tool" is a common phrase. </p> <p>Apart from missing tools such as a WinForms/WPF/ORM designer, I'm not sure what exactly is missing in F# -- honestly! Yet, particularly with UI, I'm told that C# just does it better. So, what are the actual differences and omissions in F# when using it imperatively? </p> <p>Here is a list I came up with:</p> <ul> <li><p>Lots of missing tool support</p></li> <li><p>F# is still beta</p></li> <li><p>Your developers don't know F#</p> <ul> <li>I'd like to not consider those points, as they aren't really intrinsic to F#</li> </ul></li> <li><p>Mutables need "mutable" or need to be ref, ref needs ! to dereference</p></li> <li><p>Mutables assign with &lt;- and ref uses := ( they're both 1 more character than just = )</p></li> <li><p>val needs DefaultValueAttribute to get a default value</p></li> <li><p>F# doesn't emit implicit interfaces </p></li> <li><p>Protected members are more difficult to deal with</p></li> <li><p>No automatic properties</p></li> <li><p>Implemented virtual members on abstract classes require two definitions</p></li> <li><p>Quotations-to-LINQ-Expression-Trees produces trees slightly different than C#/VB (annoying for APIs that expect their Expressions in a specific format)</p></li> <li><p>No stackalloc</p></li> <li><p>F# doesn't have the ?: conditional operator</p></li> <li><p>Pointers might be considered more cumbersome in F#</p></li> <li><p>Delegates/events might possibly be considered more cumbersome (I'd argue they're easier, but at a minimum they're different)</p></li> <li><p>No automatic type conversions (like int to float, or implicit casts)</p></li> <li><p>No special syntax support for Nullable (C#'s ? type annotation and ?? operator, as well as using operators on nullables.)</p></li> <li><p>No automatic upcasting to common base class or boxing (ex: let x : obj = if true then 1 else "hi" // this won't typecheck)</p></li> <li><p>Values can't be discarded without a warning ("ignore" to get around it)</p></li> <li><p>Doesn't have C-style syntax :)</p></li> </ul> <p>To the question: Which of these are a hindrance to writing imperative or OO code? Why (short examples)? Which ones did I miss? What are the best workarounds, and why are they not enough?</p> <p><em>Please note</em>, I'm not talking about writing so-called idiomatic F#, and I'm certainly not talking about functional programming. I'm more interested along the lines of "If I were to force myself to write UI or imperative/OO code in F#, using F# OO/imperative features and class types, what hurts the most?"</p> <p><strong>Bonus</strong> If you don't know F# but use C# or VB.NET and think it's a better tool for some situations, please indicate the specific language features and syntax you find appealing. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

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