4 ms·
There is nothing harder to understand about indentation levels than curly braces, if you haven't already developed a preference for curly braces. Go is really n
by pekk 11y ago
There is nothing harder to understand about indentation levels than curly braces, if you haven't already developed a preference for curly braces. Go is really not designed as a tool for new programmers, you are just projecting your preferences onto kids.
- bliti 11y agoPython can be a handful due to the weird whitespace rules. Its one of the things I hate about the language, and I use it every day. Dunno if I'd put curly braces in it, but the Hy language (a pseudo lisp in pythonish) really feels good to these old eyes.
- eru 11y agoHaskell has similar whitespace rules to Python, and no one ever complains about them. (Haskell does support {} and ; for those in need, though. Also, it has lots of other stuff for people to complain about first.)
- vidarh 11y agoYou answer yourself - it has too many other issues for people to complain about. And its terseness prevents most of us from ever seriously using it.
- pbhjpbhj 11y ago>There is nothing harder to understand about indentation levels than curly braces // At the start of this year I finished a first course in Python to learn in anticipation of [possibly] using it for home learning with my kids (it seems widely used for education). As I'm familiar with programming I searched for an IDE as I started. It told me when I had dropped a space or used a tab by accident. I tried several different environments including my standard editor choices - nano and Kate - revealing non-printing characters was a clear advantage. Others (primarily adults) who were starting fresh in programming had lots of problems with errant spaces. With braces you can see more clearly when there is an error of addition or omission, not so much with spaces. Like I tried to say above: this is clearly tractable with the right tools but the demarcation - I feel - of braces can be a more clear and obvious sign of separation than whitespace. For younger people with less spatial reasoning and less accurate perception of text lining up it rather seems it could be pretty much harder to use whitespace structuring. Personally I like the overall "clean" appearance of Python compared to PHP (say), debugging with tools is fine, when I was testing different environments and tripped on whitespace problems it was a nightmare rather reminiscent of trying to debug HTML tables some years back.
- mfisher87 11y agoMy intuition is that indentation is more readily apparent. You can tell that a group of lines or an individual line is indented or not at a glance. It's natural to see that they are grouped. With braces, you have to search for the opening and closing brace, and furthermore you must search within those braces to ensure another brace set isn't being opened, in case you missed one. You have to learn both -- about how to designate a set of statements as grouped using opening and closing braces, and how to detect a common class of errors related to nesting braces.
- vidarh 11y agoThe thing is, those of us who prefer braces or other syntax elements also indent. It's not either/or. I want the redundancy. I can more easily see how things line up. > With braces, you have to search for the opening and closing brace It's probably been 20-30 years since I used an editor that couldn't highlight the matching brace, and that wouldn't show me which opening brace the closing brace I just put down matches up with. But it's just been a day since the last cut and paste "accident" left me with a badly mis-indented piece of code... which I happily could auto-format back to sanity with a couple of keystrokes because the indentation was not all the editor had to go by.
- jsingleton 11y agoNever used Go although I've used a lot of C style languages that use braces and line terminators. I also use Python and like it a lot. My hesitation for using it with kids comes from anecdotal evidence (both written and in person). Kids seem to have trouble with significant whitespace (such as with Python ifs/loops/functions). It may be better to use BASIC or Ruby. This way you avoid many of the braces and semicolons. You can still end a line with just a CR/LF but it makes it obvious where statements, functions and loops end.