Bridging the Gap With C#
One of the hurdles to C# interoperability is asynchronous programming, as the
Async conversion is rather difficult to keep track of. With the new version, we have a built-in task builder to make this easier. For projects where both frameworks are used, it’s advised to use tasks; but for a purer development, we can still use our great async builder.
Many open-source projects were already implementing a similar task builder, so it’s great to see this adopted in the core library.
Another great update for better interop is the implicit conversions. Both for assignment and return types, we can now relax and let the type system take care of the rest. These features were already in C#, and it’s great to see them implemented here.
Debugging F# code is something that was sometimes troublesome too, as the function composition can sometimes make things a bit complicated. Although test-driven and type-driven developers would probably tell me to discard debugging altogether, I’m reluctant to agree.
Nevertheless, the Visual Studio update has improved on pipeline debugging and also shows shadowed values, which make debugging F# a lot more comfortable.
In-Memory Cross-Project Reference
In the newest version, you can reference a C# project in a F# project without having to compile it first. This is by-default in C#/F# projects from the same language, but is also now available in cross-language projects. What this means is faster and more comfortable development. For me, this shows that the .NET development now grows towards a cross-language system where we take the best of both worlds.
The next step would be to do the opposite: making F# projects in-memory references in C# projects. Let’s all hope that that’s included in the next version.
F# sometimes seems to be something that people directly disregard in projects. The argument that it’s ‘not readable’ is often used. Let me take this opportunity to explain that ‘readability’ is not the same as ‘familiarity’. Object-Oriented Programming seems to be always in favor. That is, in my opinion, a mistake, which disregards the benefits of change — how it can make some parts better and more readable. Take your time, educate yourself, and hopefully you can help me make Functional Programming and F# more integrated within projects. Trust me, it’s a wonderful world once you fall down that rabbit hole!
Thanks for reading!
Subscribe to our RSS feed