Tuesday, July 20, 2010

To Each His Own

I just watched an old F# presentation by Luca Bolognese. A few things were striking. The ML-ish nature of F#, the integration with the DOTNET platform, the use of |> (just a reverse apply operator), their modules which have a direct OO representation, their concurrency model, and a small comment.

F# looks gorgeous. The integration is very tight, I went another direction, but -true- it stings. Having said that, Hi interfaces with C exactly since everyone and their dog is either targeting the CLI or JVM, so, my own choice. The IDE and compiler integration is very interesting though.

As far as the ML-ish nature of F# goes, hell, couldn't they have dropped that awful syntax by now? Haskell, Clean, and a plethora of other languages just, well, do it better.

The pipe operator '|>', a reverse apply, is a nice trick and idiom Luca used a lot. I thought of it myself too, didn't see it used a lot like that before, but don't think it'll go very far. Whereas I usually write a series of explicit assignments/lets, he doesn't, but he needs to 'jump' between lets and pipes a lot. Better to just stick with a simple assignment.

My interfaces just work on data types, which is a lot weaker than modules. Thing is, since OO objects are best understood as reinstantiatable modules thereby solving a state problem, and I don't have explicit state, guess I don't need them. The integration with OO is cool though.

Their concurrency model is elaborate. It defers evaluation by wrapping functions into asynchronuous values correspondingly typed and, I guess, defers evaluation until a block is ran to completion. I hope, not sure on this, that this also has to do with their somewhat impure nature of their language. Need to figure that one out, but I made a descision. Hi will be pure, except for side effects. I am not a great believer in pure code, but I don't want to work on the language that much more, and it just has some benefits I don't want to throw away.

Small things. It dawned to me that foreach is just better readable to most programmers than map. So, I'll add one silly thing to the list library, an 'each' function, which is -again- just map with his arguments reversed.

[ I think F# 2.0 added units of measure, which is a good thing in calculation. See what I'll need to do to support that. Are they just 'tags' for literal types? Hmm, feature creep. Dropped the idea, it is still cool but I am not sure what you pay. ]

No comments:

Post a Comment