[Nix-dev] Attribute selection with default

Eelco Dolstra e.dolstra at tudelft.nl
Thu Sep 24 14:04:33 CEST 2009


Michael Raskin wrote:
> Eelco Dolstra wrote:
>>   config.python.db4Support or true
> 
> You could de-nerf tryEval and have
> "lib.fallback config.python.db4Support true"

Yes, that's the Stratego approach (writing "e1 <+ e2", where <+ catches failure
in e1).  The problem is that it catches much more than just missing attributes -
any failure in the evaluation of "config" is caught, so it's a non-localised
construct.

> "config.python.db4Support or true"
> looks like the first step in the journey of a thousand miles towards
> Perl. Which seems to be a bad thing..

Well, given that this would be only the fourth minor syntax addition in about
two years (after a.b.c syntax in attribute sets, ellipses in function arguments,
and @-patterns - and one feature removal), Perl is quite far off ;-)

Also, tryEval (i.e. exception handling) is potentially a much more radical
addition to the language (especially since it doesn't really fit in a purely
functional language).

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list