home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / lisp / mcl / 1990 < prev    next >
Encoding:
Internet Message Format  |  1993-01-12  |  1.8 KB

  1. Path: sparky!uunet!olivea!apple!cambridge.apple.com!kab
  2. From: kab (Kim Barrett)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: call-next-method
  5. Message-ID: <9301121329.AA22117@cambridge.apple.com>
  6. Date: 12 Jan 93 13:29:23 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 50
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10.  
  11. > Is it really correct if a compiler warns in the following code
  12. > (defclass test ()
  13. >   ()
  14. >   )
  15. > (defmethod testmethod ((ich test) foo)
  16. >   (print foo))
  17. > (defclass test-1 (test)
  18. >   ())
  19. > (defmethod testmethod ((ich test-1) foo)
  20. >   (call-next-method))
  21. > (testmethod (make-instance 'test-1) 4)
  22. > with 
  23. > ;Compiler warnings :
  24. > ;   Unused lexical variable Foo, in Testmethod.
  25. > since foo is actually used in testmethod ((ich test) foo)
  26. > because of the call-next-method?
  27.  
  28. Yes, this is correct behavior.  The call-next-method does not refer to the 
  29. parameter foo, it (conceptually) gets the value that foo is bound to from some 
  30. other place.  Recall that modifying the value of foo (by setq within the method 
  31. body) does not change the set of values that are passed along by 
  32. (call-next-method).
  33.  
  34. > My problem is that Macintosh Common Lisp 2.0 warns but
  35. > Allegro Cl/PC 1.0 does not and I have to exchange code
  36. > between the two platforms. Even worse, if I change
  37. >  testmethod ((ich test-1) foo) to
  38. > (defmethod testmethod ((ich test-1) foo)
  39. >   (declare (ignore foo))
  40. >   (call-next-method))
  41. > Macintosh Common Lisp 2.0 is satisfied but Allegro Cl/PC 1.0
  42. > complains that foo is actually used and not ignored, so I have to write
  43. > (defmethod testmethod ((ich test-1) foo)
  44. >   #+:ccl-2 (declare (ignore foo))
  45. >   (call-next-method))
  46. > what is quite annoying, since this code is really not platform-dependent
  47.  
  48. I'd call this a bug in Allegro CL/PC 1.0, and would change that #+ccl-2 to be a 
  49. #-<feature for allegro cl/pc 1.0>.
  50.