home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / arch / 10547 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  2.5 KB

  1. Xref: sparky comp.arch:10547 comp.lang.misc:3551
  2. Newsgroups: comp.arch,comp.lang.misc
  3. Path: sparky!uunet!pipex!ibmpcug!exnet!dhd
  4. From: dhd@exnet.co.uk (Damon)
  5. Subject: Re: CLU break and continue (Was: Re: A challenge to the anti-goto)
  6. Message-ID: <BxGID2.8n9@exnet.co.uk>
  7. Organization: ExNet Systems Ltd Public Access News, London, UK
  8. References: <721054332.26680@minster.york.ac.uk> <1992Nov9.114323.22688@rdg.dec.com> <BRADLEY.92Nov9101822@marley.think.com>
  9. Date: Mon, 9 Nov 1992 16:12:37 GMT
  10. Lines: 39
  11.  
  12. In article <BRADLEY.92Nov9101822@marley.think.com> bradley@marley.think.com (Bradley Kuszmaul) writes:
  13. >In article <1992Nov9.114323.22688@rdg.dec.com> jch@rdg.dec.com (John Haxby) writes:
  14. >
  15. >   ...
  16. >   It's not surprising that the Ada exception mechanism is similar to CLU's
  17. >   since CLU is one of Ada's ancestors.
  18. >
  19. >   CLU has two exception mechanisms for slightly different purposes.  One
  20. >   mechanism is for returning an exception from a procedure call: a procedure
  21. >   can signal an exception to be caught by its caller (the exception is not
  22. >   propagated up the procedure call stack) or by a generic handler for
  23. >   unhandled exceptions.  The other mechanism is a local form that allows a
  24. >   block (eg in a loop or if-statement) to exit to an enclosing block.
  25. >   Apart from the local/procedure-call difference the two mechanisms are
  26. >   identical, although `signal' tends to be expensive and `exit' is simply
  27. >   an unconditional branch. ...
  28. >
  29. >The signal is not as expensive as you might think.  This is because the
  30. >exception is not propagated up the call stack.  I remember descriptions of
  31. >two implementations of signal, both of which had the property that
  32. > - if the signal is not raised, there is zero runtime cost (e.g., to set up the
  33. >   signal handler.
  34. > - if the signal is raised, only a few instructions need to execute to
  35. >   figure out where the signal handler is and to jump to it.
  36. > - if the appropriate handler is not defined, it only takes a few more
  37. >   instructions to figure out where the `failure' handler is and to jump to
  38. >   it.
  39.  
  40. I think the New Jersey implementation of ML also only takes a few
  41. instructions to get to an exception handler from the raising of the
  42. exception.  I'm no expert on how NJML is implemented, so maybe someone
  43. out there could explain how ML does it...
  44.  
  45. Damon
  46. -- 
  47. Damon Hart-Davis                          Internet: dhd@exnet.co.uk, d@hd.org
  48.  
  49. PUBLIC ACCESS UNIX (Suns), NEWS AND MAIL FOR UK#5 PER MONTH.  FIRST MONTH FREE.
  50. [1.34] Cheap Sun eqpt.  UUCP news/mail feeds.  Tel/Fax: +44 81 755 0077.
  51.