News for hackers. Stuff that matters.
Re:Functional Programming with Java by pmjordan on Thursday January 06, 2011 @07:58AM (#2075074)
Or C#'s var keyword, for that matter. Unfortunately, both will only work for local variables. I suspect this is one of the reasons there aren't any popular persistent data structure libraries around for these languages. At least the .NET/C# type system supports covariance/contravariance for functions ("delegates"). Plus, they managed to build F# on it.
Re:Functional Programming with Java by timrobinson on Thursday January 06, 2011 @08:09AM (#2075106)
F# doesn't in fact make use of {co|contra}variance: it only needed generics. (Although F# used to run on .NET 1.x using its own implementation of generics - Don Syme designed both .NET generics and the F# language.)

For type inference, you just need a sufficiently smart compiler, although it's much more useful if your language knows about generic types.

Re:Functional Programming with Java by pmjordan on Thursday January 06, 2011 @08:29AM (#2075161)
Thanks for clearing that up (I've yet to try F# in anger). I suppose pre-generics F# did similar type wrangling to Scala's?
Re:Functional Programming with Java by timrobinson on Thursday January 06, 2011 @08:38AM (#2075195)
I don't know about Scala, but yes, wrangling describes well what F# used to do.

I never used F# before .NET 2.0, but the techniques it used on 1.x could be interesting -- I'll see if I can find some old documentation...

Edit: There used to be a paper describing the technique. I can't find it now, but here's an old Don Syme announcement related to it: http://www.mail-archive.com/[email protected]...