4 ms·
function foo(bar : string) : string... Why, why do we need unnecessary tokens?! Get rid of the stupid :'s.
by berdon 14y ago
function foo(bar : string) : string...
Why, why do we need unnecessary tokens?! Get rid of the stupid :'s.
- dsrguru 14y agoThey work for Scala...
- pcwalton 14y agoI think they make the types read better, personally, especially if you leave out the space to the left-hand side of the ':'. It clearly signifies to the reader where the code is entering the type grammar. And if you leave out both the spaces to the left and the right of the ':' (as OCaml code often does), it's exactly as many characters as the version with spaces.
- B-Con 14y agoI think that most new languages feel obliged to have some sort of fun syntax quirk, usually, it seems, in the form of odd token choices.
- viraptor 14y agoI was hoping it was because they allowed `(x, y, z: int)` as syntax sugar (like OOC does)... but no, they don't. In that case the : is a bit pointless.
- RandallBrown 14y agoI agree We should also take periods out of sentences They aren't needed as long as you capitalize the first letter of every sentence This makes things much cleaner
- Danieru 14y agoOdd, I had no problem reading your comment. It also has an unusual clean-ness. Maybe period-less sentences are the future Throughout history english has already had many typological changes From a DRY stand-point capitalization and periods contain the same information payload Eliminating one of them would thus be good software engineering Right?
- ehsanu1 14y agoI didn't notice there were no periods till I finished reading and then had a "hey, wait a second" glance back This is an experiment worth trying out: just write everything in this style for a while The main problem I see here is figuring out whether a new sentence has been started when a Proper Noun or capitalized pronoun like "I" has been introduced I provide the current sentence as an example of that It's not so hard to figure out from context usually, but I'm sure there are easily constructed cases where the meaning changes based on the period Then again, much of the English language is like that
- politician 14y ago"... been introduced I provide the ..." I'll admit that I did a triple-take when reading through your example. Let's keep periods. :)
- ehsanu1 14y agoThis is a cognitive problem. I also read you as doing a "double-take", even though you clearly wrote "triple-take". Another cognition issue. The unthinking mind reacting automatically without consulting our conscious. The solution is obviously to augment our brains with computers. :)
- aufreak3 14y agoInteresting. RandallBrown's was easy to read, but you're wasn't. I read "are the future throughout history" and cracked up :)