4 ms·
I like F#, but I think the "F# has objectively better syntax" claim needs a lot more support than the "signal-to-noise-ratio" argument. I don't know of anything
by weberc2 9y ago
I like F#, but I think the "F# has objectively better syntax" claim needs a lot more support than the "signal-to-noise-ratio" argument. I don't know of anything that suggests that humans are better at parsing whitespace-delineated arguments than say, comma-delineated. My experience (probably biased similarly to F#'s target audience generally, possibly with above average exposure to functional languages) suggests that C-like syntaxes are easier to read.
- aloisdg 9y agoAsk Python dev. Most people found Python code easy to read thanks to whitespace.
- weberc2 9y agoI am a Python dev (by day, anyway), and whitespace doesn't make Python easier to read. But Python is still much easier to read in many cases than F# because Python retains parens and commas and the single-expression lambda syntax hampers gratuitous nesting. Go and Rust are even easier to read than Python, largely thanks to curly braces. I still prefer F# to Python, but not because of the syntax. NOTE: I'm not saying C-like syntax is objectively easier to read; I'm merely (very) skeptical of the OP's claim that F#'s syntax is somehow objectively better.
- aloisdg 9y agoI am a C#/JS dev by day. In my own time, I write in F#, Python, TypeScript, C (used to), C++ (used to). I have trouble with brackets nowadays. Each time I wrote some, it feels rubbish. I should try go one day :) Note that F# is the only _truly_ (not purely) functional language I am used to.
- weberc2 9y agoI think you should learn Go, but I suspect you won't like it very much.
- goatlover 9y agoWouldn't the same argument apply to Lisp code? Parens make it easier to read than whitespace. I'm not convinced at all that's the case, as whitespace has never bothered me and it's less tokens to look at. But this is likely one of those subjective things. Some people prefer more syntax, some longer names. Some like duplicated code and some prefer it DRY.
- weberc2 9y agoMy entire point is that it's subjective. I just listed my experience to counter the author's claim (implication?) that F# syntax is objectivity better than C syntax.
- stephengillie 9y agoIt's the YAML/JSON debate - would you rather have ugly curly brackets or annoyingly-precise whitespace? Personally, I choose ugly brackets, but I know many prefer the annoying whitespace.
- aloisdg 9y agoOr Sass vs Scss. It is mostly a matter of taste.
- tonyarkles 9y agoI always find this funny, because I indent my C/JS/C#/Java/whatever-other-curly-brace code exactly the same way Python expects me to indent it, so it's never really been an issue. Every time someone complains about significant whitespace, my first reaction is "what indentation style are you using where that's an issue?!"
- weberc2 9y agoI'm the same way, but lacking curly braces hurts when you're reading long functions and trying to figure out what scope you're in. It also prevents multiline lambdas or that's the excuse anyway. I program in Python all day long and there are definitely times when delimiters are nice, but I think most people make too big a deal about it. I will also say that I still have a harder time reading a Haskell function call style than a C style.
- vorotato 9y agoYeah I frequently switch between F# and C# and I literally cannot tell a difference in effort. I assume the complaints are more out of familiarity than anything else. I have never had issues in either language.
- arwhatever 9y agoI don't know that I can defend the article's claim of "objectively better syntax," but do have a few off hand thoughts of perhaps better signal-to-nose ratio (I guess using C# as a baseline): 1) single-case unions declared in one line of code 2) readonly data structures requiring much less code 3) being able to glue 2 arbitrary things together without needing a class (thinking of partial application, though of course both languages support tuples) 4) optional type annotations, not something you might want to go too overboard with, but imagine how useful in cases where the variable/value has the same name as the type 5) pipe-forward operator, which relieves you from having to declare variables (and choose names for those variables) just to pass the outcome of each line of code to the next line ...
- weberc2 9y agoI agree with all of those things, but they would apply equally if F# used parens, commas, and curly braces.