emacs-devel
[Top][All Lists]
Advanced

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

Re: Opaque objects and Emacs documentation


From: Dmitry Gutov
Subject: Re: Opaque objects and Emacs documentation
Date: Tue, 21 Jul 2020 23:56:41 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 21.07.2020 22:36, Eli Zaretskii wrote:

A predicate would look like:

(defun project-instance-p (pr)
    (condition-case nil
        (progn
          (project-roots pr)
          t)
      (error
       nil)))

I actually thought about cl-defgeneric etc., since obviously each type
of project should have its own implementation.

There's no point. If it implements project-root, it's a project.

But I don't see how it's going to help you write documentation.

It makes the object system more complete.  Suppose some application
would like to check it gets a valid object, before dispatching?

I can imagine some marginal utility in that, but not enough to mandate every backend to implement a project-instance-p method which simply returns t.

    . a function to compare two objects of this type

As discussed, it's a little function called 'equal'.

Again, I envisioned a cl-defgeneric here.  Using 'equal' only works
for simple forms,

Lists, cl-structs, eieio classes, etc, can also be equal.



reply via email to

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