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

:accessor-prefix and :reader-prefix same?



    Date: Wed, 15 Apr 87 19:20 PDT
    From: Gregor.pa@Xerox.COM

    What happens if you do:

    (defclass foo ()
	(a)
      (:accessor-prefix foo-)
      (:reader-prefix foo-))

I believe this should do exactly the same thing as

    (defclass foo ()
	((a :accessor foo-a :reader foo-a)))

87-002 doesn't say what this does, but it seems reasonable to make
it an error.  The following is an error too

    (defclass foo ()
	((a :accessor foo-a)
	 (b :accessor foo-a)))

The rule would be that a single defclass form isn't allowed to define
two functions with the same name if they do different things.

This is an interesting example

    (defclass foo ()
	((x :accessor foo-x))
      (:accessor-prefix foo-))

which defines the same function twice.  I'm inclined to say that this
is not an error, but I won't argue much if someone feels it is better
to make it an error.

In the above, reading "signals an error" for "is an error" is fine with
me.  Only toy implementations would not signal such errors in my opinion.
The only question is whether an error or a warning is preferable.  In
Flavors, all things like these are warnings (i.e. compilation continues).