emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master 61f8c23 1/2: Minor advice.el fix


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 61f8c23 1/2: Minor advice.el fix
Date: Fri, 23 Dec 2016 20:21:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> Why is then the potential benefit for the value cells worth the added cost,
> i.e. why not also allow (set t 5)?

One reason that comes to mind is the likelihood of having the user write
(setq t 5).  I can't remember how many times the byte-compiler reminded
me that `t` is not a valid local variable name (admittedly, this
happened much less for `nil`, and admittedly² with lexical-binding it
can actually be safe to define a local `t` or `nil`).

So the tradeoffs are different.

>> Are you also going to try and prevent the user from using all
>> the other ways he can shoot himself in the foot?
> To the extent that it's feasible, yes. Emacs Lisp isn't C. If the user
> wants to shoot themselves in the foot, they can write a C module.

Every Turing-complete language makes it easy for the user to shoot
himself in the foot.  The potential damage is different in C than it is
in Elisp, of course.

There is inevitably a trade-off between "trying to protect the user" and
"not preventing the user from getting his work done".  There's no hard
and fast rule on this, in general.  Like most modern languages Elisp
tries to work pretty hard to make it so that the potential damage is
"clean" (not a core-dump) but doesn't go much further than that.

I have "locked myself" out of my Emacs session many times over the
years, but never by redefining car/nil/... so I don't think it's worth
a lot of effort to try and avoid this specific kind of mistake.

This said, my objection is only based on an expectation of the
maintenance and runtime cost, but I haven't thought hard about how it
could be done.  So if you can find a very simple way to do it which is
easy to maintain, cheap, and doesn't restrict the user, then maybe
I wouldn't actually oppose it.  Hint: it's of course better if it can
simplify existing code (e.g. elp-not-profilable).


        Stefan




reply via email to

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