3 ms·
>whitespace is significant, like in Python hard pass
by oguz-ismail 2y ago
>whitespace is significant, like in Python
hard pass
- voidUpdate 2y agoI was with it until I heard no braces :/
- deleted 2y ago[deleted]
- pjc50 2y agoI have some good news for you about C#.
- voidUpdate 2y agoI love C#, its a great language
- ahoka 2y agoPerfect for blub programmers!
- BeetleB 2y agoC# doesn't require braces...?
- fire_lake 2y agoStatic typing removes the downside of whitespace. Oh, and every language with line comments (so most of them) has significant whitespace.
- AnimalMuppet 2y ago> Static typing removes the downside of whitespace. How so? > Oh, and every language with line comments (so most of them) has significant whitespace. Technically true, but that's not what people mean by "significant whitespace" in this context. So you're being pedantic rather than saying anything meaningful. But you made me think. The ultimate nightmare would be significant trailing whitespace - the spaces and/or tabs after all the visible characters change the meaning of the line.
- fire_lake 2y ago> How so? Well I don’t know what issue you have with whitespace, but the usual complaint is that programs with small typos are syntactically valid but logically incorrect. This is why CoffeeScript became so disliked. A static type checker makes this scenario much less likely since it won’t compile. I would also add that F# has some indentation rules (“offside rules”) and tabs are disallowed, further shrinking the input space.
- Akronymus 2y agoIn f#'s case, there is the trifecta of everything being an expression, static typing and default immutability. This means you often write code like this: let foo = if bar then baz else someDefault Due to it being an expression you assign what the if evaluates to to foo. Due to static typing, the compiler checks that both branches return the same type. Due to the default immutability you don't declare and assign in separate steps. What this results in, is that accidentally using the wrong indentation for something usually results in an error at compile time, at the latest. Compared to how python does significant whitespace is that it's dynamic typing + statement based, which means you can easily end up assigning different types to the same variable in different branches of an if, for example. I hope I explained it in understandable terms
- int_19h 2y agoF# has both "lightweight" (indentation-based) and "verbose" syntax. If you don't like significant whitespace, you can just use the latter. https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/verbose-syntax https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...
- sundarurfriend 2y agoThat's an interesting idea and implementation. I don't think being whitespace-significant is a "hard pass" dealbreaker, but as someone who's not a fan of it, I'd say this only goes a small way towards alleviating that - like most "choose your preferred syntax" designs. Even if you're a lone-wolf developer, you're gonna end up reading a lot of example code and other material that's in the ugly whitespace-sensitive style, given that: > The verbose syntax is not as commonly used ... The default syntax is the lightweight syntax. And most people in practice are not lone-wolf devs, and so the existence of this syntax helps them even less.
- 110bpm 2y agoThis isn't such a big issue in my experience. Auto-formatting helps a lot, the code needs to be just syntactically correct. The default F# autoformatter is bundled/supported by VS Code, VS and Rider [0]. [0]: https://fsprojects.github.io/fantomas/docs/end-users/StyleGuide.html https://fsprojects.github.io/fantomas/docs/end-users/StyleGu...
- lunarlull 2y agoYou never touch python code either?
- oguz-ismail 2y agonot since they binned 2.7