Hacker News new | ask | show | jobs
by psychoslave 740 days ago
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", as in "Basest part, ‘dregs’, ‘refuse’[1]."

I wasn’t aware that many people disliked so much underscore and other YOLO approaches to morphe agglutination. I always felt sad that we had to endure this ridiculous typographical masochism that plague the whole industry. But going against a widespread habit, as absurd and sore could it be, is generally its own road to some form flagellation.

[1] https://www.oed.com/dictionary/lee_n2?tab=meaning_and_use#39...

2 comments

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 substraction operator when an identifier is involved like `bare-price - gift-voucher`.

That said I never used Raku nor Clojure (or any Lisp), there is just no job opportunity that ever reached me with these kind of non-mainstream programming language.

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 :-)
No worry, we all do that here and there. ;)
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).
This is the most HN comment ever.
Oh, thanks for the compliment, that made my day. :)