Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!news.gtn.com!osn.de!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!news.be.innet.net!INbe.net!news.nl.innet.net!INnl.net!feed1.news.erols.com!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: [Inform]  Adding exceptions to Inform (long)
Message-ID: <erkyrathDz95r6.HEK@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>
Date: Mon, 14 Oct 1996 06:23:30 GMT
Lines: 55
Sender: erkyrath@netcom6.netcom.com

Marnix Klooster (marnix@worldonline.nl) wrote:
> Here are some thoughts about adding exceptions to Inform.  I don't
> know whether people would find exceptions useful, but I found out that
> they can be added at fairly low cost.  The basic idea for the syntax
> and semantics have shamelessly been stolen from Guido van Rossum's
> Python; check out http://www.python.org.  Let me hear your opinions on
> this.  (And excuse the length, but I thought it best to give some
> detail, and an example.)

[Post deleted; go back and read it]

Neat! I've always thought exceptions were useful. (Not so much because I 
use exceptions a lot, but because I write a lot of code that uses small 
utility procedures and special return values to *fake* exceptions. :-)

Comments: 

I don't know if I see the usefulness of "None", but then I don't know if 
I see the usefulness of "finally", and I can leave both of them out of 
my games if I don't want to use them.

Since Inform is closest in syntax to C / C++, it might be better to use 
the C++ argot of "try, catch, throw" instead of "try, except, raise." 
(Also consistent with Java, for those of you banging your heads against 
the bleeding edge of Internet marketing hype.)

Inform already has a "nothing" and a "NULL", which are different. Sanity 
would be improved if we didn't add a "None" as well. Sanity also slaps me 
hard on the forehead when I suggest that the best word to mean "no 
exceptions" is "Rule." :-) Maybe "NoExcept"?

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.)

Actually, could you just post your implementation details?

I would think it quite reasonable if the compiler said "Error: 'try' or
'raise' statements may only be used in V5 and above." 

Dirty question: Are @CATCH and @THROW well-tested in current interpreters? 
Like, are any game files known to use them? If not, I'll cheerfully bet
that at least one popular interpreter implements them wrong. (In fact,
even if some Infocom game *does* use them, I'll cheerfully bet...)

--Z



-- 

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