Live data from Hacker News

Underscores are stupid

devblog.avdi.org

61–70 of 131 posts

Re: Underscores are stupid

#61
post #52
post #51

What colour do you want your bikeshed painted today? I for one, don't like the "->" operator in C. It requires two characters and the use of the shift key. I would like that the next standard just used "." for all member access and let the compiler work its magic and guess what needs to be done. Of course that would break a sizeable amount of legacy code, but who cares about that anyway. The important is that the cod…

I like the arrow since it reminds me sometimes that I'm working with a pointer and not an object on the stack

Pointers aren't always to objects on the heap, they can be pointing to locations on the stack as well.

Re: Underscores are stupid

#62
post #58

> Underscores require me to hit the Shift key. When writing prose, I only hit the shift once or twice per sentence. In Ruby, I have to hit the shift key every few letters. Awkward. Inefficient. Oh my, oh my, how do people ever cope with that vile "having to hit shift" that have regular capitalisation of all nouns etc. Surely such a thing is impossible, as is hitting shift when you need an underscore. I understand tha…

I wonder how the author types all the brackets in LISP without the shift key. I'll take an occasional underscore over that mess any day.

Re: Underscores are stupid

#63
post #37

After writing a decent amount of Clojure recently, underscores do seem ugly, but I think I find commas even more annoying. I can accept underscores for the reasons raganwald mentioned, but having to write [1, 2, 3] instead of just [1 2 3] bothers me more than it probably should.

I noticed this too after using Coffeescript, going back to plain JS.

It's especially annoying when shuffling array elements or function parameter around: all items need to be separated by a colon, except for the last one, that must not have a trailing comma, making line swapping a nightmare. Drives me nuts.

Re: Underscores are stupid

#64
I don't really like underscores either. Leading underscores to mark member variables? That looks weird. A trailing underscore? Ugh, even worse because you can't use code completion to find all the member variables.

With that said, who cares? Don't use them if you don't want to. It might be more inefficient, but typing speed has never been the thing that slows me down while I'm writing code.

Re: Underscores are stupid

#65
post #20

Interesting that he calles dashes "ordinary, easy-to-type, recognizable, [and] visually unambiguous." What he's referring to as a dash is actually a hyphen (-), which is pretty ambiguous when compared to the en dash (–) and em dash (—), both of which require modifier keys to type (and are frequently used in prose, to counter another of his claims). Fortunately, I've never seen em dashes or en dashes used in code.

He's discussing this in the context of writing code, not typography. I think it's fair to assume we're starting with the premise that we would only choose characters that are easily typed on common keyboards. Choosing uncommon characters in programming languages, such as en-dashes and em-dashes, is choosing to deliberately make our lives more difficult [1]. I think it's pretty clear from the article that his comments…

Well, the author himself is pretty ambiguous.

While most of the article talks about code, the author mentions underscores being ambiguous in the context of underlined fonts. (I don't even think my text editor [for code] supports underlined fonts.)

He also mentions only using shift once or twice per sentence when writing prose.

So it would seem that the author is just hating on _ in all contexts. Which is kind of silly. (Though I'll admit, the point of it being improperly handled with underlined fonts is certainly a valid complaint.)

Re: Underscores are stupid

#66
post #58

> Underscores require me to hit the Shift key. When writing prose, I only hit the shift once or twice per sentence. In Ruby, I have to hit the shift key every few letters. Awkward. Inefficient. Oh my, oh my, how do people ever cope with that vile "having to hit shift" that have regular capitalisation of all nouns etc. Surely such a thing is impossible, as is hitting shift when you need an underscore. I understand tha…

>> I understand that some things could be more efficient, but "hitting shift" hardly qualifies in my opinion...

I does qualify as something that probably contributes to Repeated Strain Injury which most programmers should worry about.

Re: Underscores are stupid

#67

There's an easy fix for part of the problem: bind shift-space to underscore. Yes, you still require shift, but IMO it's the stretch not the shift that makes typing an underscore jarring. xmodmap -e 'keycode 65 = space underscore'

"the stretch"?

Properly typing an underscore should utilize two hands and shouldn't require a stretch at all.

Re: Underscores are stupid

#68

This misses one point when comparing Lisp to languages like Ruby. Lisp does not have infix notation. Therefore, you never have to worry that "foo-bar" (the symbol) could ever be confused with "foo - bar” the operation subtracting bar from foo. That’s because in Lisp, foo-bar is written "(- foo bar).” Since a Lisp programmer spends all his time writing "(- foo bar),” when he sees “foo-bar,” his brain easily parses it…

I don't think this has anything to do with infix versus prefix. It works in Lisp because the reader knows (roughly speaking) that symbols are terminated by whitespace or parentheses.

If you wrote a version of Ruby that was still infix but where you needed to put spaces around all symbols, then "foo-bar" would work fine there, too.

Re: Underscores are stupid

#69
post #19

Semicolons. Underscores. Spaces. Tabs. Every couple weeks it's some new minutiae profiled as the cause of all the world's problems. Don't people have better things to focus on than this?

Specially if we take into consideration that this is country specific.

Many country specific keyboards also need modifier keys to access the hyphen.

Re: Underscores are stupid

#70

"Underscores require me to hit the Shift key. When writing prose, I only hit the shift once or twice per sentence. In Ruby, I have to hit the shift key every few letters. Awkward. Inefficient." There are languages that survive in spite of the heavy use of uppercase letters, without useless complains like this. Let me repeat, in German: "Es gibt Sprachen die trotz starker Nutzung von Grossbuchstaben ueberleben, ohne u…

>> "Underscores require me to hit the Shift key. When writing prose, I only hit the shift once or twice per sentence. In Ruby, I have to hit the shift key every few letters. Awkward. Inefficient."

That passage sticks out to me as well. Especially the "Awkward. Inefficient" part.

Maybe the guy needs to learn how to type, because hitting shift for me is muscle memory that requires no thinking. That Grade 9 typing class in 1984 just continues to pay dividends for me.

Post reply on HN