seanjensengrey / mosh-scheme

Automatically exported from code.google.com/p/mosh-scheme
Other
0 stars 0 forks source link

next-method? unbound inside clos methods #216

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
  (import (rnrs)
          (clos user))

  (define-class <animal> ())
  (define-class <person> (<animal>))

  (define-generic my-method)
  (define-method my-method ((self <person>) arg)
    (* (call-next-method) 2))    ; People multiply everything by 2.

  (define-method my-method ((self <animal>) arg)
    (assert (not next-method?))
    arg)                         ; But animals leave things as they are.

  (write (my-method (make <person>) 32))
  (newline)
  (write (my-method (make <animal>) 32))
  (newline)

What is the expected output? What do you see instead?
Expected:
  64
  32
Saw:
   Condition components:
   1. &who             who: next-method?
   2. &message         message: "unbound identifier"
   3. &undefined

If you comment out the reference to 'next-method?', you get the expected output.

What version of the product are you using? On what operating system?
Linux glimworm 2.6.39-2-amd64 #1 SMP Wed Jun 8 11:01:04 UTC 2011 x86_64 
GNU/Linux
Mosh R6RS scheme interpreter, version 0.2.7 (mosh-0.2.7-333-g64fa9ec Tue, 21 
Jun 2011 21:44:51 +0900) 

Please provide any additional information below.
It's not clear exactly how to use 'next-method?' as there's no examples in the 
original port by Christian Sloma, and the code is slightly obscure.  
Particularly, it's not clear if 'next-method?' is a simple identifier (I think 
it is) or a procedure of zero arguments (as in CL).  However the code for the 
feature definitely seems to be present in the Mosh version, but the 
functionality seems to be unusable.

I attach a patch to fix it (very small), plus a test.

Original issue reported on code.google.com by amoe...@gmail.com on 23 Jun 2011 at 11:15

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by hige...@gmail.com on 24 Jun 2011 at 2:23

GoogleCodeExporter commented 9 years ago
https://github.com/higepon/mosh/commit/066638da2e6ce025ca39261482f80b4ee5c71435

Thanks for your patch.

Original comment by hige...@gmail.com on 24 Jun 2011 at 7:44