Hacker News new | ask | show | jobs
by phab 1205 days ago
I found this article enlightening; an example of where a little formalism/structure (in the notion of the four registers) really helps identify the missing pieces in the wider picture.

I did find the use of the term "register" slightly jarring given its somewhat overloaded nature between its natural language meaning, used here, and also the sense of "a specific place in which to store a datum". Reading the Wikipedia page on the term, I came across "diatype", which to me seemed to convey the same meaning without the potential confusion from the polysemantics of "register"...?

3 comments

This dual meaning definitely crossed my mind as I was writing.. it's unfortunate.

Whenever I encounter a dual like this I like to investigate the etymology. I assume the use in linguistics is by metaphor to its use in music, "the range of a voice or instrument." More broadly, the term register comes to us from the Latin for a list of items recorded, ultimately from a word for carrying. Maybe there's something to make of that in connection to each of these very different meanings, I don't know.

The problem with diatype is that register, although not an extremely common word, is I thought somewhat well known, whereas I've never heard of diatype. I've been known to overestimate how familiar words of this sort are to other people, though, so maybe they're equally obscure to most of my readers.

My brain immediately jumped to musical register from your title, FWIW. So in my case, it worked well.
I first thought CPU register, ruled it out and then vocal registers, and finally formal speech registers in some foreign languages.
Funny... after I read about the registers of (natural) languages, that reminded me of the "registers" of pipe organs, which are quite similar in a way: it's still the same instrument, but sounds different depending on what register(s) you use. Except that in English these are called "stops" for some reason (as in "pull out all the stops" - which in the programming sense introduced in the article would mean a wild mix of programming styles, probably not something you'd want to see). Oh, well...
I immediately assumed the post would discuss some algorithm that rustc uses to allocate CPU registers, but I was puzzled because I thought that would be abstracted away by LLVM.
I don't know that it would have been better, but an option would have been to use one of the less ambiguous but less familiar terms, and define it in terms of the more familiar term early on. Something like, "diatype (register, in the sociological sense)".
> from the Latin for a list of items recorded, ultimately from a word for carrying. Maybe there's something to make of that in connection to each of these very different meanings, I don't know.

CPU registers carry values, musical registers carry tunes. (Or something very roughly along those lines, anyway; etymology is messy and complicated.)

"register" is often used in the sense boats uses it in like a... let's say English graduate student sense?

Given that "withoutboats" is a Foucault reference, this shouldn't surprise anyone who's familiar with that intellectual tradition.

For a bit more discussion on this, there's a fantastic comment on the Reddit discussion https://www.reddit.com/r/rust/comments/11m0j30/comment/jbflz...

Now I’m interested in the Foucault reference :)
It's right there in the header, "Without boats, dreams dry up."

The full quote is "In civilizations without boats, dreams dry up, espionage takes the place of adventure and the police take the place of pirates," from his work "Of Other Spaces, Heterotopias."

"Dialect" seems more appropriate me.
Programming languages already have dialects, but there is a distinction between dialects and registers, even in linguistics. They blur in some cases (AAVE for example), but dialects are usually thought of more as a variety of language used by people in geographic or cultural grouping; registers are used by users in different social situations. For example, when I give a presentation I use a very different register from when I have a drink with my friends.
Right. All of which is why I find "dialect" more appropriate.

The sorts of language/library constructs that are used are likely to vary across "people in (programming task) grouping".

That example actually highlights why I think register is a helpful name. Dialects vary across people, but registers vary across situations for each person.

In the programming language context, dialect can be applied on varying levels but usually signifies the former, where each individual or group has a persistent preference for some language or style. Within a single programming language, dialects are usually a bad thing because they risk splintering the community into mutually incompatible subgroups (e.g. scala fp styles, c++ boost).

Part of the reason why evolving a language is hard is because every time you introduce a new way to do something which could be done before, users have to choose. If that choice divides users into groups that persistently pick one over the other based on style or community affiliation, you’ve introduced a new dialect. If the choice flows more naturally from the situation the user finds themselves in, you’ve introduced a new register.

I would have called it "mood"/"mode"

Like the subjunctive mood. I imagine not super helpful for English speakers where we have exactly one verb that takes a change on subjunctive mood.

In most languages with it, entering the subjunctive mood requires a prefixing context/preposition which is analogous to function coloring system/async keyword