3 ms·
I understand that Guix is newer and has less packages so far (but number is growing). I don't know, I rather like Nix's language, maybe I am just not a Lisp pe
by rdtsc 10y ago
I understand that Guix is newer and has less packages so far (but number is growing).
I don't know, I rather like Nix's language, maybe I am just not a Lisp person.
- Ericson2314 10y agoI greatly respect scheme, and yet I like the nix expression language too. Scheme's claim is you shouldn't be using x more bloated language than it, but the nix expression language is smaller and simpler than Scheme; it beats it at its own game! More practically, I can't think of anything that I wanted that Scheme offers but the nix expression language doesn't.
- qwertyuiop924 10y ago>the nix expression language is smaller and simpler than Scheme; it beats it at its own game! It may have a smaller stdlib than scheme (but I doubt it). But it's very hard to be simpler than scheme semantically. As for what I want from scheme that nix doesn't provide, a simple, regular, syntax that I already know is what I want. I understand that that doesn't apply to everybody.
- Ericson2314 10y ago> It may have a smaller stdlib than scheme (but I doubt it). But it's very hard to be simpler than scheme semantically. Yes, I mean the semantics of the language. Scheme is indisputably more complex. There isn't really much a standard library for the Nix Expression Language either. > As for what I want from scheme that nix doesn't provide, a simple, regular, syntax that I already know is what I want. I understand that that doesn't apply to everybody. off the top of my head: Scheme-Simplified ::= <Item>* Items ::= (define (<Id>*) <Expr>) | (define <Id> <Expr>) Expr ::= (<Expr> <Expr>*) | (set! <Id> <Expr>) | (lambda (<Id>*) <Expr>) Nix-Expr ::= <Pattern> : <Nix-Expr> | with <Nix-Expr>; <Nix-Expr> | { <Nix-Item>* } | let <Nix-Item>* in <Expr> | <Expr> <ArithOp> <Expr> | <Expr>.<Id> | <Expr>.<String-Lit> | <Expr> ? <Id> | <Expr> ? <Id> or <Nix-Expr> Nix-Item ::= <Id> = <Nix-Expr>; | <StringLit> = <Nix-Expr>; | inherit <Expr>; | inherit (<Nix-Expr>) <Nix-Expr>;
- qwertyuiop924 10y agoYeah, that scheme syntax looks much simpler. And it is far more regular than Nix's. Of course, scheme is regular enough that the output of the readtables match this: Scheme ::= <Expr>* Expr ::= <Atom> | (<Expr>*) Atom ::= <String> | <Symbol> | <Number> And IIRC, that's close to what r5rs requires, although without the '`, syntactic sugar, which a readtable would handle in schemes that have them, and would be added to the above for schemes that don't. I may be wrong, though. The semantics are also simple: A function's arguments are evaluated, bound to arguments and passed to it. A special form or macro have their arguments passed to them unevaled. In the case of a macro, the output of the macro is evaled instead. Scope is lexical. There's about 95% of the semantics right there. The only things I left out, to my knowledge, are dynamic variables, which weren't standardized until recently. The entire thing may be larger than Nix (I don't think it is), but more regular? I doubt it.
- Ericson2314 10y agoNote that's a dumbed down scheme, where nothing can be accomplished, I should take a look at the guix APIs to craft a bigger subset. I realized as I wrote it, my argument does look undercut, but didn't want to spend more time just yet, so posted that anyways. Besides dynamic variables, there is also plain old variable mutation. Scheme macros are much more complex than what you described, because of hygiene. For the sake of making Scheme look better, I left macros out of my grammar. The Nix expression language has none of these things. > but more regular? I doubt it. Nix's lack of a top level (the <Items>* in Scheme) is a big boon for simplicity, especially concerning imports from other files which I forgot to include.
- qwertyuiop924 10y ago>Besides dynamic variables, there is also plain old variable mutation. Scheme macros are much more complex than what you described, because of hygiene. For the sake of making Scheme look better, I left macros out of my grammar. The Nix expression language has none of these things. Fair enough, but: >I should take a look at the guix APIs to craft a bigger subset. What? No. Those don't add any complexity to the language. You don't add every function to your BNF syntax, do you? This is what I meant about regularity: The sexpr and atoms are the only syntactic elements (except quote and friends, which are syntactic sugar for sexprs). Most of the things you included in your scheme BNF syntax aren't syntax, they're special forms. Special forms are not syntactically distinct, they are semantically distinct. So while define, if, and lambda are part of the semantics, they aren't part of the syntax. Macros, too, have no syntactic differentiation: You actually CAN'T add macros to the BNF of the syntax, because there is no syntax to add. If that's not regular, I don't know what is. >Nix's lack of a top level (the <Items>* in Scheme) is a big boon for simplicity, especially concerning imports from other files which I forgot to include. How? What's so complex about having multiple forms at toplevel?