[Nix-dev] Re: lazy evaluation and 'with'

Lluís Batlle viriketo at gmail.com
Fri Jan 15 12:01:33 CET 2010


2010/1/15 Lluís Batlle <viriketo at gmail.com>:
> Hello,
>
> let
>  a = { x = 1; c = 2;};
> in
> with a;
> if a ? b then b else "b not found"
>
> This ends up in:
> error: undefined variable `b'
>
> I thought it would evaluate to "b not found".
>
> If I use:
> if a ? a.b then b else "b not found"
Here I meant:
if a ? b then a.b else "b not found"
>
> all works.
>
> I'm curious about this behaviour. Can any expert explain a bit about it?
>
> Regards,
> Lluís.
>



More information about the nix-dev mailing list