Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>During my internship at Microsoft Research, I worked on some parts of Visual Studio IntelliSense for F# (which is itself written in F#). I already had some experience with IntelliSense from earlier C# projects, so I think I can compare the two.</p> <ul> <li><p>Visual Studio Extensibility is still based on COM, so you need to deal with objects that are not very nice .NET objects (and definitely not functional), but I don't feel there is any major difference between C# and F# (it works smoothly from F#)</p></li> <li><p>The data structures used to represent program code in F# are mostly <em>discriminated unions</em> (which are not supported in C# in any reasonable way) and this makes a <strong>huge</strong> difference for this kind of application (where you need to process tree structures, such as program code). Discriminated unions and pattern matching allows you to structure the code better (keep related functionality in one place rather than having it all over the place in virtual methods)</p></li> </ul> <p>Earlier, I also worked on CodeDOM provider for F# (also written in F#). I actually did first experiments in C#, but then converted the code to F#.</p> <ul> <li><p>CodeDOM provider needs to traverse some structure represented using .NET objects, so there isn't much space for inventing your own representations of data (which is the area where F# can offer nice benefits). </p></li> <li><p>However, there were many small F# features that made the task easier. Since you need to produce a string, I defined custom operators for building strings (using <code>StringBuilder</code>) and implemented the code using them and higher-order functions (e.g. to format list of objects separated using the specified string etc.), which removed a lot of repetition (and tedious <code>foreach</code> loops).</p></li> </ul> <p>These are two relatively specific examples, but both of them are related to working with representations of programs, or expressions, or more generally, complex tree-like data structures. I think that in this area, F# is definitely a good choice (regardless of the functional features in C#).</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