Opened 5 months ago

Last modified 5 months ago

#485 new defect

Differing &keyword generic method signatures cannot be eval'd

Reported by: Mark Evenson Owned by:
Priority: major Milestone: 1.8.1
Component: interpreter Version: 1.8.1-dev
Keywords: Cc:
Parent Tickets:



emaczen Is there a setting I can change in ABCL to not care if a method definition does not have all the keyword arguments as another method?
emaczen does not accept all of the keyword arguments defined for the generic function -- This is the ABCL error I am getting
emaczen SBCL and CCL do not care
charles` Is that only for keyword arguments, because SBCL definitely cares if I have different # of parameters for same method name
robertm Maybe you could use &allow-other-keys ?  (Just a guess.)
etimmons emaczen: Based on your description and some quick tests I'm guessing you're implicitly defining the generic function with defmethod. Try using an explicit defgeneric.
etimmons It does appear there's a bug in how defmethod defines the lambda list of the implicit defgeneric
etimmons If (fboundp function-name) is nil, a generic function is created [...] the lambda list of the generic function will mention ..... key (but no keyword arguments)

Eval'ing non-congruent forms fails with a simple-error but compiling seems to work.

Change History (3)

comment:1 Changed 5 months ago by Mark Evenson

jackdaniel schooled easye on #abcl:

l easye: the congruency between the gf and the method is defined (among other rules), that method must have all key arguments from the generic function
jackdaniel it may have more though
jackdaniel when you implicitly define the generic function via defmethod, and defmethod has &key arguments, the generic function is defined as (defgeneric foo (a &key)) [i.e for (defmethod foo ((a integer) &key z d))
jackdaniel so they are in fact congruent
easye Alright.  That's right:  one doesn't typically use keyword arguments with generic functions for this reason.

comment:2 Changed 5 months ago by Mark Evenson

Summary: Non-congruent generic method signatures cannot be eval'dDiffering &keyword generic method signatures cannot be eval'd

comment:3 Changed 5 months ago by Mark Evenson

The following forms will compile as a file unit, but fail when evaluated in a REPL.

(in-package :cl-user)

(defmethod test ((a integer) &key b c)
  (declare (ignore a b c)))

(defmethod test ((a real) &key b)
  (declare (ignore (a b))))
Note: See TracTickets for help on using tickets.