[Top][All Lists]

[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: Fri, 17 Jul 2020 16:42:55 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 17.07.2020 14:14, Eli Zaretskii wrote:
Cc: emacs-devel@gnu.org
From: Dmitry Gutov <dgutov@yandex.ru>
Date: Fri, 17 Jul 2020 13:53:35 +0300

It shouldn't come as a surprise that I think there is no better
technological choice. Otherwise I would have used it.

??? You are saying that the _only_ way to design project.el is to use
generics at that high level?  Just because sometimes a "project
instance" is a cons cell and sometimes some other Lisp structure?  I'm
surprised to hear that.

This logic is backwards. The generics are here because we make good use of them.

The use of cons cells or some other structures, is a choice, basically arbitrary, that can change at will. That is another reason why I don't like to see the low-level description in the docstring of project-current.

What should help is coming up with a better, consistent way to document
these things.

I tried to find one, but couldn't.  If someone wants to propose a way,
I'm all ears.  I wrote those comments which started this thread
because it surprised me how difficult it was to try to keep the
limitations you impose on what should and what shouldn't be divulged,
and yet produce useful documentation of what the various public
functions do.  In all my 40 years of experience with Emacs, I have
never bumped into such a brick wall, with no way around it.

I'm saying it's nothing new: completion tables, for instance, have been quite as abstract.

But for some reason you are fine with docstrings that say "ARG is a completion table", or "returns a completion table"?

Later it became apparent that you are doing this on purpose, because
you have decided that certain directions of developing the package
should be made as hard as possible,

That is an unfair misstatement of my words.

something that I think is
completely against the spirit of Emacs development.  Readers of this
thread are invited to read


especially under "Here are things we want third-party code to be able
to do" and "Here are, on the other hand, things that people generally
shouldn't do".  Again, I'm interested to know how many of us here
share those views.

Those are not examples of "developing the package". Those are examples of using it. Some of them - incorrectly.

Which I think is against long-time Emacs tradition for documenting its
interfaces, and by that facilitating extensibility.  It is IMO wrong
to fill Emacs application levels with opaque objects which cannot be
usefully described; they should be a rare exception, but definitely
not the rule.

The problem here is that even if you document a particular value, it's
_not useful_. It doesn't show you what you can or should do with it.

It was very useful for me, and so I presume it could be useful for

It has been useful to you to find an answer to a minor question: "how projects are compared, which projects are equal?". Which is not something most people will even think about.

And even answering that question for the project-vc case doesn't give you a general answer. I don't see how you are content with only having that answer for a special case anyway.

Even if you think it is not useful for you, the fact that
fellow developers tell you the contrary should be a reason to revisit
your views, and maybe allow for other views as well, even if you

Perhaps if someone else said "I wanted to do a (valid thing X), couldn't understand how to do it, and this piece of information would have made it easier"?

No such declarations so far.

Documentation should strive to serve different ways of studying and
developing Emacs, not just a single way that you personally think is
The (only) Right Thing.

I already said you can add code comments. Preferably somewhere which is not the main entry point of the API.

I also talked about the possibility to have this documented in the manual, etc (in a chapter targeted at developers).

You have skipped and dismissed it all, and now make contrived accusations.

The main thing thing the user can do with that value is misuse it, by
relying on its shape in the client code.

Once again: concealing information because someone could be silly
enough to misuse it punishes many valid uses on behalf of a few
invalid ones.

Which valid uses, though?

We should treat our users as responsible adults, even
if some of them aren't.  Those who aren't will eventually be amply
punished, or will recognize their mistakes and get their act together.

Our users are not all "responsible adults", or to put it differently, are not all professional programmers. Even even those who are, are at very different levels of skill.

And even when writing documentation for professional programmers, it is always considered a good taste to structure it so that it encourages writing good code, and discourages writing bad one.

reply via email to

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