Re:F# Basics An Introduction to Functional Programming for ....
by MichaelGG on Thursday April 08, 2010 @01:15PM
(#1250257)
What is your reason for not using F# in a "typical web" app? Just developer experience and tools, or something with the actual language?
Re:F# Basics An Introduction to Functional Programming for ....
by DrJokepu on Thursday April 08, 2010 @01:31PM
(#1250301)
Well, mostly tools. Also as I said, OO in F# is a a bit tedious to do in my opinion and the ASP.NET and ASP.NET MVC are very object oriented and were designed with imperative languages (primarily C#) in mind.
There's nothing in functional programming that prevents it from using in "typical web" apps though, as demonstrated by the engine that runs HN, news.arc, for example.
Re:F# Basics An Introduction to Functional Programming for ....
by MichaelGG on Thursday April 08, 2010 @01:47PM
(#1250340)
Out of true curiosity, what do you find tedious about F#'s OO support? Lack of protected?
Re:F# Basics An Introduction to Functional Programming for ....
by DrJokepu on Thursday April 08, 2010 @03:08PM
(#1250590)
Well nothing major really, it's just small bits here and there that are telling signs that it's a functional programming language with OO support and not the other way around. Like that you have to put two types that depend on each other in the same file.
No showstoppers, just minor annoyances that add up over time so when I write F# code I try to limit OO code to interfacing with other libraries (and the framework). Maybe it's just me, perhaps other programmers don't find OO in F# tedious at all.
* Inbuilt support for sequence head and tail - very important for recursive functions.
* Due to the heavily object-oriented nature of C#, type inference is really limited. This makes writing anything non-trivial in functional style rather tedious as your type declarations will become several lines long really quickly. For example, try writing a Y Combinator in C# and F# to see the difference.
* Parallel processing is a lot easier in F#.
* Matching in F# is a lot more powerful than switch-case in C#, which makes functional programming easier.
My point is: functional programming support in C# is good enough for simple things but serious functional programming is a lot easier in F#. On the other hand, OO is a bit cumbersome in F#. I wouldn't use F# for typical web or enterprise create-update-delete database stuff but it is really great for things where functional programming is usually strong at, especially if you need it to work together with C# code.