3 ms·
Is ironic how most failed to see the main points, and focus in the syntax (syntax is easy to attack because the cargo cult notion of "syntax not matter much").
by mamcx 9y ago
Is ironic how most failed to see the main points, and focus in the syntax (syntax is easy to attack because the cargo cult notion of "syntax not matter much").
I have learned and used FOR WORK almost a dozen languages now, F# being the last of the bunch. I totally remove many ineffective coding habits, mostly:
- Inmmutability
- The type checker making me aware of problems
- Not need to over-check for nulls because now I don't need to worry
- Pattern matching + AGDT are awesome. This cut the need to make a lot of unecessary classes.
- Make me to think outside over OO. I do this also in Pascal(Delphi) and python, and hate how C# is OO/Class for all.
---
About syntax:
F# totally cut millons and millons of lines of code! (exagerating!) but more important: Far less files than similar C# project (and yes, I have made the rewrites. I do rewrites for life! I work upgrading, fixing, moving, old codebases most of time).
However, some things that I hate of F#:
- Whitespaces must be as python. Is better.
- Not like to rely on type inference. Is a good idea on paper but have the stupid habit of only work AFTER you write. Put the types manually is better, IMHO. You get more clarity, ease readability, not need to rely on a IDE, the types are less obtuse, etc.
Ironically, VS Code show the types as you write but Visual Studio Mac no. I have both opened some times because this!
So, type inference is net negative for me. Maybe is my pascal love talking here.
I don't like how everything is "let". I wish it was "let, function, etc".
I don't like the overuse of spaces for everything. And how comas are for tuples but ; for separate items.
But overall? F# is better than C# most of time.
- mannykannot 9y agoYou say that "syntax not matter much" is a cargo cult notion. I am not sure you understand the cargo cult analogy, but I take it that you disagree with the sentiment, which is itself ironic, given that the reasons you give for favoring F# are all much more than syntax issues. They could have been the basis for a more persuasive article.
- mamcx 9y agoOk, is not well articulated: > F# are all much more than syntax issues But some of the things that make F# unique are surfaced with the syntax. Is not just there for the sake of it. Pattern matching is the most obvious thing. The way the syntax present this aspect is close to perfect... ie: I'm for fun building a language. I have tried a lot of ways to present some things, like Pattern Matching. I can't figure a better way without resorting to weird characters, unicode or text editors that not exist. (I replace "|" as separator but the basic structure is just the same). Other ways the syntax is significant is in how it encourage curried functions, chaining and pipelines (with |>). The pipeline way is something that I truly adore. Wish F# was more into this, IMHO. Not fan in how let have different meanings, neither the use of "," for tuples. Also is confunsing why functions with "let sum a b" are truly different to "let sum(a,b)". Hate this (because suddenly pipelines and curried application not work anymore). The making of "inmutable first" and marking some vars as "mutable" is something truly nice. Could be easier if it was "let" and "var" instead of "let mutable" but anyway. Is good. Anyway, as a amateur language designer it make me more aware in how the syntax make a language better or more ergonomic and lead the way in how use it.
- sidlls 9y ago"Close to perfect" according to...you? Arguments from Syntax are closer to emacs vs vim or K&R vs Allman bracket/indentation flame wars than they are to meaningfully discussing differences between languages. It's so superficial compared to so many other things.
- mamcx 9y agoI have look at more than dozen languages, probably more (as research in how build one). So is not exactly according to me, but how is done in other languages. Anyway... try to design this, for example, and tell how you do it better ;)
- kurtisc 9y agoI don't see any irony. What I do see is a lot of people responding to an argument that the author seemed to think was strong enough to lead the article with.
- mamcx 9y agoProbably people with a lot of experience or a more narrow view of how languages work wish for more deep arguments, but for the average person, syntax as the "user interface" of a languages is certainly the most obvious and evident factor to show of. I totally see how presenting "hello world" with python vs C++ clearly make the case "this thing is different and is good" You need a more of information to truly make the case better, but I think is fair that a F# introduction start with the syntax. This show the mainstream audience "we are not in kansas anymore". Certainly, make the article better in the second half is another thing. Like with movies is easier to start with a good premise and fall flat in the end ;)
- vorotato 9y agoDifferentiating let and function would be a very bad decision. The whole point is to indicate to you that functions can be passed around and worked with just like values. There is a verbose mode that is a lot less whitespace sensitive but I personally didn't mind whitespace sensitivity in python or F#, I just turn on show whitespace.