6 ms·
I think a lot of lisps use hyphens in variable names
by Shoop 11y ago
I think a lot of lisps use hyphens in variable names
- shakethemonkey 11y agoThere's plenty of precedent. It's just rare for a reason. I'm not sure allowing slightly easier access to CSS syntax justifies it.
- yellowapple 11y agoOn the other hand, pinky fingers everywhere are collectively breathing sighs of relief from not having to push down the shift key nearly as often.
- SeanLuke 11y agoDon't pinky fingers press the hyphen key?
- clay_to_n 11y agoMy ring finger does. Not sure which is more common.
- SeanLuke 11y agoWell, in standard touch typing, the pinky handles the hyphen.
- yellowapple 11y agoIt does? I never learned it that way. Using the ring finger is much more ergonomic for me than using the pinky finger.
- breuleux 11y agoI guess it depends a lot on your coding style. When I started allowing hyphens in variable names, I already had about 10,000 LOC of Earl Grey, including the whole compiler for it (seriously, it was a pretty late addition). In all that code, I only had to change one or two lines if I allowed hyphens, so I decided to just go ahead and do it. And not even because of CSS, just because I think "do-thing" looks better than both "doThing" and "do_thing". Of course, I would think differently if I tended to write "a-b" instead of "a - b", but at the moment I quite enjoy this feature.
- paulfurtado 11y agoOut of curiosity, what's that reason?
- TillE 11y agoBecause a hyphen is also the subtraction operator. It's extremely weird if a+b is valid syntax but a-b is not. This language may require whitespace around all operators, though. It's not clear to me.
- paulfurtado 11y agoAh that makes total sense, thanks!
- agumonkey 11y agoI'd love to hear why people prefer underscores over hyphens. I think I grew out of syntax fanboy-ism, but C and python __private__, _special_variable are everything but readable to me. They break the visual line too much. Even historically it was a weird symbol, originally a line break that made it into non-space separator in PL/1, then almost everywhere. Before that it was pure formatting, a typewriter glyph to be overtyped/composed on words to underline them.
- sp332 11y agoBecause fanboy-ism could be parsed as fanboy - ism = fanboy minus ism.
- agumonkey 11y agoYou mean like this : let some-var = a-number-another-number instead of let some-var = a-number - another-number
- wvenable 11y ago> I'd love to hear why people prefer underscores over hyphens. Because I like subtraction.
- breuleux 11y agoJust wondering though, how often do people write subtraction as "stuff-thing" instead of "stuff - thing"? I find myself typing the latter almost systemically, so hyphens never get in my way, but of course it's all too easy to be blind to the habits of others.
- wvenable 11y agoIt's more a question of readability than writeability Something like: result = balance-sheet - ledger-total + discount-total Is harder to read than result = balanceSheet - ledgerTotal + discountTotal
- tmalsburg2 11y agoYes, because Lisp uses prefix notation and hence there is no ambiguity: a-b cannot be interpreted as subtraction in lisp but in EG ...?
- SeanLuke 11y agoLisps do not have operators. This language does.