3 ms·
F# was one of the most frustrating languages I ever tried to learn. It sits in this uncanny valley between OCaml and C#. I've had many, many problems where I sp
by gambler 8y ago
F# was one of the most frustrating languages I ever tried to learn. It sits in this uncanny valley between OCaml and C#. I've had many, many problems where I spent tons of time searching for idiomatic way of doing something only to find out that there is none and I have to use "normal" .NET classes. The documentation is pretty bad.
I find myself highly productive writing "mostly functional" code in C# using LINQPad. The only thing that drags me down is that it doesn't have good support for data structures that you can copy on the cheap a-la Clojure. The paradigm of "copy the world on change" is immensely powerful. Maybe I should look deeper into this. It seems that basic data structures for this wouldn't be very hard to implement on my own.
I think the ideal language for me would have functional, strongly typed capabilities for low-level operations and dynamic, late bound objects a-la Smalltalk for high-level stuff. But for this to work well it would need to have strong mechanism for versioning references, so functional parts don't get contaminated with mutability.
Oh, another thing about C#. I really wish it had an ability to concisely say "take an object, create a subclass of its class with additional properties, instantiate it, copy all values from source and then set extra properties to what I just provided".
Something x = new Something { Property = "Hello" };
var y = x.Expand(me => new { AnotherProperty = me.Property + " World" });
Assert(y is Something);
Assert(y.Property == "Hello");
Assert(y.AnotherProperty == "Hello World");
Seems like a weird piece of functionality, sort-of-union-types, but it would save me tons of code in many, many contexts.
I can implement this using reflection, but it will be slow and complicated and not worth the effort. Maybe the new tuple mechanisms can do something of this sort with minimal overhead and syntax. Need to look into them.