From: Rainer Joswig
Subject: ENSURE-GENERIC-FUNCTION and method combinations?
Date: 
Message-ID: <joswig-1010981719240001@194.163.195.67>
(ensure-generic-function 'baz :method-combination '(standard))

Should this syntax work? ANSI CL speaks of an
method combination *object*.  

If not: how do I get the method combination object?

(define-method-combination foo ...)

(ensure-generic-function 'bar
   :method-combination ... ; here I want foo
   )

-- 
http://www.lavielle.com/~joswig

From: Howard R. Stearns
Subject: Re: ENSURE-GENERIC-FUNCTION and method combinations?
Date: 
Message-ID: <36238974.98349265@elwood.com>
Rainer Joswig wrote:
> 
> (ensure-generic-function 'baz :method-combination '(standard))
> 
> Should this syntax work? ANSI CL speaks of an
> method combination *object*.
> 
> If not: how do I get the method combination object?
> 
> (define-method-combination foo ...)
> 
> (ensure-generic-function 'bar
>    :method-combination ... ; here I want foo
>    )
> 
> --
> http://www.lavielle.com/~joswig

ANSI says:

  The :METHOD-COMBINATION option of DEFGENERIC is used to specify that
  a generic function should use a particular method combination
  type. The first argument to the :METHOD-COMBINATION option is the
  name of a method combination type and the remaining arguments are
  options for that type.

Thus, for one can write:

(defgeneric baz (...)
  (:method-combination standard))

(defgeneric bar (...)
  (:method-combination foo))

Alas, the MOP explictly does not define either how the
:METHOD-COMBINATION option to DEFGENERIC is canonicalized or how the
:METHOD-COMBINATION initarg for generic-function is
interpreted/canonicalized.

My view is that a reasonable implementation of DEFGENERIC would be to
gather the :METHOD-COMBINATION name and options in a list and use this
as the value of the :METHOD-COMBINATION initarg.  Then let
ENSURE-GENERIC-FUNCTION sort it out.  You should be able to
macroexpand DEFGENERIC in your implementation to see if this is so.

If defgeneric does work this way, then ENSURE-GENERIC-FUNCTION must
accept either a method-combination object (if the implementation
follows the MOP) or a list of method-combiantion name and options.
(It might also be nice if a symbol (i.e., a name with no options) is
also recognized, but that's up to the implementation.)

The MOP also defines FIND-METHOD-COMBINATION, but it requires both a
generic-function metaobject as well as a method-combination-type-name
and list of method-combination-options as arguments.  My interpretation
is that the generic-function argument can be a prototype or any other
gf laying around that has the right metaclass. The gf is used ONLY as
a hook so that users can define their own way to convert 
name/option combinations to real method-combination objects by
defining a specialized method on some user-defined generic-function
class.  Of course, others might disagree with this interpretation.
From: Rainer Joswig
Subject: Re: ENSURE-GENERIC-FUNCTION and method combinations?
Date: 
Message-ID: <joswig-1310982312530001@194.163.195.67>
In article <·················@elwood.com>, "Howard R. Stearns"
<······@elwood.com> wrote:

> Rainer Joswig wrote:
> > 
> > (ensure-generic-function 'baz :method-combination '(standard))
> > 
> > Should this syntax work? ANSI CL speaks of an
> > method combination *object*.
> > 
> > If not: how do I get the method combination object?
> > 
> > (define-method-combination foo ...)
> > 
> > (ensure-generic-function 'bar
> >    :method-combination ... ; here I want foo

>   The :METHOD-COMBINATION option of DEFGENERIC

DEFGENERIC is clear to me. But what about "ensure-generic-function".
It is defined in ANSI CL, but nowhere it says how to create
and get method combination objects.

> ENSURE-GENERIC-FUNCTION sort it out.  You should be able to
> macroexpand DEFGENERIC in your implementation to see if this is so.

MCL doesn't give me a clue.

> If defgeneric does work this way, then ENSURE-GENERIC-FUNCTION must
> accept either a method-combination object (if the implementation
> follows the MOP) or a list of method-combiantion name and options.
> (It might also be nice if a symbol (i.e., a name with no options) is
> also recognized, but that's up to the implementation.)
> 
> The MOP also defines FIND-METHOD-COMBINATION, but it requires both a
> generic-function metaobject as well as a method-combination-type-name
> and list of method-combination-options as arguments.  My interpretation
> is that the generic-function argument can be a prototype or any other
> gf laying around that has the right metaclass. The gf is used ONLY as
> a hook so that users can define their own way to convert 
> name/option combinations to real method-combination objects by
> defining a specialized method on some user-defined generic-function
> class.  Of course, others might disagree with this interpretation.

Hmm, still I don't understand why there isn't a FIND-METHOD-COMBINATION
(maybe also accepting nil as the argument for the generic function).
I want to feed ENDURE-GENERIC-FUNCTION the right arguments,
but how do I get these (the method combination metaobject)
in ANSI CL? If you look at the HyperSpec you see that the
explanation for the method-combination option has no
link into the glossary. Seems like this is left for future work...

-- 
http://www.lavielle.com/~joswig
From: Barry Margolin
Subject: Re: ENSURE-GENERIC-FUNCTION and method combinations?
Date: 
Message-ID: <RIPU1.32$KK.1438024@burlma1-snr1.gtei.net>
In article <·······················@194.163.195.67>,
Rainer Joswig <······@lavielle.com> wrote:
>DEFGENERIC is clear to me. But what about "ensure-generic-function".
>It is defined in ANSI CL, but nowhere it says how to create
>and get method combination objects.

You need to use the MOP for that.  ANSI CL assumes the existence of a MOP,
but leaves its definition for the future.  This function probably should
never have been left in as part of the standard, since it's much more like
MOP than regular CLOS, and I think we simply screwed up.  But as long as
you don't use the MOP-related options, it's reasonable to use it in
standard code.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
From: Tim Bradshaw
Subject: Re: ENSURE-GENERIC-FUNCTION and method combinations?
Date: 
Message-ID: <ey33e8rmpvh.fsf@todday.aiai.ed.ac.uk>
* Rainer Joswig wrote:

> DEFGENERIC is clear to me. But what about "ensure-generic-function".
> It is defined in ANSI CL, but nowhere it says how to create
> and get method combination objects.

> Hmm, still I don't understand why there isn't a FIND-METHOD-COMBINATION
> (maybe also accepting nil as the argument for the generic function).
> I want to feed ENDURE-GENERIC-FUNCTION the right arguments,
> but how do I get these (the method combination metaobject)
> in ANSI CL? If you look at the HyperSpec you see that the
> explanation for the method-combination option has no
> link into the glossary. Seems like this is left for future work...

I think this is one of the places where the boundary between the bits
of CLOS that made it in and those that didn't is really inconsistent.
I frequently find myself getting annoyed that there isn't a complete
functional layer that underlies the macro layer (my particular
annoyance being the absence of ENSURE-CLASS, so you can't
programatically mix classes portably).  

This needs to be sorted out I think: perhaps someone should go through
things and work out what needs to be put in, without putting the whole
of AMOP in, which i suspect is unimplementable efficiently (especially
things like difficulty of SLOT-VALUE optimisation if you believe
AMOP).

--tim