# `expr ! err => whatever'

Gustavo Glusman (bmgustav@bioinformatics.weizmann.ac.il)
Wed, 23 Jul 1997 18:05:24 +0300

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    >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
         Gustavo@bioinfo.weizmann.ac.il    (public PGP key available)
         http://bioinfo.weizmann.ac.il/Gustavo
            Visit BioMOO, the biologists' virtual meeting place, at
         ___________ http://bioinfo.weizmann.ac.il/BioMOO ___________