[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Aug 23 08:22:12 1993 
Subject:Re: assert 
From:Steve Knight 
Volume-ID:930823.01 

Continuing the "assert" thread, I am inclined to agree with Roger Evan's
who wrote:
> One drawback of [John William's] alternative is that it doesn't 
> look `optional' the
> way jonathan's was (ok his didn't LOOK optional either, but at least it
> was brand new syntax). I'd be keen for that feature to be clearer
> somehow. In the past I've thought of extending the #_ convention to
> indicate bits that somehow aren't really part of the code proper (eg a
> switchable #_FAST instead of lib slowprocs[1]). 

The key point is that such "asides" aren't part of the code proper,
as Roger puts it, in the sense that they aren't necessarily present
at run-time.  However, #_MISHAP_IF would be rather poor choice of
name, since the emphasis is placed on the error condition rather than
the correctness condition (and the point is that the error condition
never occurs).  Furthermore, there is no reason to imagine that
this construct would mishap in the ordinary sense.  Firstly, it has
to trap mishaps raised within the context of the assertion and secondly
it should raise a ``high-powered'' mishap that avoids everything
except the most strenuous exception handling.  (To pursue this line of
thought further gets into the unresolved area of exceptions in Pop11.)

A more obvious name would be #_ASSERT.  I imagine a syntax rather like
    #_ASSERT <condition> 
e.g.
    #_ASSERT x.hd;
which checks (1) x is a non-empty list (2) the first element is not false.

Steve