5 ms·
I mean, what about auto-generated code? Not only does using words forbid potential variable names, but it makes code generation more difficult as well (as does
by mruts 8y ago
I mean, what about auto-generated code? Not only does using words forbid potential variable names, but it makes code generation more difficult as well (as does tabs). A good positive example is Haskell, which uses tab for normal block delineation, but also allows curly brackets (which is usually only used for auto-generated code).
By sharing block delineation with variable namespaces, the language creates a whole bunch of problems (a block identifier is essentially a newline followed by a “end” vs the much simpler “}”).
Also, the more english centric a language becomes, the harder it is to learn for non-english language speakers.
Moreover, words are used for variable names, while symbols are disallowed is many/most languages. By having block delineaters share the variable namespace, you detract from the readability of the language (as well as restricting variable names as I mentioned earlier).
One might ask: Does any of this matter in the scheme of things? The fair and honest answer is: not really, it’s a minor syntactic difference. But I firmly believe using words to end blocks is still inferior, even if it’s not a big difference.
- 3JPLW 8y agoAutogenerated code is very easy in Julia — there is no string processing at all. You can splice things directly into quoted code (working at the literal syntax level) or manually modify the `Expr` representation in a lispy manner (in which case there aren't any `end`s at all). Code generation is _really_ easy, thanks to its lispy inspiration. Block delineation in Julia doesn't require the newline. You can just throw a ` end` at the end of the line. Often you'll see folks put the `;` line delimiter there, too, to make things super-clear (as that's generally how you delineate multiple expressions on the same line), but it's not required for an `end`. And while it is indeed a little sad that you can't use `end` as a variable name, we make the most of it by using it to also represent the last index in an indexing expression like `A[end]`. So, yeah, not a big deal at all, but very few of your detractions even apply in the first place. :)