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: Eli Zaretskii
Subject: Re: Opaque objects and Emacs documentation
Date: Tue, 21 Jul 2020 22:36:30 +0300

> Cc: npostavs@gmail.com, emacs-devel@gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Tue, 21 Jul 2020 22:00:15 +0300
> 
> On 19.07.2020 17:48, Eli Zaretskii wrote:
> >    . a predicate to test whether an arbitrary Lisp value is an object
> >      of that type
> 
> 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.

> 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?

> >    . 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, but if we are willing to limit ourselves to such
simple forms, why do we need generics at all?



reply via email to

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