Xref: utzoo comp.object:514 comp.lang.c++:5690 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!apple!apple.com!chewy From: chewy@apple.com (Paul Snively) Newsgroups: comp.object,comp.lang.c++ Subject: Re: Re^2: Continuations Message-ID: <5473@internal.Apple.COM> Date: 29 Nov 89 00:04:28 GMT Sender: usenet@Apple.COM Organization: Apple Computer, Inc. Lines: 37 References:<2664@bingvaxu.cc.binghamton.edu> <9624@pyr.gatech.EDU> <1623@odin.SGI.COM> <1989Nov28.183816.15252@odi.com> <9964@june.cs.washington.edu> <34657@cornell.UUCP> In article <34657@cornell.UUCP> murthy@alsvid.cs.cornell.edu (Chet Murthy) writes: > >I just had to reply when I saw this. C and C++ are definitely "lexically > >scoped" (I would prefer to call it statically scoped). > > Yes, they are, but they don't provide support for closures as > first-class objects (the funarg problem). So they don't provide > "full" support for lexical scoping. Scheme/ML do. > --chet-- I think this is why Scheme lends itself so readily to the implementation of a wide variety of "object-oriented" models: Scheme makes no a priori distinction between code and data (that is, functions, or closures if you wish to be more precise, can be passed as arguments, returned as values, stored in other data structures, etc. etc. etc.) Of particular interest from an object-oriented standpoint, I think, is the fact that with full upward continuations and closures, you can VERY easily write a function that takes a list of arguments and returns the value of some arbitrary argument, and when you invoke another function (say fail), backtracking is performed to the last decision point, and one of the OTHER arguments' values is returned, etc. until there are no more arguments. This non-deterministic programming system is particularly useful for implementing delegating object systems, and can be implemented trivially in Scheme ("trivially" meaning in about one and a half 8 1/2" x 11" pages printed on a LaserWriter in 10-point Courier). It's also worth noting that this non-deterministic example, using continuations and closures, ships with MacScheme 2.0 or later (in case you've got a Mac and are curious about it). __________________________________________________________________________ Just because I work for Apple Computer, Inc. doesn't mean that they believe what I believe or vice-versa. __________________________________________________________________________ C++ -- The language in which only friends can access your private members. __________________________________________________________________________ Brought to you by Super Global Mega Corp .com