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/
ivan has quit [Remote host closed the connection]
ivan has joined #nix-lang
__monty__ has joined #nix-lang
__monty__ has quit [Read error: Connection reset by peer]
__monty__ has joined #nix-lang
__monty__ has quit [Remote host closed the connection]
__monty__ has joined #nix-lang
ixxie_ has joined #nix-lang
ixxie_ has quit [Quit: Lost terminal]
__monty__ is now known as toonn
toonn has quit [Read error: Connection reset by peer]
joepie91 has quit [Ping timeout: 252 seconds]
toonn has joined #nix-lang
toonn has quit [Remote host closed the connection]
toonn has joined #nix-lang
joepie91 has joined #nix-lang
joepie91 has quit [Changing host]
joepie91 has joined #nix-lang
toonn has quit [Quit: leaving]
<infinisil> > ({ y ? {} }@x: x) {}
<{^_^}> { }
<infinisil> Damn, I did not know that actually
<elvishjerricco> > ({ z ? y }@y: z) {}
<{^_^}> { }
<infinisil> I bet you didn't know this works though:
<infinisil> > let ${"x"} = 10; in x
<{^_^}> 10
<elvishjerricco> holy crap
<elvishjerricco> lol
<elvishjerricco> that's absurd
<infinisil> > let ${"x" + ""} = 10; in x
<{^_^}> error: dynamic attributes not allowed in let at (string):192:1
<infinisil> Only works with constant strings though
<elvishjerricco> aw
<elvishjerricco> I mean, it's probably for the best... but aw
<infinisil> Yeah lol
<sphalerite> > with {"x" + ""}; x
<{^_^}> error: syntax error, unexpected '+', expecting '.' or '=', at (string):192:11
<elvishjerricco> Why would you ever need that? Could you even reference `let ${" non identifier "} = 10; in ...`?
<sphalerite> > with {${"x" + ""} = null;}; x
<{^_^}> attribute '__path' missing, at (string):182:74
<infinisil> Oh what
<sphalerite> whoooooa
<infinisil> I bet that's something weird with the bot
<elvishjerricco> wat
<sphalerite> oh right that's your printing hacks
<infinisil> > :v _show
<{^_^}> _show = x: if lib.isDerivation x then "<derivation ${x.drvPath}>" else x
<infinisil> I don't think so
<elvishjerricco> > let ${" non identifier "} = 10; in ${" non identifier "}
<infinisil> > :v x
<{^_^}> error: syntax error, unexpected DOLLAR_CURLY, at (string):192:36
<{^_^}> x = let attr = pkgs.haskellPackages.xmonad; in lib.attrByPath (lib.init attr.__path) {} pkgs
<infinisil> Oh, it's x, it's defined
<sphalerite> > with {${"test" + "ing"} = null;}; testing
<{^_^}> "{^_^}"
<infinisil> I asked my free variables question for this btw: https://github.com/haskell-nix/hnix/pull/363
<{^_^}> hnix#363 (by Infinisil, 13 minutes ago, open): More precise freeVars
<infinisil> sphalerite: But yes, what you're trying to do does work
<sphalerite> > 5
<{^_^}> "{^_^}"
<infinisil> > with {${"something" + "thatscertainlygoingtonotbedefined"} = null; }; somethingthatscertainlygoingtonotbedefined
<{^_^}> "{^_^}"
<infinisil> Um
<infinisil> Haha
<infinisil> Damn you
<infinisil> > _show = x: if lib.isDerivation x then "<derivation ${x.drvPath}>" else x
<sphalerite> >:D
<elvishjerricco> So there's just no point at all in the special dollar let syntax, right? Like you can expression odd identifiers but you can't reference them
<{^_^}> _show defined
<infinisil> elvishjerricco: Maybe..
<sphalerite> > let a = "b"; ${a} = "c"; in b
<{^_^}> error: dynamic attributes not allowed in let at (string):192:1
<infinisil> > let ${null} = 10; in "hello"
<{^_^}> error: dynamic attributes not allowed in let at (string):192:1
<sphalerite> > let ${"hello world"} = 5; in null
<{^_^}> null
<sphalerite> > let "hello world" = 5; in null
<{^_^}> null
<sphalerite> ¯\_(ツ)_/¯
<infinisil> Wait what
<infinisil> Lol
<sphalerite> infinisil: it's just binding a name containing a spacec
<sphalerite> nothing worse
<sphalerite> :)
<sphalerite> not sure there's any way to *access* it at that point
<sphalerite> #nix-gymnastics
<infinisil> Yeah, that's pretty weird..
<infinisil> Oh well, not the first weird thing I'm seeing with nix
<infinisil> > weird3
<{^_^}> "foo"
<infinisil> > :v weird4
<{^_^}> weird4 = let x = "foo"; in ({ x ? x }: x) {}
<infinisil> > :v weird2
<{^_^}> weird2 = let foo = "outer"; in with { foo = "inner"; }; foo
<infinisil> > :v weird1
<{^_^}> weird1 = (1.0 * 1) * 1
<infinisil> > :v weird3
<{^_^}> weird3 = let { body = "foo"; }
<sphalerite> I think let {…} is just legacy let syntax
<infinisil> I should add the __functor thing to these
<sphalerite> I should go to bed
<infinisil> > ({ __functor = self: args: args + self.foo; } // { foo = 10; }) 20
<{^_^}> 30
<infinisil> > weird5 = ({ __functor = self: args: args + self.foo; } // { foo = 10; }) 20
<{^_^}> weird5 defined
<infinisil> sphalerite: But *are* you going to?
<infinisil> Oh, isn't there some __override business that's equally weird
<infinisil> > (x: rec { __overrides = x; y = z; }) { z = 10; }
<{^_^}> { __overrides = { z = 10; }; y = <CODE>; z = 10; }
<infinisil> > ((x: rec { __overrides = x; y = z; }) { z = 10; }).y
<{^_^}> undefined variable 'z' at (string):193:33
<infinisil> > ((x: rec { __overrides = { z = 10; }; y = z; z = 2; }) { z = 10; }).y
<{^_^}> 10
<infinisil> > ((x: rec { __overrides = x; y = z; z = 2; }) { z = 10; }).y
<{^_^}> 10
<infinisil> > test = { __functor = self: arg: self // rec { __overrides = self; y = z; z = 0; }; }
<{^_^}> test defined
<infinisil> > test
<{^_^}> { __functor = <CODE>; }
<infinisil> > test 1
<{^_^}> { __functor = <LAMBDA>; __overrides = { __functor = <LAMBDA>; }; y = <CODE>; z = <CODE>; }
<infinisil> > (test 1).y
<{^_^}> 0