🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #267

Re: Functional and Object Oriented Languages compared

#267
From: Mamdouh Ibrahim
Date: Fri, 23 Jun 1989 15:12
54 lines
3551 bytes
In article <6192@pdn.paradyne.com>, alan@oz.nm.paradyne.com (Alan Lovejoy) writes:
> In article <11213@orstcs.CS.ORST.EDU> budd@mist.CS.ORST.EDU (Tim Budd) writes:
> >So, the topic for debate today is the question whether method selectors,
> >such as ``weight'', which are implemented in several classes, should
> >be considered to be first class objects in their own right.  That is,
> >should we be able to pass ``weight'' as an argument to another function?
> >Should be various ``weight'' functions, although implemented in different
> >classes, be considered to be part of a single entity?
> 
> 1) You have raised an important topic of discussion.
> 2) The fact that messages are not first class objects in Smalltalk and
>    other OOPLs does impair the functionality of those languages.  I have
>    been aware of this problem for many years.
> 
> ...
>
>    Another solution to the problem is to make the syntax for reading and
>    writing state (i.e., instance variables) the same as the syntax for
>    evaluating functions (oh, I guess I mean sending messages :-) :-)).
>    For example, if class RgbColor has the instance variables 'red', 'green'
>    and 'blue,' then the syntax for reading the value of the instance
>    variable 'red' should be "self red" instead of just "red" (the latter
>    being the current syntax).  Similarly, the syntax for setting the value
>    of the instance variable blue should be "self blue: 0.5" instead of
>    "blue <- 0.5" (again, the latter being the current syntax).  Given this
> ...

We have addressed this problem in our own object-oriented language,
KSL.  In KSL we have implemented messages and other language
expressions as first class objects.  For example,
         (red $target 0.0)
is a message with selector "red" sent to the object identified by the
variable "target" with an argument "0.0". The syntax is the same    
regardless of whether "red" invokes a method or accesses an instance
variable. The selector, target, and arguments of the message expression
are actually objects which are evaluated before the message is resolved
so that any of them can be computed.  A similar message could be
         ($color $target $value) 
where each is computed.  Here they are variable references but they
could as well be more complex expressions.

In addition, methods and instance variables (as well as other
behaviors) are implemented as first class objects.  The implementation
of behaviors as objects has allowed us to extend the language with
specialized behaviors that implement rule-base and logic programming.
For more information on KSL and its reflective properties, see:

  Ibrahim, M.H. and Cummins, F.A., "KSL: A Reflective Object-Oriented
  Programming Language," Proceedings of the International Conference on
  Computer Languages, 1988.
-- 
Mamdouh H. Ibrahim - Electronic Data Systems
                     mhi@edsdrd.eds.com
     USENET:     ... {rutgers!rel,uunet}!edsews!edsdrd!mhi
Technical Details
Message-ID: <101@kongo.edsdrd.eds.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!edsews!edsdrd!mhi
References: <11213@orstcs.CS.ORST.EDU> <6192@pdn.paradyne.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!edsews!edsdrd!mhi
From: mhi@edsdrd.eds.com (Mamdouh Ibrahim)
Newsgroups: comp.lang.misc
Subject: Re: Functional and Object Oriented Languages compared
Summary: messages as first class objects
Keywords: functional languages object oriented ML smalltalk c++
Message-ID: <101@kongo.edsdrd.eds.com>
Date: 23 Jun 89 15:12:23 GMT
References: <11213@orstcs.CS.ORST.EDU> <6192@pdn.paradyne.com>
Organization: EDS Research and Development, Auburn Hills, MI  48057
Lines: 54