if you could have an alternative two way representation of your nix files, what would it look like?
After years of using nix I’m still finding myself sometimes puzzled by the language.
so I’ve been researching ways to operate and expose ‘nix-space’ – the underlying mathematical lattice &language through reversible mechanical transformations.
I’m one of the people that think nix syntax isn’t that bad, it looks like JSON after all.
The only thing that I don’t like is function definition and function calling syntax. For that I wish it was a bit more traditional (like JavaScript for example)
If I was the one designing the language today, it would look almost identical to TypeScript with all imperative stuff removed and lazyness built in.
Especially the Type system of TypeScript is so nice and powerful, it would be nice to have this in Nix.
Also, I’d like the module system added as a first class system to the language as Eelco described it a long time ago.
mapybara: … Can you say more about what you don’t like …
mainly readability. I have a hard time reading understanding and debugging.
a good % of the nix corpus is actually just nested shell, but the shell isn’t mechanically tied and analyzed.
but more generically: nix is this beautiful, clean pure functional crystal, and I love it, and it’s been dressed in elaborate curly {setting}. with llms + autoformalization we can now easily change the look of it without comprising safety.
e.g: an org could migrate from a bazel corpus to nix while keeping most existing build files relatively unchanged – but simply creating a mapping.
VanCoding: …only thing that I don’t like is function definition and function calling syntax…
take a look at the nixy example I linked above, e.g test with this.
addSet = { a, b }: a + b; # nix
def addSet(a, b): # nixy
(a + b)
waffle8946: …adding whitespace sensitivity and random keywords into the language doesn’t solve any problems for me…
we could also remove keywords. make them more verbose on demand or less verbose. Historically there’s many reasons for alternative syntaxes sharing ast: OCaml/Reason, Hy/Python, CoffeeScript/Javascript.
the cool bit is the shared substrate we run on, not the exact formatting of our braces