home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!apple!voder!woodstock!news
- From: dyer@eagle.sharebase.com (Scot Dyer)
- Newsgroups: comp.lang.scheme
- Subject: Re: wots going on here!?
- Message-ID: <1992Sep8.162208.13486@sharebase.com>
- Date: 8 Sep 92 16:22:08 GMT
- References: <1187.9208311520@subnode.aiai.ed.ac.uk> <17timvINN7b8@agate.berkeley.edu> <1992Sep5.075445.26848@greco-prog.fr>
- Reply-To: dyer@eagle.sharebase.com (Scot Dyer)
- Organization: NCR/ShareBase Corporation
- Lines: 46
- Nntp-Posting-Host: eagle
-
- %[...]bh@anarres.CS.Berkeley.EDU (Brian
- %Harvey) writes:
- %|> P.S. Yes of course if an error happens inside a procedure you should be
- %|> told its name. My example was too simple, I guess. What Logo does on
- %|> an error is tell you the error, the procedure in which it happened, and
- %|> the line of the procedure definition that contains the error.
- %
- %The problem in Scheme, as I use it, is that it is not a very interesting
- %information as I use a lot of continuation passing style and what I
- %call "next function passing style" (as expanders in EPS) so I have a
- %lot of anonymous functions, and a lot closure coming from the same
- %lambda expression.
-
- This is a situation where treating errors as _values_ (like everything else
- in scheme) would be terribly useful. As errors cascaded as the result of
- feeding unanticipated error values into functions, a complete backtrace would
- be generated.
-
- I like this idea because it is consistant with the rest of scheme. Rather than
- inventing a whole new set of functions to handle special flow of control on
- exceptions and giving ourselves some big headache by insisting on non-local
- control constructs, I like schemes lexical style. I'd never go back to old
- dynamically scoped lisp.
-
- And it can be implemented just as easily with anonymous functions... The key
- is to imbed the error message in the error value, along with other 'irritants'
- (including error values that might have caused this...), ergo:
-
- (if (car '()) 1 0)
- --> #{ERROR: |if condition must be defined. it was:|
- #{ERROR: |car can't be taken from| #!null}}
-
- Just provide (error->list), (list->error), (error?), and the utility 'error'
- such that: (define error (lambda l (list->error l)))
-
- -- Scot
- +------------------------+-----------------------------------------------+
- |Scot Dyer_Rivenburgh | "Land of song," said the warrior bard, |
- |dyer@eagle.sharebase.com| "Though all the world betrays thee, |
- +------------------------+ One sword, at least, thy rights shall guard, |
- |(He's right, you know.) | One faithful harp shall praise thee." |
- +------------------------+-----------------------------------------------+
-
- P.S. Perhaps calling errors 'undefined' values would be less threatening to
- students and no more irritating to seasoned schemers than the errors
- themselves?
-