4 ms·
It looks like the syntax could use some polishing. Three obvious improvements: use line breaks for semicolons (and backslash at the end of line for multiline st
by roryokane 16y ago
It looks like the syntax could use some polishing. Three obvious improvements: use line breaks for semicolons (and backslash at the end of line for multiline statements), do not require parentheses around conditionals in if, while, for, etc. statements, and (slightly more controversially) use significant indentation instead of curly braces. I think each of these changes would make the language undebatably more concise and readable than before (except the last one, which has been debated, but I think it’s definitely an improvement).
An example from algorithms/introsort of how the syntax would look:
overload introSort(first, last)
if first != last
introSortLoop(first, last, log2(last-first)*2)
finalInsertionSort(first, last)
instead of
overload introSort(first, last) {
if (first != last) {
introSortLoop(first, last, log2(last-first)*2);
finalInsertionSort(first, last);
}
}
- alnayyir 16y agoThis more than a little vacuous.
- chc 16y agoNot really. Python is famous for its readability, and this interest in reducing "noise" is one of the reasons why. It's definitely something that a language could benefit from at least riffing off, if not stealing outright. The Python philosophy is that everything is expressed clearly and concisely. Parens around conditionals are just restating information that is already apparent, as are semicolons between lines. Fluent readers actually learn to ignore these syntactic features unless they're debugging (since these useless tokens are a breeding ground for bugs). Ask yourself: How often do you mentally match the opening and closing parens on a conditional? How often do you rely on semicolons to tell when you're looking at a new statement as opposed to just looking at the lines of code?
- alnayyir 16y agoYeah, listen. I'm a python programmer as a matter of profession and paycheck. It's a matter of taste. Do I prefer significant whitespace ala python/haskell? Yes. Does it matter? No. Does it matter when you're discussing a programming language you've just now encountered for the first time and is rather new and has many novel things to contribute to the world? Fuck no. Like I said, it was a vacuous thing to say. There are far more important questions to ask like, "Are the generics a space-time trade-off similar to C++ templates?" "Can I use the type system to encapsulate and restrict behavior in powerful ways, allow me to create performant but safe code?" "Can I make a beowulf cluster out of this?" Any of those questions have more substance than, "hurr whitespace is bettar why didn't you do tghaaaasdfsdgsg" Christ-sakes.
- chc 16y agoYour entire response focuses on significant whitespace, which I didn't mention at all in mine. And no, the time-space tradeoff of the generics is not necessarily a better question than how readable the language is. That is a matter of taste. I will spend more time reading the code than I will worrying about the performance characteristics of generics or creating a Beowulf cluster, so caring about the common case is not exactly vacuous, even if it isn't the #1 most important thing.
- alnayyir 16y ago>Your entire response focuses on significant whitespace, which I didn't mention at all in mine. Doesn't matter. >Beowulf cluster It was a fatuous comment designed to compare with the original fatuous comment. >the time-space tradeoff of the generics is not necessarily a better question than how readable the language is. That is a matter of taste No it's not. Taste is preference, whether or not a language is impossible to deploy with generics in an embedded environment has absolutely nothing to do with whining about syntax. importance: Semantics > syntax I don't think I've seen sophistry and an obsession with the trivial on hackerne.ws like this in quite some time. You're complaining about the color of the bikeshed when real discussion and work is to be done concerning the semantics and structure of the language?
- chc 16y agoI think you're unnecessarily trivializing things that you personally care less about. Who cares about embedded environments? People who work in them. Is that group dwarfed by the group of "programmers who have to read and debug code"? Yes it is. So it seems really petty to personally insult me for caring (not much, but a little) about something that makes code less bug-prone and easier to read for everybody while you hold up something that affects a vanishingly small number of people as what we should be talking about. Your complaints seem to reflect an idea that only features and implementations matter, while user interface is fairly trivial. If you believe that, I think you might be interested in this: http://www.alistapart.com/articles/indefenseofeyecandy/ http://www.alistapart.com/articles/indefenseofeyecandy/