infinisil changed the topic of #nix-lang to: Channel for discussing Nix as a language - https://nixos.org/nix/manual/#chap-writing-nix-expressions - Logs: https://logs.nix.samueldr.com/nix-lang/
ddellacosta has quit [Quit: WeeChat 2.2]
ddellacosta has joined #nix-lang
ddellacosta has quit [Ping timeout: 245 seconds]
__monty__ has joined #nix-lang
<manveru> man, it's still annoying me that argument attribute defaults aren't captured with @
<manveru> > ({a ? 1}@args: args.a) {}
<{^_^}> attribute 'a' missing, at (string):256:16
<manveru> isn't there some elegant solution for this?
<infinisil> Hm, I wonder if it would be a problem if Nix was changed to do that
<manveru> > ({a ? null}@args: { a = 1; } // args) {}
<{^_^}> { a = 1; }
<manveru> that's how i do it for now
<manveru> just sucks :P
<infinisil> manveru: What's the point of the `null` default with this?
<manveru> so you don't have to pass it
<manveru> can be anything, really
<infinisil> > (args: { a = 1; } // args) {}
<{^_^}> { a = 1; }
<manveru> yeah
<manveru> > (args: { a = 1; } // args) { whatIsTis = 1; }
<{^_^}> { a = 1; whatIsTis = 1; }
<manveru> i don't want to allow any argument, just specific ones :)
<manveru> leads to better UX because otherwise you might do a typo that is silently swallowed
<infinisil> Ah right
<infinisil> > ({ a ? null }@args: args) {}
<{^_^}> { }
<infinisil> > ({ a ? null }@args: args) { a = 10; }
<{^_^}> { a = 10; }
<infinisil> > ({ a }@args: args) { a = 10; }
<{^_^}> { a = 10; }
<infinisil> manveru: Relevant: https://github.com/NixOS/nix/issues/2998
<{^_^}> nix#2998 (by deliciouslytyped, 3 weeks ago, open): Named ellipses
<infinisil> i think
<infinisil> Wait no
<infinisil> Distantly relevant
<manveru> hehe
<manveru> because attrsets aren't difficult enough yet :P
<infinisil> Hm, I guess that @args doesn't have the defaults makes sense when you look at how nix works
<infinisil> Because @args is then just the thunk that gets passed in
<manveru> yeah
<manveru> so i don't think changing the behaviour is possible without major compatibility issues
<infinisil> And performance issues too maybe
<manveru> but one can dream :)
<manveru> anyway, the v2 of my site generator is pretty much ready
<manveru> just need to choose a name... SageNix is kinda weird
* manveru goes looking up obscure greek myths
<infinisil> I've been thinking about writing a nix specification, where all weird things get removed
<infinisil> Hehe neat
<infinisil> This specification could then be the nix core language, and different nix evaluators could then implement different extensions (where the current nix would have a bunch of extensions already)
<infinisil> And code can specify it needs some extensions to evaluate
<manveru> uh... that does sound like haskell :9
<manveru> not sure i've seen that in any other languages... maybe rust?
<manveru> anw, i'll call this thing Eupheme
<manveru> or maybe EupheNix
colemickens has quit [Write error: Connection reset by peer]
colemickens has joined #nix-lang
{^_^} has quit [Remote host closed the connection]
{^_^} has joined #nix-lang
ddellacosta has joined #nix-lang
<manveru> hm, using `assert` in nix repl pretty much breaks it
__monty__ has quit [Quit: leaving]
<ekleog> hm? `assert false; 1+1` works pretty well for me
<manveru> type just `assert` :)
<ekleog> it's just the repl waiting for more input to complete the expression
<ekleog> if you type assert\nfalse; 1+1 it works
<manveru> yeah
<manveru> was my first time trying assert, didn't know how it works :)
<ekleog> oh 'k :)
<manveru> seems like it's similar to `with`
<ekleog> yup, with and assert have a weird syntax, but I guess it makes sense when trying to do pseudo-statements in an expression-based language
<manveru> yeah
<ekleog> ooh makes me think
<ekleog> when I wanted $ for nix, nix already has ;
<ekleog> the ; of assert is exactly the semantics I'd like $ to have for everything, if we consider assert as a function bool -> 'a -> 'a
<manveru> hehe
<manveru> $ would be nice indeed...
<{^_^}> nix#1845 (by Ekleog, 1 year ago, open): Adding an operator like Haskell's '$'
<pie_> i did have some problems with parse failures _imported from a file_ causing the repl to behave weird though