| 11 Dec 2025 |
KFears (they/them) | In reply to @helle:tacobelllabs.net but I am just using this to demonstrate cases to worry about with UX and teaching, not so much as an actual thing to work on right now I think in the context of programming languages, it is common to have a section on "variables", and there it's explained that "you can give a name to the value, the name must start with an English letter and can contain numbers and - and _ | 22:27:33 |
piegames | In reply to @charles:computer.surgery
i don't think they do:
nix-repl> "1" = 2
Added "1".
nix-repl> "1"
"1"
IMO that this syntax even exists in the first place is one of the many gotchas that happened because let bindings lazily reused attrset syntax just a bit too much (to be fair let binding used to be literally attrsets, which explains how it happened) | 22:28:55 |
KFears (they/them) | In reply to @piegames:flausch.social We need them for attrsets obviously, and a way to access those, but we already have that. Having a "foo bar" key is important, but having a variable named "foo bar" in a let binding? What for? Consistency, I think? I mean, I think this follows under the principle of least astonishment, that it's weird that attrsets can have arbitrary member names, but variables can't | 22:32:55 |
@ghpzin:envs.net | If you consider attrset as dictionary / map equivalent in other languages, then it makes sense. | 22:36:01 |
piegames | We already have an inconsistency for dynamic attributes and people seem to be fine | 22:36:59 |
KFears (they/them) | As mentioned before, I don't think static typing would work in general, but I'd like a bit more typing capabilities, because e.g. when you're implementing a module system, you have to create thin wrappers around basic types just so that you'd be able to combine them together into something bigger | 22:37:42 |
KFears (they/them) | e.g. I've seen code like this
float = lib.types.create {
name = "Float";
description = "floating point number";
check = builtins.isFloat;
merge = lib.options.merge.equal;
};
| 22:37:53 |
KFears (they/them) | It feels weird | 22:37:57 |
piegames | In a let binding, you can't do {foo} = "bar" but you can do foo.{bar} = "baz" IIRC | 22:38:03 |
piegames | Ugh, Matrix | 22:38:46 |
hexa | markdown 😄 | 22:38:51 |