Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.rwth-aachen.de!uni-paderborn.de!golden-gate.owl.de!fu-berlin.de!informatik.tu-muenchen.de!Germany.EU.net!main.Germany.EU.net!EU.net!newsfeed.internetmci.com!cpk-news-hub1.bbnplanet.com!www.nntp.primenet.com!nntp.primenet.com!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: [Inform]  Adding exceptions to Inform (long)
Message-ID: <erkyrathDzA9Hs.A72@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <53sk77$neh@mars.worldonline.nl> <erkyrathDz95r6.HEK@netcom.com> <53tujq$hr5@wanda.vf.pond.com>
Date: Mon, 14 Oct 1996 20:41:51 GMT
Lines: 44
Sender: erkyrath@netcom.netcom.com

Matthew T. Russotto (russotto@wanda.vf.pond.com) wrote:
> In article <erkyrathDz95r6.HEK@netcom.com>,
> Andrew Plotkin <erkyrath@netcom.com> wrote:

> }In your V5 @CATCH/@THROW implementation, is there any overhead for a 
> }program that doesn't use exceptions? (I.e., old code.) What about a 
> }function that doesn't use exceptions in a program that does? If there's 
> }no cost in these cases, I can't think of any reason not to add the stuff 
> }to Inform. (Aside from the effort involved, of course.)
>
> Without VM support (which the Z-machine doesn't have), overhead
> for a function in any program which uses exceptions seems inevitable.
> All divisions, for instance, would have to be checked.

Well, most functions don't include division. And maybe we don't want 
Z-machine division to throw an exception. (That would be a modification 
to the Z-machine, right? Which is different from adding exception to 
Inform.) If you want that effect in Inform-plus-exceptions, you'd write a 
"divide" function like:
[ division a b;
  if (b == 0)
    throw DivideZero;
  return a / b;
];

The question is, does this have any overhead for a function which *calls* 
divide but does not try to catch the exception? I would guess "no", but 
this is why I want to see the implementation.

> }Dirty question: Are @CATCH and @THROW well-tested in current interpreters? 
> }Like, are any game files known to use them?

> No V1-V5 game file uses them.  Some V6 game files do.  ZIP 2.0 is
> broken and will fail with a fatal error if you use them. 

Hm. Problematic. We'll see where Marnix's proposal for CATCH/THROW 
implementation goes.

--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
