tazjin / nix-1p

A (more or less) one page introduction to Nix, the language.
https://code.tvl.fyi/about/nix/nix-1p
896 stars 24 forks source link

Pedantry corner: import isn't a keyword #12

Closed Gaelan closed 1 year ago

Gaelan commented 1 year ago

https://github.com/tazjin/nix-1p#import--nix_path--entry claims that import is a keyword. As far as I'm aware, it's just a built-in function: both the nixos/nix and rnix parsers parse it as a normal identifier, and I'm not aware of it being magic in any way that other built-in functions aren't.

(Another confusing thing, on a more meta level: this document is republished in the tvl monorepo at https://code.tvl.fyi/about/nix/nix-1p, which makes the instruction to "file an issue" with no further detail rather confusing.)

tazjin commented 1 year ago

Hey! Thanks, yep, you're right. I've noticed that some syntax highlighters treat it as a keyword (i.e. colour it differently), but it's probably reasonable to call it a builtin instead (especially because in e.g. Tvix we've made it an optional one, so it'd be confusing to claim there are optional keywords). I'm making that change in cl/8832.

(Another confusing thing, on a more meta level: this document is republished in the tvl monorepo at https://code.tvl.fyi/about/nix/nix-1p, which makes the instruction to "file an issue" with no further detail rather confusing.)

It's rather the other way around, the document is republished here and the bug tracker for TVL is at https://b.tvl.fyi, but I don't mind accepting these issues in either place.