Earlier quoted context omitted.
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 sill…
Underscores are stupid
101–110 of 131 posts
Re: Underscores are stupid
#102I'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).
It's very easy on Windows with the strange and wonderful AutoHotkey [1]. I recommend the more advanced AutoHotkey_L fork [2], but this script should work in either version. 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 a…
Re: Underscores are stupid
#103 Personally, I'd prefer to see the English conventions carried over to
the use of general use of hyphen and underscore in identifiers in
the core (and everywhere else).
By that, I mean that, in English, the hyphen is notionally a
"higher precedence" word-separator than the space
(or than its intra-identifier stand-in: the underscore).
For example: there's an important difference between:
initiate_main-sequence_detonator_phase()
and:
initiate_main_sequence-detonator_phase()
The former initiates the detonator phase for the main sequence;
the latter initiates the main phase of the sequence detonator.
More simply, there's a difference between:
$obj1.set_difference($obj2);
and:
$obj1.set-difference($obj2);
The first is setting a difference; the second is computing a difference-of-sets.
The rule I intend to use and recommend when employing this new
identifier character in multiword names is that you should place an
underscore between "ordinary unrelated" words, and a hyphen only
between a word and some modifier that applies specifically to that word.
Which, if applied to Temporal, would lead to:
my $now = DateTime.from_epoch(time);
The C method also has the synonym C.
(These are also available through the methods C and
C, respectively.)
There's a C method,
The C method returns a number 1..5
The C method returns the day of the quarter.
The C method returns the day of the year,
The method C returns the second truncated to an integer.
The C method returns the C object
(i.e. only C actually uses underscore).
Oh, and the optional C argument to C should probably
become C for consistency with the C method
(or, preferably, we should jut bite the bullet and go with C
throughout).
Damian
From Perl6 mailing list: http://www.nntp.perl.org/group/perl.perl6.language/2010/04/m...Re: Underscores are stupid
#104Interesting 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.
That's actually not very interesting. He was talking about hyphens, but calling them dashes, because normal people do that unless they are talking about typography.
Re: Underscores are stupid
#105Earlier quoted context omitted.
That's actually not very interesting. He was talking about hyphens, but calling them dashes, because normal people do that unless they are talking about typography.
No. "normal people" call them hyphens. I think it is a mainly USian curiosity to call hyphens dashes. The Rest of the World calls hyphens, well, hyphens. It's only the US that call them dashes. I've no idea why that is.
Re: Underscores are stupid
#106Earlier quoted context omitted.
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.
You are echoing Avdi’s point. I understand it, I just happen to disagree with it. If Lisp was an infix language, then yes foo-bar would mean something different to the parser than foo - bar because of the whitespace. But what’s also at stake is whether that language would be readable to humans without mistakes. Part of what makes Lisp work, IMO, is that you never try to type foo - bar, so you never run into an accide…
Unless you have a function called "foo", and you want to pass it the subtraction function as it's first parameter and the value "bar" as its second. In which case (foo - bar) is perfectly valid, reasonable, and completely different from (foo-bar).
Even though Lisp is not an infix language, foo-bar does mean something different to the parser than foo - bar because of whitespace.
Re: Underscores are stupid
#107Earlier quoted context omitted.
You are echoing Avdi’s point. I understand it, I just happen to disagree with it. If Lisp was an infix language, then yes foo-bar would mean something different to the parser than foo - bar because of the whitespace. But what’s also at stake is whether that language would be readable to humans without mistakes. Part of what makes Lisp work, IMO, is that you never try to type foo - bar, so you never run into an accide…
"you never try to type foo - bar" Unless you have a function called "foo", and you want to pass it the subtraction function as it's first parameter and the value "bar" as its second. In which case (foo - bar) is perfectly valid, reasonable, and completely different from (foo-bar). Even though Lisp is not an infix language, foo-bar does mean something different to the parser than foo - bar because of whitespace.
I’m sure you knew perfectly well that I meant you never type foo - bar meaning foo subtract bar :-)
Re: Underscores are stupid
#108Re: Underscores are stupid
#109Earlier quoted context omitted.
"let the compiler work its magic." if you want that, use a higher level language. One of the foundations of C is that there is as little implicit behavior as possible. I'd hate to be left in the dark whether my . will now result in a pointer or a dereferenced value and I doubt it would even work for the compiler to figure this out in all edge cases.
C is full of implicit type conversions. I think the key is that C is based on value semantics and not references, and that makes pointers full-blown values with their own address, conversions, … - something closer to C's integer types than to other languages' references, and equally picky about operators.
Re: Underscores are stupid
#110After 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.
Then use a language which allows trailing commas in lists, param-lists, maps, e.g. grOOvy