guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with methods dispatching bug


From: Marco Maggi
Subject: help with methods dispatching bug
Date: Tue, 4 Dec 2007 07:35:44 +0100

Ciao,

with GOOPS I am adding methods to FOR-EACH; with:

(define-method (for-each (proc <applicable>)
                         (L <list>)
                         (S <stream>) . args)
  (apply stream-for-each proc L S args))

I  see a strange  bug: STREAM-FOR-EACH  is my  C implemented
procedure and it completes successfully, but before FOR-EACH
returns it looks like  another FOR-EACH (I guess the Guile's
built in) is invoked with the same arguments.

My understanding of the prolem is:

1. the generic FOR-EACH function is invoked;
2. the generic FOR-EACH  function selects the correct method
   for the arguments: my implementation;
3. my method is invoked and it completes successfully;
4. before  the   generic  FOR-EACH  returns   something  bad
   happens.

The problem does not show when I test:

(define-method (for-each (proc <applicable>)
                         (S <stream>) . args)
  (apply stream-for-each proc S args))

The problem disappears if I prepend:

(define saved-for-each for-each)
(define-generic for-each)
(define-method (for-each (proc <applicable>) . args)
  (apply saved-for-each proc args))

that is: if I make  FOR-EACH a generic function, rather than
relying on the primitive generic functionality.

This is  probably caused by  a mess in  my C code, but  I am
failing to  find the problem.  Can someone point  me towards
the code in Guile that  does method invocation? It should be
somewhere in the evaluator...

TIA

--
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"






reply via email to

[Prev in Thread] Current Thread [Next in Thread]