home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / scheme / 2045 < prev    next >
Encoding:
Internet Message Format  |  1992-08-18  |  3.7 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!agate!anarres.CS.Berkeley.EDU!bh
  2. From: bh@anarres.CS.Berkeley.EDU (Brian Harvey)
  3. Newsgroups: comp.lang.scheme
  4. Subject: Re: message passing vs. generic functions
  5. Date: 18 Aug 1992 15:29:39 GMT
  6. Organization: University of California at Berkeley
  7. Lines: 67
  8. Message-ID: <16r513INN4k2@agate.berkeley.edu>
  9. References: <9208171954.AA05736@cambridge.apple.com> <16pul6INNjfq@early-bird.think.com>
  10. NNTP-Posting-Host: anarres.cs.berkeley.edu
  11.  
  12. [There is some nice polite helpful commentary on the next screenful;
  13. don't hit "N" yet...]
  14.  
  15. ===begin flame===
  16.  
  17. barmar@think.com (Barry Margolin) writes:
  18. >This is true.  However, in my experience, automatic delegation like this is
  19. >a dangerous practice, and perhaps it shouldn't be facilitated.
  20.                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  21.  
  22. On the basis of this statement, I move that the CLOS object system be
  23. added to Pascal, and that a non-prescriptive object system be used in
  24. Scheme, which is supposed to be a language for non-anal-fixated people.
  25.  
  26. ===end flame===
  27.  
  28. Earlier on, I suggested that object dispatch went along with the metaphor
  29. of smart objects better than generic functions, and someone replied along
  30. the lines of "you can still think of the objects as smart if you want."
  31. (Then someone else, not responding to my point, described the two
  32. approaches as "function-centered" and "object-centered" without objection!)
  33.  
  34. My point, which I think got lost, is that the metaphor that a programming
  35. language actually embodies is NOT irrelevant and NOT trivial.  Yes, you can
  36. think of any mechanism as if it were any other mechanism, once you are
  37. experienced enough to understand all the deep issues, but when you are
  38. learning something, like for example OOP, it makes a *huge* difference
  39. what metaphor is presented *by the language itself*.
  40.  
  41. What I am saying is that *even if we only had functions of one argument*
  42. [think about adding OOP to pure lambda calculus if that helps :-) ] there
  43. would be an important pedagogic difference between
  44.  
  45.     (FN OBJ)
  46.  
  47. and
  48.  
  49.     (ASK OBJ FN)
  50.  
  51. even though there would be no significant implementation difference and
  52. either syntax can be written in terms of the other.  There would be no
  53. difference to an experienced OOP programmer, but there would be a big
  54. difference to someone who is just learning how to think about this new
  55. paradigm.  That's what I mean about paying special attention to
  56. educational concerns.
  57.  
  58. As for functions of more than one argument, I am really not satisfied
  59. with any approach that I know about -- I think the language design
  60. people have more work to do.  I mean, it does feel weird to me to
  61. interpret "3-2" as "ask 3 to subtract 2 from itself" as Smalltalk does,
  62. but with generic functions, I don't want to have to write int-int,
  63. int-float, float-int, float-float, float-rational, etc etc etc.  Maybe
  64. it'd be okay if I wrote int-int, float-float, rational-rational, etc.
  65. and there were some smoothly integrated general raising mechanism.
  66. Does that exist?  If so, I might argue for having BOTH object dispatch
  67. (for OOP) and generic functions (for things like arithmetic) in the
  68. language.  They feel very different to me, even if you can prove that
  69. they're somehow equivalent.
  70.  
  71. Here's a test case for your rasising mechanism.  I want to implement
  72. Logo-style words in Scheme.  That means that I want an abstract data type
  73. that encompasses symbols, characters, strings, and numbers.  This in turn
  74. means that it should be legal to do arithmetic on strings, provided that the
  75. string turns out to be full of digits and decimal points and so on.
  76.  
  77. So, I need a raising mechanism that will let me raise "3" to 3,
  78. "3/4" to 3/4, "3.14" to 3.14, and so on.
  79.