Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!MITCH.ENG.SUN.COM!wmb From: wmb@MITCH.ENG.SUN.COM Newsgroups: comp.lang.forth Subject: CATCH and THROW Message-ID: <9009220055.AA13759@ucbvax.Berkeley.EDU> Date: 21 Sep 90 20:17:58 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: wmb%MITCH.ENG.SUN.COM@SCFVM.GSFC.NASA.GOV Organization: The Internet Lines: 26 It is my belief that CATCH & THROW were the only possible way of getting exception handling into ANS Forth. The reason: Control structures are a subject of much controversy. They are difficult to precisely specify (proof: the discussions about how to properly describe them spanned many many meetings, and caused much heated debate). In fact, there is pretty much a one-to-one correspondence between non-postfix constructs and hard-to-specify constructs. Any exception handling solution that involves a new form of syntactic control structure was certain to fail, because it would have required the rethinking and the rewriting of so much of the other control structure text. For instance, the interactions between CATCH1 and all other control structures would have to be specified (i.e. you can't use CATCH1 inside a loop), as well as its return stack restrictions, and also there would have to be a decision about whether it is immediate or not and whether or not it is defined for interpret state and what happens when you POSTPONE it. This is the can of worms that one opens when one considers the addition of a new non-postfix control structure to a Forth standard. CATCH and THROW, being "pure postfix", avoids all these problems. Mitch Bradley, wmb@Eng.Sun.COM