home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / object / 3555 < prev    next >
Encoding:
Internet Message Format  |  1992-09-15  |  4.1 KB

  1. Path: sparky!uunet!mcsun!uknet!gdt!aber!aberfa!pcg
  2. From: pcg@aber.ac.uk (Piercarlo Grandi)
  3. Newsgroups: comp.object
  4. Subject: Re: O.M(...) vs M(...), and is the Real World O-O?
  5. Message-ID: <PCG.92Sep15210546@aberdb.aber.ac.uk>
  6. Date: 15 Sep 92 21:05:46 GMT
  7. References: <45jnpm_.objsys@netcom.com> <KERS.92Sep7094418@cdollin.hpl.hp.com>
  8.     <a8wnd++.objsys@netcom.com> <1992Sep15.100426.20793@jyu.fi>
  9. Sender: news@aber.ac.uk (USENET news service)
  10. Reply-To: pcg@aber.ac.uk (Piercarlo Grandi)
  11. Organization: Prifysgol Cymru, Aberystwyth
  12. Lines: 78
  13. In-Reply-To: sakkinen@jyu.fi's message of 15 Sep 92 10: 04:26 GMT
  14. Nntp-Posting-Host: aberdb
  15.  
  16. (Chris Dollin) writes: ...
  17.  
  18. dollin> Whether the method/function selection is performed at
  19. dollin> compile-time (static typing, e.g. C++, Eiffle) or at run-time
  20. dollin> (dynamic typing, e.g. CLOS, Smalltalk).
  21.  
  22. Taken literally this makes confusion between whether typing is latent or
  23. not, and whether overload resolution is dynamic or not. Usually things
  24. are paired in the same way; for example C++ has got explicit typing and
  25. (by default) static resolution, while Smalltalk has got latent typing
  26. and dynamic resolution, but other combinations are conceivable.
  27.  
  28. So, while it is true that usually explicit typing makes static
  29. resolution easier, and latent typing invites the use of dynamic
  30. resolution, neither connection is not necessary.
  31.  
  32. On the other hand probably you meant over to write 'static resolution'
  33. and 'dynamic resolution' of overloading, and it was just an unfortunate
  34. slip. If so, then I agree with the substance, with some proviso:
  35.  
  36. It's true that in some languages static or dynamic resolution is the
  37. default, but that's really an implementation detail, even if
  38. syntax is needed to explictitly indicate what kind of overload
  39. resolution is desired.
  40.  
  41.   E.g. in smalltalk overload resolution is driven only by the name of the
  42.   method and the mode/class of the first argument, the improperly called
  43.   'receiver'; but if both are known/delcared at compile time, then overload
  44.   resolution can well be done statically, which can be a big win. If I
  45.   remember well Ralph Johnson has done quite a bit of interesting work in
  46.   this area wrt (Typed) Smalltalk.
  47.  
  48. So I don't think it is fundamental to remark that:
  49.  
  50. On 15 Sep 92 10:04:26 GMT, sakkinen@jyu.fi (Markku Sakkinen) said:
  51.  
  52. sakkinen> Method/function selection is certainly performed at run time
  53. sakkinen> in both C++ (although only for virtual functions) and Eiffel.
  54.  
  55. as that really is a nit, at least for C++; and in Eiffel, where
  56. 'virtual' is the (unexpressed) default, the implementation ensures that
  57. explicit type information is used to reolve overloading at compile time
  58. as much as possible, without programmer intervention.
  59.  
  60. What I find more disagreeable is the continued adoption, and certainly
  61. it is not Sakkinen's fault, of confusing terminology:
  62.  
  63. sakkinen> The difference is that Smalltalk and similar languages have
  64. sakkinen> dynamic ad-hoc polymorphism:
  65.  
  66. If you substitute 'dynamic typing' above with 'dynamic dispatching' then
  67. I think you are really saying the same thing as Dollin.
  68.  
  69. sakkinen> any method that just happens to have the same name will gladly
  70. sakkinen> be invoked.
  71.  
  72. What you (sakkinen) probably are saying above is that since Smalltalk
  73. has latent typing, *and* dynamic overload resolution, all its procedures
  74. are potentially polymorphic wrt all the object classes that implement
  75. the protocol given by the union of the interface names it uses. Phew.
  76. :-).
  77.  
  78. But this is really a a property of latent typing, not of dynamic
  79. overload resolution.
  80.  
  81. The regrettable terminology you have used, born almost thirty years ago,
  82. and perpetuated by the likes of the Cardelli/Wegner papers, names two
  83. completely different things in similar ways, "polymorphism" and "ad hoc
  84. polymorphism", as if one were a subset of the other.
  85.  
  86. They are really completly different concepts (one is a property of
  87. procedure implementations, the other of procedure interfaces); calling
  88. them both "polymorphism" causes confusion, between overload resolution
  89. and latent typing.
  90. --
  91. Piercarlo Grandi                   | JNET: pcg@uk.ac.aber
  92. Dept of CS, University of Wales    | UUCP: ...!aber-cs!pcg
  93. Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@aber.ac.uk
  94.