5 ms·
Why does this surprise you? The goal of most languages isn't to have a very terse way of writing a program that does nothing but print "hello world".
by thirsteh 13y ago
Why does this surprise you? The goal of most languages isn't to have a very terse way of writing a program that does nothing but print "hello world".
- nailer 13y agoOne of the goals of language development is to avoid errors. Redundancy leads to inconsistencies and is thus poor design. DRY applies to syntax too.
- thirsteh 13y agoWhat I'm saying is I don't see a language where hello world is module Main main = println "Hello World" as inferior to a language where it is println "Hello World" simply because of that. That's a particularly superficial way of looking at languages.
- nailer 13y agoI don't either. It's an important consideration, but not the only one.
- sheetjs 13y agoAmbiguity also leads to inconsistencies, and I'm sure you are aware of the ambiguities of ASI
- nailer 13y agoThe ambiguity of ASI is that it is optional. If there's one way to end a line, then it's used, the line is ended. Nobody in Python or Coffeescript-land misses an additional way to do this.
- sp332 13y agoYou need redundancies in language design. Otherwise, you'd never have a syntax error because every possible input would be valid.
- nailer 13y agoThere's nothing stopping one from having a non-redundant syntax. Multiple ways to end a line, or mark a block, aren't required to make a language work.
- oneeyedpigeon 13y agoI'm guessing a non-redundant syntax would be very inconvenient to work with for human programmers, in a similar way to how machine code was (not that people can't work in machine code, just that most prefer not to). Also, redundancy is not the only cause of errors, and trying to enforce it might actually make other classes more likely; consider forcing single-statement blocks to not be enclosed with braces.
- nailer 13y ago> I'm guessing a non-redundant syntax would be very inconvenient to work with for human programmers Python or Coffeescript are fairly non redundant, ask their developers how inconvenient they find it. The parts people tend to complain about, and screw up on, are the few remaining redundant bits, eg, SyntaxError: invalid syntax Because: if somecondition Rather than if somecondition: