home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!rpi!psinntp!psinntp!dg-rtp!sheol!throopw
- From: throopw@sheol.UUCP (Wayne Throop)
- Newsgroups: comp.object
- Subject: Re: objects and closures
- Message-ID: <720937337@sheol.UUCP>
- Date: 05 Nov 92 01:29:17 GMT
- References: <1992Oct27.205320.13271@twg.com> <9210302223.AA11001@cs.columbia.edu> <720756315@sheol.UUCP> <Bx5DFt.7z3@dcs.ed.ac.uk> <BEVAN.92Nov3182229@hippo.cs.man.ac.uk>
- Lines: 40
-
- : From: pdc@dcs.ed.ac.uk (Paul Crowley)
- : Message-ID: <Bx5DFt.7z3@dcs.ed.ac.uk>
- : I think this is an excellent and thought-provoking analogy. Objects
- : are closures you can keep track of in your head. This is why I'm not
- : clear why you'd want ML-style closures and higher-orderness in an
- : object oriented language; it seems contrary to the style of OO
- : programming.
-
- Well, pursue the analogy. While is a control flow construct you can
- keep track of in your head. Why would anybody having a full set of
- sensible control flow constructs want unrestricted goto?
-
- The answer is for some of the things goto does well that nice, clean,
- nested control flow constructes don't. Finite state machines. Error
- exit from inner loops. Algorithms lifted from Knuth. And so on and so
- on. Now, you *could* use some yacc-like tool to describe FSMs, and
- generate efficient code, and you *could* use some structured error
- raising mechanism, and so on and on. But the primitive is *still*
- handy to have around.
-
- Specifically, closures can be used for generalized continuation
- (such as for error recovery), where you'd be pounding a round
- object into a square requirement.
-
- Also, Stephen J Bevan notes another reason why you might want the
- primitive around in the language:
-
- : From: bevan@cs.man.ac.uk (Stephen J Bevan)
- : Message-ID: <BEVAN.92Nov3182229@hippo.cs.man.ac.uk>
- : You could always use a language which has closure(goto) and lets you
- : the _user_ add the syntax necessary to represent object(while) when
- : and if they want it. One example of this would be Scheme using its
- : (hygenic) macro system.
-
- Yep. That way, when you wanted a clean error-raising scheme, you
- could add it for the local case via goto, and even for the general
- case via some throw/catch notion using closures in their guise as
- general continuations.
- --
- Wayne Throop ...!mcnc!dg-rtp!sheol!throopw
-