MOO-cows Mailing List Archive

[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: `expr ! err => whatever'

>What would the chances be of sometime in the future of getting a patch (or
>getting it integrated into the main tree) so that the
>`expr ! ERR => value' stuff would take any value in place of the error?
>So you could do something like
>x = `#obj:verb() ! E_PERM, E_VERBNF, 0 => 1'; or such

The error-catching expression does just that - catches raised errors. This
is different from looking at the returned value.
If it were modified, then, to catch errors *and* filter returned values,
how would you distinguish between the expression having raised an error, or
having returned an error value?

>It seems to me that it would be very useful to add the functionality if it
>would be at little cost.

In your particular example, it's simple enough to use:
  x = `#obj:verb() ! E_PERM, E_VERBNF => 1' || 1;

For logically true returned values that you want to filter, why not just
use an if?

To summarise, no functionality would be added - just a shorthand for
existing functionality. And some functionality would be lost -
distinguishing between raised errors and returned error values.

     Gustavo Glusman              Founder/administrator of BioMOO    (public PGP key available)
        Visit BioMOO, the biologists' virtual meeting place, at
     ___________ ___________

Follow-Ups: References:
Home | Subject Index | Thread Index