noonien has quit [Quit: Connection closed for inactivity]
ddellacosta has joined #nix-lang
<Taneb>
I'd like to do something like "let x = 1; in let x = x + 1; in x" and get 2. Is there a clean way to do this? (override a variable from an outer scope with a value dependent on the outer scope's value)
<infinisil>
Taneb: I can't think of any clean way
<Taneb>
I ended up changing the name of the variable in the outer scope, which in this case is better
<infinisil>
Yeah that's what I'd do too
<infinisil>
Also probably less confusing
ddellacosta has quit [Ping timeout: 268 seconds]
ddellacosta has joined #nix-lang
<srhb>
> let x = 1; in { x = 1 + 1; }.x
<{^_^}>
2
<srhb>
But please don't...
<srhb>
:-P
<srhb>
Woops
<srhb>
x + 1 of course..
<pie_>
ooh
<pie_>
Taneb: yeah not having a nonrecursive let can be annoying
<srhb>
Well, attrsets are basically just as good..
<Taneb>
> let x = 1; in with {x = x + 1;}; x
<{^_^}>
1
<Taneb>
That feels wrong to me
<infinisil>
"with" has different semantics
<infinisil>
Yeah it's a bit weird..
<pie_>
> let x = 1; in let inherit ({x = x + 1;}); in x
<{^_^}>
1
<pie_>
i wonder what happens if
<pie_>
> let x = 1; let inherit ({x = x + 1;}); in x
<{^_^}>
error: syntax error, unexpected LET, at (string):255:12
<pie_>
derp
<pie_>
> let x = 1; inherit ({x = x + 1;}); in x
<{^_^}>
1
<pie_>
still derp
<pie_>
> let x = 1; inherit ({x = x + 1;}) x; in x
<{^_^}>
error: attribute 'x' at (string):255:34 already defined at (string):255:5