Impressed

Alex Rønne Petersen alex at lycus.org
Mon Jul 30 12:33:15 PDT 2012


On 28-07-2012 18:07, Andrei Alexandrescu wrote:
> On 7/28/12 10:04 AM, Paulo Pinto wrote:
>> On Saturday, 28 July 2012 at 12:42:47 UTC, Stuart wrote:
>>> On Saturday, 28 July 2012 at 09:37:47 UTC, Paulo Pinto wrote:
>>>>
>>>> I tend to favour F# instead of OCaml due to three things
>>>
>>> I've never really seen the point of F#. Aside from maths, what is F#
>>> good for that a standard imperative language is not? Especially when
>>> you consider that all flavours of .NET have native support for LINQ.
>>
>> Let me see:
>>
>> - Symbolic code manipulation;
>> - Metaprogramming;
>> - Easy parallelization of code thanks to immutable data structures and
>> workflows
>> - Type providers (comming in F# 3.0) to manipulate remote data as
>> language data types
>> - The right way of doing type inference (shared by all ML languages)
>> - Asynchronous programming builtin without having to wait for ..NET 4.5
>> - Algebraic data types
>>
>> Microsoft wouldn't have brought F# into Visual Studio if it wasn't worth
>> it, Microsoft is a business, not a language charity company.
>
> It was for Basic :o). Anyhow, indeed, the tools around it make F# pretty
> cool (just not all that original as a language).
>
> Andrei

What makes you say that?

I guess that opinion stems from F# being based on OCaml's syntax? (But 
then to be fair, we would have to call D very unoriginal too...)

Either way, F# adds a *ton* of stuff on top of OCaml that makes it a far 
superior language:

* Reified generics: 
http://msdn.microsoft.com/en-us/library/dd233215(v=vs.110)
* Inline functions (I'm still amazed D doesn't have this yet): 
http://msdn.microsoft.com/en-us/library/dd548047(v=vs.110)
* Type extensions, a (IMO) much cleaner approach to artificially 
extending types: http://msdn.microsoft.com/en-us/library/dd233211(v=vs.110)
* Pattern matching (oh how I miss this in compiler code): 
http://msdn.microsoft.com/en-us/library/dd547125(v=vs.110)
* Annotations: http://msdn.microsoft.com/en-us/library/dd233179(v=vs.110)
* Units of measure: 
http://msdn.microsoft.com/en-us/library/dd233243(v=vs.110)
* Computation expressions (F#'s humanly understandable take on monads): 
http://msdn.microsoft.com/en-us/library/dd233182(v=vs.110)
* Code quotations, making for metaprogramming that can do things even 
D's metaprogramming can't: 
http://msdn.microsoft.com/en-us/library/dd233212(v=vs.110)
* Async workflows (actually a library solution built through computation 
expressions): http://msdn.microsoft.com/en-us/library/dd233250(v=vs.110)
* Query expressions (again, based on computation expressions): 
http://msdn.microsoft.com/en-us/library/hh225374(v=vs.110)
* Automatic generalization: 
http://msdn.microsoft.com/en-us/library/dd233183(v=vs.110).aspx
* Type providers (type-safe data access): 
http://msdn.microsoft.com/en-us/library/hh156509(v=vs.110).aspx

There are probably lots of other features that I have forgotten. I don't 
think calling F# unoriginal is fair...

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d mailing list