8 ms·
> I am going with the "configuration syntax is complex and difficult..." I guess it's by comparison. Whenever some NodeJS or Python project is mentioned, I've
by rgoulter 5y ago
> I am going with the "configuration syntax is complex and difficult..."
I guess it's by comparison.
Whenever some NodeJS or Python project is mentioned, I've never seen the complaint "NodeJS syntax is too hard" or "Python syntax is too hard".
Nix's syntax itself is not difficult. It's slightly different than other languages, but developers are used to same-thing-different-syntax in different languages.
e.g. in NodeJS, you might have a lambda like: `({ x, y }) => x + y`. In Python, this is `lambda x, y: x + y'. In Nix, this is `{ x, y }: x + y`.
- dmitriid 5y ago> Whenever some NodeJS or Python project is mentioned, I've never seen the complaint "NodeJS syntax is too hard" or "Python syntax is too hard". Because their syntax is used for more than just configuration (if it's used for configuration). These are full programming languages that a lot of people know and understand. Nix on the other hand is a DSL that is used in exactly one place: nix configuration. So I think it's fair to complain about nix-as-a-language and its syntax when the only place you will ever encounter it is nix configuration. And especially with gems like --- start quote --- Attempting to perform division in Nix can lead to some surprises. nix-repl> 6/3 /home/nix/6/3 What happened? Recall that Nix is not a general purpose language, it's a domain-specific language for writing packages. Integer division isn't actually that useful when writing package expressions. Nix parsed 6/3 as a relative path to the current directory. To get Nix to perform division instead, leave a space after the /. Alternatively, you can use builtins.div. nix-repl> 6/ 3 2 nix-repl> builtins.div 6 3 2 --- end quote --- etc.
- rgoulter 5y agoThe programming languages developers use have surprises and inconsistencies like this when you compare between them. It seems awfully pessimistic to think Nix is too hard to use for things like that. (Although I never really understood people who detested Python's whitespace significance, either). I think it's also a bit impractical. I'd be surprised if anyone refused to use Terraform because they didn't like HCL. (Well, these days there's Pulumi). -- I think Nix's boon to managing packages makes it worth the minor unfamiliarity of a very simple programming language.
- dmitriid 5y agoI refuse to use Terraform, and Pulumi, and many other things :) One-off, poorly specified DSLs with no tool support, no debuggability, bad error reporting etc. are a good thing only in theory. In practice, yes, we often have to use them because there's no other choice. It doesn't mean "oh just get over it, and reap the benefits" is a good argument.
- 1_player 5y agoOnly Terraform uses a one-off poorly specified DSL. Pulumi is based on real programming languages. The criticism might be that their libraries/API is poorly specified. But the languages it's based upon are standard with all the tooling one's used to.
- Smaug123 5y agoIn my (rather limited) experience, the poor specification of Pulumi's libraries is almost entirely down to the fact that they are exposing equally poorly specified functionality from cloud providers.