[Nix-dev] Re: [Nix-commits] SVN commit: nix - 20980 - eelco - nix/branches/fast-eval/src/libexpr

Nicolas Pierron nicolas.b.pierron at gmail.com
Thu Apr 8 15:09:46 CEST 2010


On Thu, Apr 8, 2010 at 13:25, Eelco Dolstra <e.dolstra at tudelft.nl> wrote:
> Log:
> * Fix blackholing.  If evaluation fails due to an assertion failure,
>  then the blackhole has to be removed to ensure that repeated
>  evaluation of the same value gives an assertion failure again rather
>  than an "infinite recursion" error.

Why would you evaluate it again?  You want to cache the failure too.

> Changes:
>
> Modified: nix/branches/fast-eval/src/libexpr/eval.cc
> ===================================================================
> --- nix/branches/fast-eval/src/libexpr/eval.cc  2010-04-08 09:19:10 UTC (rev 20979)
> +++ nix/branches/fast-eval/src/libexpr/eval.cc  2010-04-08 11:25:14 UTC (rev 20980)
> @@ -681,8 +681,14 @@
>  void EvalState::forceValue(Value & v)
>  {
>     if (v.type == tThunk) {
> -        //v.type = tBlackhole;
> -        eval(*v.thunk.env, v.thunk.expr, v);
> +        ValueType saved = v.type;
> +        try {
> +            v.type = tBlackhole;
> +            eval(*v.thunk.env, v.thunk.expr, v);
> +        } catch (Error & e) {
> +            v.type = saved;
> +            throw;
> +        }
>     }
>     else if (v.type == tCopy) {
>         forceValue(*v.val);
>
> _______________________________________________
> nix-commits mailing list
> nix-commits at cs.uu.nl
> http://mail.cs.uu.nl/mailman/listinfo/nix-commits
>



-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/



More information about the nix-dev mailing list