Hacker News new | past | comments | ask | show | jobs | submit login

Nix is not an operating system. It can be used to build operating systems easily, though.

Also, there isn't anything "functional" about Nix. It's a nice sales pitch, but underneath it's just a thin layer over bash scripts and environment variables.




Nix is a metaprogramming language for bash.

The metalanguage is indeed purely functional. The object language (bash) isn't.


Right. You still end up mostly writing bash scripts when wrangling Nix. It's not some sort of ivory tower Haskelish hermetic ecosystem, it's just a very nice way to make bash scripting sane.


I don't think I'd call adding yet another layer of escaping syntax "sane".


Nix uses string antiquotation, not string escaping. It's one of very few languages which has it. And yes, it is sane, very sane. The only sane solution to this problem.

Edolstra's thesis advisor was the first to create a scannerless GLR parser:

https://en.m.wikipedia.org/wiki/Scannerless_parsing

The first versions of Nix used a scannerless GLR parser, because it's the only way to prototype sophisticated features like antiquotation without going completely mad. Once the syntax was completely locked down it was rewritten with a separate scanner and LR(something) parser, but they're intricately entwined. The scannerful, non-GLR parser is faster but basically frozen and extremely difficult to modify. Fortunately Nix's syntax has been exceptionally stable for the last decade or more.

True string antiquotation is a feature that every language should have, but unfortunately with current technology it forces you to choose between a slow parser or a fast parser that's almost impossible to modify.

Some languages have "string interpolation" which is a weaker, more fragile form of antiquotation.


And that, ladies and gentlemen, summarizes the attitude you'll get from Nix people.

By antiquotation you mean evaluating things inside ${}, which is a standard thing in many, many places, including shell and Javascript.

Meanwhile, https://nixos.org/manual/nix/stable/expressions/language-val... has gems such as this:

> Since ${ and '' have special meaning in indented strings, you need a way to quote them. $ can be escaped by prefixing it with '' (that is, two single quotes), i.e., ''$. '' can be escaped by prefixing it with ', i.e., '''. $ removes any special meaning from the following $. Linefeed, carriage-return and tab characters can be written as ''\n, ''\r, ''\t, and ''\ escapes any other character.


> By antiquotation you mean evaluating things inside ${}, which is a standard thing in many, many places, including shell and Javascript.

No, I absolutely do not.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: