emacs-devel
[Top][All Lists]
Advanced

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

RE: interactive-p and called-interactively-p


From: Drew Adams
Subject: RE: interactive-p and called-interactively-p
Date: Sun, 16 Aug 2009 08:51:24 -0700

> >> It would have been far better to just add an optional argument to
> >> `interactive-p' than to create a new, similarly named function.
> >
> > Agreed.  Any objection?
> 
> Since called-interactively-p has been around since Emacs 22, and the
> benefit in cleanliness is rather minute,

Cleanliness?

This is about helping users (of Emacs Lisp). The existence of these two
functions, with different names that nevertheless mean the same thing (even
though the functions don't mean the same thing), just confuses their use.

Which in turn makes their use error-prone. Which complicates code and
maintenance. Which leads to further confusion about what these are for and how
to use them...

Look at the doc for this stuff - it's a mess. Think how simple the doc will be
when there is only one function with an optional arg: we'll just explain what
the arg does - QED. Compare that with the current doc (take a look, including
both doc strings and the explanations in the manual) - it's nearly
incomprehensible (and incorrect).

> I don't think it's worth the hassle.

What hassle? Just defalias `called-interactively-p' to the equivalent call of
`interactive-p' that uses the new argument appropriately. And mark it as
deprecated.

This kind of thing is nothing new. A simple mistake such as this can, and
should, be rectified. Sooner is better than later. Now is late, but later is
even later.

But fixing it *never*, simply because it was introduced in Emacs 22, is
definitely NOT TRT. By that philosophy, we should never fix any bugs that are
older than the current release. This is simply a silly design bug -
`called-interactively-p' should never have seen the light of day; and it should
be put to rest now.

> We can't just remove called-interactively-p because 
> that would break backward compatibility,

Huh? Deprecating a function is not some new invention. Defalias it now, and let
users know it is deprecated and that in the future they should use
`interactive-p' with the new arg instead. Nothing new or revolutionary about
this.

> which means adding another argument to
> interactive-p just means more non-useful complexity (how many people
> would benefit from this anyway?).

No, it was adding function `called-interactively-p' that added non-useful
complexity. This, on the contrary, is an operation in reducing complexity - for
users. Every user of the function (with the new signature) will benefit. The
code and understanding of it will be clearer.





reply via email to

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