Live data from Hacker News

Underscores are stupid? Get a Japanese keyboard (2012)

daveperrett.com

71–78 of 78 posts

Re: Underscores are stupid? Get a Japanese keyboard (2012)

#71
post #62

For multiple lexies into a single identifier, I love middle dot (·), which is actually works in most modern languages out of the box. Example `some·variable`. Try it in your favorite languages and let me now how it goes. For elements that have to bee ditched in a destructuring operation, like `target, _ = some·generator()`, it’s possible to use a word that explicit this discard. One short one term for that is "lee",…

This is the most HN comment ever.

Oh, thanks for the compliment, that made my day. :)

Re: Underscores are stupid? Get a Japanese keyboard (2012)

#72
post #65

For multiple lexies into a single identifier, I love middle dot (·), which is actually works in most modern languages out of the box. Example `some·variable`. Try it in your favorite languages and let me now how it goes. For elements that have to bee ditched in a destructuring operation, like `target, _ = some·generator()`, it’s possible to use a word that explicit this discard. One short one term for that is "lee",…

In Clojure '-' is not a special symbol, so it's used as a word separator in function names, like 'get-in'. That's possible because '-' is not an operator, but is a function with a 1-symbol name.

The best part of setting things up like that (especially with `-` having any arity) is that there's no ambiguity in the grammar between -/1 (negation) and -/2 (subtraction).

Re: Underscores are stupid? Get a Japanese keyboard (2012)

#73

Maybe it's because I took an actual typing class way back in the dark days of actual clackity-clack type writers, but I don't get the dislike of shift keys. Are these people that learned to type from only playing games or other non-formalized learning to type? Kudos for you learning regardless of the method, I'm just looking at why I don't have the same aversion to the shift keys. I even use the "proper" shift key me…

That proper shift technique never clicked with me. I developed a technique whereby I use only the left pinky for shift, and only the right thumb for the spacebar. Thus, for text not requiring shifting, I'm using nine fingers including the right thumb. Yet, I can touch type just about as fast if I lose the left pinky by keeping it planted on the left shift key! FOR INSTANCE, I TYPED THIS SENTENCE WITHOUT LIFTING MY PINKY FROM THE SHIFT KEY.

My technique is efficient in circumstances where I have to type several upper case letters in a row, which happens quite regularly in C programming. Using "proper" shifting for an identifier like UINT_MAX is nonstarter, and using CapsLock before and after is likewise inefficient.

I think the double Shift key design and the related proper technique is a holdover from mechanical typewriters. You need to put a good amount of strength into the shift. It's not as easy to type with your left hand while its pinky is anchored to the Shift key.

Re: Underscores are stupid? Get a Japanese keyboard (2012)

#74
post #65

Earlier quoted context omitted.

In Clojure '-' is not a special symbol, so it's used as a word separator in function names, like 'get-in'. That's possible because '-' is not an operator, but is a function with a 1-symbol name.

Also Raku, the Perl spin-off, is allowing this. Clojure I guess is taking that from its LISP legacy, where it’s not an issue as you don’t have infix notation. Raku on the other hand, took the decision on the road starting from Perl. If I recall correctly, Raku does let you use infixed dashes as minus into agglutinated numeric literals and operators sequences, like `2-5-7`, but your need spaces to use it as a substrac…

The current definition:

An ordinary identifier is composed of a leading alphabetic character which may be followed by one or more alphanumeric characters. It may also contain isolated, embedded apostrophes ' and/or hyphens -, provided that the next character is each time alphabetic.

https://docs.raku.org/language/syntax#Ordinary_identifiers

This means that '2-5-7' is NOT an identifier but the numerical value -10.

Re: Underscores are stupid? Get a Japanese keyboard (2012)

#75
post #74

Earlier quoted context omitted.

Also Raku, the Perl spin-off, is allowing this. Clojure I guess is taking that from its LISP legacy, where it’s not an issue as you don’t have infix notation. Raku on the other hand, took the decision on the road starting from Perl. If I recall correctly, Raku does let you use infixed dashes as minus into agglutinated numeric literals and operators sequences, like `2-5-7`, but your need spaces to use it as a substrac…

The current definition: An ordinary identifier is composed of a leading alphabetic character which may be followed by one or more alphanumeric characters. It may also contain isolated, embedded apostrophes ' and/or hyphens -, provided that the next character is each time alphabetic. https://docs.raku.org/language/syntax#Ordinary_identifiers This means that '2-5-7' is NOT an identifier but the numerical value -10.

Thanks for the link and the excerpt. Just out of curiosity, did the capitalized "NOT" was there because my above message was interpreted as a guess that `2-5-7` could serve as an identifier in Raku? That was not my belief nor what I tried to expose, to be clear on that point.

Thank you again for your reply.

Re: Underscores are stupid? Get a Japanese keyboard (2012)

#76
post #74

Earlier quoted context omitted.

The current definition: An ordinary identifier is composed of a leading alphabetic character which may be followed by one or more alphanumeric characters. It may also contain isolated, embedded apostrophes ' and/or hyphens -, provided that the next character is each time alphabetic. https://docs.raku.org/language/syntax#Ordinary_identifiers This means that '2-5-7' is NOT an identifier but the numerical value -10.

Thanks for the link and the excerpt. Just out of curiosity, did the capitalized "NOT" was there because my above message was interpreted as a guess that `2-5-7` could serve as an identifier in Raku? That was not my belief nor what I tried to expose, to be clear on that point. Thank you again for your reply.

Yeah, it was. Sorry, misread :-)

Re: Underscores are stupid? Get a Japanese keyboard (2012)

#78
post #76

Earlier quoted context omitted.

Thanks for the link and the excerpt. Just out of curiosity, did the capitalized "NOT" was there because my above message was interpreted as a guess that `2-5-7` could serve as an identifier in Raku? That was not my belief nor what I tried to expose, to be clear on that point. Thank you again for your reply.

Yeah, it was. Sorry, misread :-)

No worry, we all do that here and there. ;)
Post reply on HN