home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / object / 2997 < prev    next >
Encoding:
Internet Message Format  |  1992-07-24  |  1.6 KB

  1. Path: sparky!uunet!ogicse!orstcs!fog.CS.ORST.EDU!budd
  2. From: budd@fog.CS.ORST.EDU (Tim Budd)
  3. Newsgroups: comp.object
  4. Subject: O.M() vs M(0) notation
  5. Message-ID: <1992Jul24.173655.5869@CS.ORST.EDU>
  6. Date: 24 Jul 92 17:36:55 GMT
  7. Article-I.D.: CS.1992Jul24.173655.5869
  8. Sender: usenet@CS.ORST.EDU
  9. Organization: Oregon State University, Computer Science Dept.
  10. Lines: 23
  11. Nntp-Posting-Host: fog.cs.orst.edu
  12.  
  13. I agree that the O.M(...) notation clearly marks the receiver as special,
  14. and seems more natural to most folks.
  15.  
  16. In our multiparadigm language LEDA (which has nothing to do with the C++
  17. classes of the same name distributed by somebody in Germany), we wanted
  18. to combine features of object oriented programming and functional
  19. programming.  Part of this is the desire to permit methods to be
  20. used as functions - that is, passed as arguments to higher level functions,
  21. and so on.  Our solution was to permit easy (implicit) convertion between
  22. the ``method'' type and the ``function'' type - when a qualified method
  23. name is used in a context where a function is required (say, as an
  24. argument), it is magically converted into a function, including adding
  25. an argument to the front of the argument list.  Thereafter it is
  26. invoked using the functional M(O) notation.
  27.  
  28. For the sake of symmetry we also allowed the reverse.  If you defined
  29. a function that used an object as the first argument, you could invoke
  30. it using the O.M() notation -- if the complier could not find a method
  31. of a given name it would then look for an appropriate function.  This has
  32. not provem to be quite as useful, and I am not sure it will remain in the
  33. language.
  34.  
  35. --tim budd, oregon state university
  36.