Comment 2 for bug 1835306

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote : Re: [Bug 1835306] [NEW] sb-pcl::constructor-function-form calls optimizing-generator even though there are custom methods

A couple of things...

Christophe <email address hidden> writes:

> First of all, I am not sure the linked example is a conforming program,
> because I think make-instance is supposed to return an instance of the
> class, and not an arbitrary value (the glossary entry for direct-
> instance in the HyperSpec even says that "The function make-instance
> always returns a direct instance of the class which is (or is named by)
> its first argument.", but this is just an example and examples are not
> part of the standard AFAIK).

Glossary entries are, generally, normative.

> That being said, there could be conforming program where the return
> value is an instance but where the around method is not called.

You mean, the around method doesn't call the next method?

The MOP has some details about what user programs are allowed to do.
Specifically,

  Portable programs may define methods that extend specified methods
  unless the description of the specified method explicitly prohibits
  this. Unless there is a specific statement to the contrary, these
  extending methods must return whatever value was returned by the call
  to call-next-method.

which specifically prohibits not using the return value of the base
method.

Further,

  Any method defined by a portable program on a specified generic
  function must have at least one specializer that is neither a
  specified class nor an eql specializer whose associated value is an
  instance of a specified class.

would, in at least one reading, prohibit the use of both (eql 'bar) and
(eql (find-class 'foo)) as a specializer for make-instance (because
both #<STANDARD-CLASS FOO> and BAR are direct instances of a specified
class). In a way, this is reasonable: if you want special stuff to
happen for MAKE-INSTANCE, you should define a metaclass.