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

Re: when and without-bounds-checks



On Wed, 19 Apr 2000, Rob Myers wrote:
> Looking throught the DUIM code, two macros pop up that d2c doesn't like:
> 
>     when

I'm surprised this isn't in common-dylan or something (or maybe it is?);
it's just

  define macro when
    { when ( ?:expr ) ?:body end }
   => { if ( ?expr ) ?body end }
  end macro when;

i.e., "an if that can't have an else" or "the opposite of unless".

>     without-bounds-checks
> ...
> What effects does without-bounds-check have? I'm assuming it rebinds
> element() in some way, but what value does an out-of-bounds check
> return?

I don't know whether it works by rebinding element but, AFAIK, it just
does what you'd expect: skips bounds checking in calls to element (and
maybe aref, too?).  Normally, an out-of-bounds element access signals an
error.  I don't know if the results are defined under
without-bounds-checks but I do know (from experience) that it can crash
out-of-language.  This is a "here be dragons" macro, only to be used when
you're sure you won't do any out-of-bounds accesses :-)

HTH,
Hugh




Follow-Ups: References: