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.
Underscores are stupid
41–50 of 131 posts
Re: Underscores are stupid
#42I dunno. For some reason this super-optimisation of keystrokes doesn't bother me. Avoiding reaching for the mouse is good, but I don't particularly care if I have to hit shift.* Maybe I prefer to think more and type less, or something. I can't quite say.
* Admittedly the French keyboard where all numbers in the top row are shifted, and symbols are unshifted, drives me kind of crazy, but that could just be due to hard in-grained training on an American keyboard layout.
Re: Underscores are stupid
#43Earlier quoted context omitted.
Yes, but in this case it's not about readability, but about extremely significant whitespace. Forgetting a space and your code has a totally different meaning.
Whitespace is already extremely significant in programming. "foo[1]" vs "foo [1]" for example.
Re: Underscores are stupid
#44Re: Underscores are stupid
#45Earlier quoted context omitted.
Whitespace is already extremely significant in programming. "foo[1]" vs "foo [1]" for example.
Depends on language, in Ruby those statements would be identical. But anyway, that's no reason to make things even worse.
Re: Underscores are stupid
#46 i - -
Is it i (minus) (variable named dash)? And is `i--` a legitimate variable name? Maybe Ruby doesn't have this construct, but then it would have a completely different naming contention from existing languages.Re: Underscores are stupid
#47Earlier quoted context omitted.
and gets even worse if you bring variables into the game. a = 5 b = 3 everybody from nearly every programming language would expect that after c = a-b you will find c to be 2 not nil (or throwing an exception or whatever)
I've always found code without spaces around these symbols to be very undreadable.
Re: Underscores are stupid
#48Re: Underscores are stupid
#49There 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 ueberfluessige Beschwerden wie diese."
Damn, I just broke my pinky..
Re: Underscores are stupid
#50I've been thinking about trying to find a reasonable way to map the underscore to shift+space, but I'm not sure if that would somehow break some application that expects otherwise. It also seems to be quite difficult to achieve on Windows without registry hacks (I presume it would be easier on Linux, but haven't tried it yet).
Install AutoHotkey and then create a file called Underspace.ahk with this content:
; Underspace for AutoHotkey
; Converts Shift+Spacebar to underscore
#SingleInstance force
+Space:: Send _
Now launch that file.Try Shift+Space and it should type an underscore for you.
If you want to stop the script later, find a green "H" in your system tray and right-click it.
After you try it, I'll be curious how it works out for you. Myself, after trying it for just a minute or two, I'm not so sure if I like it. I'm finding a lot of spurious underscores before capitalized words, or after a word like "I" that ends with a capital letter. That's because I've been sloppy about the timing of when I press the Shift key before or after a space.
So I won't be using this script myself (not that I need it - I don't like to code using names_with_underscores) but maybe others will find it useful.
[1] AutoHotkey home page: http://www.autohotkey.com/
[2] AutoHotkey_L: http://l.autohotkey.net/
(minor edit for clarity)