4 ms·
And it still surprises me there are new languages where 'hello world' is more complicated than: print('hello world') Dart, which was released two years ag
by nailer 13y ago
And it still surprises me there are new languages where 'hello world' is more complicated than:
print('hello world')
Dart, which was released two years ago, after JavaScript had been around for two decades and ASI was still considered an issue, still required a semicolon after each statement.
I half feel like pulling out an AST and doing a ModernDart, getting rid of all the redundant tokens and compiling to the } } } } } language we all know and ignore.
- thirsteh 13y agoWhy 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:
- chrisBob 13y agoIts on the home row; I don't think people use enough semicolons.