💾 Archived View for idiomdrottning.org › lisp-naming captured on 2023-07-10 at 14:00:34. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-07-16)

➡️ Next capture (2023-12-28)

-=-=-=-=-=-=-

Naming philosophy (for Lisp stuff)

Abbreviations...

...and cryptic letter combinations, even numbers, are OK! Needs to contain at least one letter obv.

I’m just fine with kind of a C programmer’s approach to naming.

The names do not need to be long and descriptive if they are used often. (Conversely, they do if they are used seldomly.)

Precedent: cons, cdr, car, progn, list-ref

Examples: fn, strse, 7off, c, o

Hyphencase...

...a.k.a. skewer case is the way. All in lower case.

Precedent: with-input-from-file, list-ref

Example: define-ir-syntax

No new ASCII

By ASCII I mean non-alphanumerical characters. I know that a and b and c are also part of ASCII but this ban applies to things like < and }.

Weird unicode stuff

I have no current plans to switch over from -> to → but I wouldn’t mind it if that change happened, consistently. Emoji names are fine too but since I found that they make my SSH sessions bork up I stopped using them.

Alphabet and numbers is OK, then anything else on the keyboard is not OK, and then unicode stuff above that is OK again.

If that sounds weird, there’s a good reason.

Computer programmers have had this weird tendency to reach for those character that actually have another meaning. For example, $ means dollars, money. But shell script uses it to mark a variable.

It’s this re-purposing of existing ASCII-matics that I wanna put the kibosh on.

Gladly use already-grandfathered in ASCII

This includes for example

More recent stuff but reluctantly allowed include

Point is, I love quasiquotation. It’s pretty much the best part of Lisp, the fact that code is also data and data is also code. I’m never gonna let go of my weird commas, apostrophes, backticks and at signs in that context.

The purpose of the philosophy isn’t to go back and edit old code from

`(this ,stuff)

to

(quasiquote (this (unquote stuff)))

The purpose of the philosophy is to say “OK, this is fine but no further”. Completely arbitarily drawing a line in the sand at around year 2002 or so. Older than that is great, newer than that is clutter that I can’t accept, get off my lawn and what not.

I found early on that I was really tempted to kid myself into seeing my own new stuff as special and as worthy of using these overly ASCII-licious names. “This new operator is going to be absolutely foundational!”

But in hindsight everytime I’ve instead used a name based on hyphen-cased letters I’ve been happy about that. Because sometimes the new operators do become pretty foundational, like cut arguably has become, and then we’re stuck with all these ants-like weird characters crawling over our code.

Also lists shall use parens and not square brackets. Come on now.

Update

An older version had:

Even more reluctant attitude towards

But I haven’t had to use SRFI-26 since we made fn and c. I’ve ended up being very happy about fn; it’s lambda the ultimate combinator expressed more concisely and in plain letters. So it’s possible to become free from even something like cut.

fn and over