News for hackers. Stuff that matters.
Re:When Rust Makes Sense, or The State of Typed Languages by MichaelGG on Monday September 28, 2015 @06:30AM (#10289696)
It's important to note that F# doesn't really have many operators at all. The one most people see, |> which "pipes" an argument, is defined in an F# library, not in the compiler or part of the core language. You can define it yourself to be anything you like, or not use it at all. The language is unaware of it and treats it like anything else. The definition is just:

  let (|>) x f = f x
That's literally function application, in reverse. That's all. It comes in handy for type inference and to make things look nice, but isn't special in any way. I mention this as one comment as to why Rust doesn't have such an operator was that "Rust uses channels for data flow" which is a non-sequiter. Rust just doesn't value conciseness as much, and I'm guessing the safety/perf restrictions might complicate matters.

In fact, even the + and - operators are implemented in F# and shouldn't count as part of the language (just very commonly used bits of the stdlib). I fear that perhaps not enough intros to F# focus on the relatively simple underlying language, and that everything else on top is just an application of said language.

With the type system, it's actually easy to figure out the operators, based on the type alone. Looking at |> for instance, we see a type of:

  'a -> ('a -> 'b) -> 'b 
This makes it entirely obvious. There's only one implementation for such a type definition. This holds true for so much of the stdlib that the "noise" quickly fades away. This is relevant as magic cannot hide, and misuse will quickly be identified by the compiler.

But it's a valuable comment as it illustrates that the simplicity is not being marketed correctly and turning away potential users.

There are no comments on this comment yet.