| 11 Dec 2025 |
Rutile (Commentator2.0) feel free to ping | * non-arbitrary = [a-zA-Z][\w-]*(?!<=-) | 21:21:21 |
helle (just a stray cat girl) | I agree, but already having to think about that helps shape further choices | 21:21:50 |
Charles | it's not like i wasn't thinking about explainability when i came up with this idea | 21:22:14 |
helle (just a stray cat girl) | like, I've seen some amazing programming concepts that people should learn early on, and omfg when I had to try and teach them to people | 21:22:29 |
Charles | in the context of nix i don't think there really is a difference | 21:22:59 |
Charles | in other languages though function names, class/struct/enum/type names, variable names, etc are all identifiers | 21:23:19 |
helle (just a stray cat girl) | and this can go as simple as "well, Python has like at least 3 string formatting mini languages, of which 2 are relevant to this day" | 21:23:22 |
Rutile (Commentator2.0) feel free to ping | I'd just explain it as "has to be a letter at first, then any amount of word characters (letter or digit) and might include a hyphen; everything else requires wrapping in an ident string.
| 21:23:29 |
helle (just a stray cat girl) | like that one gave us no end of headaches | 21:23:32 |
Charles | variable names are a subset of identifiers | 21:23:53 |
helle (just a stray cat girl) | (we TA'ed at uni extensively and cowrote some courses) | 21:24:08 |
Charles | nix doesn't have functions distinct from variables or types though so in nix's case the sets are equal | 21:24:09 |
rosssmyth | horrifying | 21:25:19 |
Charles | yeah lol i'm very surprised that works | 21:25:42 |
helle (just a stray cat girl) | check the Nix iceberg for more horrors | 21:25:45 |
Charles | i would explain it as XID_Start followed by zero or more XID_Continue because that's what it is, and you don't need to explain what those are because explaining that is unicode's job | 21:27:15 |
Charles | for example https://doc.rust-lang.org/reference/identifiers.html#grammar-IDENTIFIER | 21:27:38 |
Charles | * for example https://doc.rust-lang.org/reference/identifiers.html | 21:27:50 |
Rutile (Commentator2.0) feel free to ping | In reply to @charles:computer.surgery i would explain it as XID_Start followed by zero or more XID_Continue because that's what it is, and you don't need to explain what those are because explaining that is unicode's job Something something consecutive hyphens | 21:28:03 |
helle (just a stray cat girl) | I mean...... for a first year compsci student with the two classes I just mentioned, :P that is the level a lot of people starting out with any new language actually would have roughly, even if they are super skilled in say PHP | 21:28:07 |
Charles | the motivation is to ban those from what i'm calling literal identifiers | 21:28:35 |
Charles | that's the entire point | 21:28:51 |
rosssmyth | Nix is an immutable lang so there are no "variables", as nothing can ever change. For functional languages you usually call things "[let] bindings," as it is bound to a specific value, and will never change (unless you shadow the binding). | 21:28:52 |
rosssmyth | * Nix is an immutable lang so there are no "variables", as nothing can ever change. For functional languages you usually call things "[let] bindings," as it is bound to a specific value, and will never change (unless you shadow the binding). Even then you aren't changing the binding itself as once you go back to the original scope, it will still be bound to the original value. | 21:29:33 |
Charles | yeah but "binding" is too scary of a word so people don't say that, they just say "variable" because that's more commonly understood | 21:29:34 |
Charles | the rust book for example used to use "binding" because it's correct but then switched to calling everything "variables" to be understandable | 21:29:56 |
helle (just a stray cat girl) | yep, lies to children | 21:30:00 |
helle (just a stray cat girl) | or in this case, lies to people who don't do programming language design or analysis or, etc | 21:30:26 |
rosssmyth | Basically just for people who don't usually sit in functional programming world | 21:31:00 |
rosssmyth | which is fine | 21:31:07 |