Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!texsun!texbell!uhnix1!sugar!ficc!cliff From: cliff@ficc.uu.net (cliff click) Newsgroups: comp.lang.misc Subject: Re: Functional and Object Oriented Languages compared Keywords: functional languages object oriented ML smalltalk c++ Message-ID: <4618@ficc.uu.net> Date: 19 Jun 89 21:58:16 GMT References: <11213@orstcs.CS.ORST.EDU> <6192@pdn.paradyne.com> Organization: Ferranti International Controls Lines: 43 In article <6192@pdn.paradyne.com>, alan@oz.nm.paradyne.com (Alan Lovejoy) writes: > 4) If messages were first class values, then one could write code such as > the following: > > | aMessage aPoint | > aMessage <- Message for: (x: 0 y: 0). > aPoint <- Point aMessage. > > The problem with the above is syntactical: how can the compiler tell > that "Point aMessage" means "send the message 'x: 0 y: 0' to Point" > and not "send the message 'aMessage' to Point"? There are only two > solutions to this problem. Smalltalk uses one of them: the syntax for > sending messages whose value is determined statically at compile time > and for sending messages whose value is determined dynamically at run > time is completely different. > So the other (better) solution to the problem is to create OOPLs whose > syntax for sending statically and dynamically determined message values > is identical. In the above example "aMessage" is a temporary variable. The compiler will generate code to send the contents of the "aMessage" temp as a message to "Point". When the interpreter looks up the message in the methods of "Point" perhaps it should recognize that the message being passed is itself a message - in other words do the "perform:with:" inherently in the interpreter, and leave the compiler alone. i n e w s f o d d e r -- Cliff Click, Software Contractor at Large Business: uunet.uu.net!ficc!cliff, cliff@ficc.uu.net, +1 713 274 5368 (w). Disclaimer: lost in the vortices of nilspace... +1 713 568 3460 (h).