emacs-devel
[Top][All Lists]
Advanced

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

Re: Towards a cleaner build: eieio


From: Stefan Monnier
Subject: Re: Towards a cleaner build: eieio
Date: Fri, 14 Jun 2019 09:52:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>>> (cl-defmethod cl-print-object ((object eieio-default-superclass) stream)
>>>   "Default printer for EIEIO objects."
>>>   ;; Fallback to the old `object-print'.
>>>   (princ (object-print object) stream))
>>
>> This is backward compatibility for those packages that define an
>> `object-print` method on their own eieio classes (instead of a method
>> on cl-print-object).
>
> Yes, but what I wandered was about the call to `object-print'.  It seems
> like the definition of object-print here is kinda trivial:
>
> (cl-defmethod object-print ((this eieio-default-superclass) &rest strings)
>
> [...]
>
>   (eieio-object-name this (apply #'concat strings)))

This is just the default definition.  Packages can add their own methods
to it.

> So couldn't cl-print-object just say
>
>   (eieio-object-name object)
>
> instead of
>
>   (object-print object)

That wouldn't obey the methods added to object-print.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]