Saturday, January 3, 2009
F# leads the transformation
What F# represents is a partitioning of the programming languages. And unlike previous partitions this is a transformative change. General purpose languages are being supplanted by a collection of domain specific languages. These domain specific languages will include a general purpose language but it will not be there to rule them all but rather to orchestrate them all.
F# is a native or natural functional language where objects are possible (but the objects may not feel native or natural). C# is an object oriented language. With the advent of LINQ, some functional capabilities are possible but most C# programmers have experienced the unnatural things LINQ is doing to the language.
So each language has a dominant paradigm, C# is an object oriented language and F# is functionally oriented. Each supports the other paradigm but using that paradigm is for one off or special purpose needs. LINQ allows C# programmers to off load a bunch of data processing tasks that are hard and / or tedious to code in any C derivative language. Likewise objects are available in F# in case you need to maintain state. But the more you need to maintain state the less the task you are working with is a functional oriented task.
Since we are 60+ years into programming, Bare-Naked-Ladies-Fans ("It's all been done") are sure to point out this has all been done before. This is a valid point as C++ and Perl demonstrate. Both languages have adapted and provide these and numerous other features. However both languages have purchased these abilities at ever increasing complexity. As the Ruby creator aptly points out C++ is constantly surprising him. For a hobbyist, surprise is fun. For a guy trying to get something done surprise is bad.
But leaving aside surprise, it is hard to feel like you know either of C++ of Perl in their entirety. All special purpose languages that succeed will share this fate. Every feature the language supports will require some complexity to implement it in the syntax. The future being unknowable will always mean some choices turn out to be less than perfect.
So as the general purpose languages evolve their complexity and internal contradictions will grow as well. The languages scream for a refactoring. But refactoring is the one tool no language can ever use. No matter how ill advised a feature, it cannot be removed because this would break countless programs. And refactoring is not the removal of one feature but the wholesale change of several features.
What history gave us was series of general purpose languages (C, C++, Perl, Java, C# and others) where an attempt was made to refactor to the perfect paradigm. The dot Net platform opens up a new way; several languages can interoperate on the same platform and in the same development environment. F# is the break out example because unlike the C# and VB.net interaction it implements a completely different programming paradigm.
The general purpose languages do not have to implement every hot new feature. They can develop side by side with the F# languages, leveraging their power without corrupting their own syntax.
No comments:
Post a Comment