[Ecls-list] ContextL functions with &key args don't work properly in ECL.

Pascal Costanza pc at p-cos.net
Sun Feb 28 20:40:28 UTC 2010


On 25 Feb 2010, at 16:03, Juan Jose Garcia-Ripoll wrote:

> On Thu, Feb 25, 2010 at 3:42 PM, Pascal Costanza <pc at p-cos.net> wrote:
> 
> So in other words I should prefer ext:lambda-block over just lambda?
> 
> Maybe, or maybe not. I do not know how you get the functions to have a name in other platforms. If you have a better solution that I could implement in ECL, I would like to know it.


I have looked further into this issue. The closures associated with methods should actually not have names (or their names should not be used for debugging). What should be printed is the name of the generic function they are contained in. The reason is that methods may be freely moved from one generic function to the next. Consider the following example:

> (defmethod foo (a b) (/ (+ a b) 0))

#<STANDARD-METHOD FOO (#<The BUILT-IN-CLASS T> #<The BUILT-IN-CLASS T>)>
> (foo 3 4)

#<a DIVISION-BY-ZERO>

Available restarts:

1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at FOO. In: #<process SI:TOP-LEVEL 00000001005c0f60>.
>> :r1

> (defgeneric bar (x y))

#<STANDARD-GENERIC-FUNCTION BAR>
> (let ((method (first (clos:generic-function-methods #'foo))))
    (remove-method #'foo method)
    (add-method #'bar method))

#<STANDARD-GENERIC-FUNCTION BAR>
> (bar 3 4)

#<a DIVISION-BY-ZERO>

Available restarts:

1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at FOO. In: #<process SI:TOP-LEVEL 00000001005c0f60>.
>> :backtrace

Backtrace:
  > FOO
  > si:bytecodes [Evaluation of: (bar 3 4)]
  > si:bytecodes [Evaluation of: (si:top-level)]

You see FOO printed here, although BAR was actually called.

So I prefer not to change Closer to MOP in this regard.



Pascal

-- 
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100228/c9cc8ac8/attachment.html>


More information about the ecl-devel mailing list