unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 61f8c23 1/2: Minor advice.el fix
Date: Fri, 23 Dec 2016 20:21:40 -0500	[thread overview]
Message-ID: <jwv8tr6b0uo.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: CAArVCkRTqSHhK__sfs=e0hPG+snAMEsEBpZMKM33c_XZpop5Ow@mail.gmail.com

> 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	other threads:[~2016-12-24  1:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161212202151.21054.37035@vcs.savannah.gnu.org>
     [not found] ` <20161212202152.428192201BB@vcs.savannah.gnu.org>
2016-12-13 13:40   ` [Emacs-diffs] master 61f8c23 1/2: Minor advice.el fix Stefan Monnier
2016-12-14 16:49     ` Glenn Morris
2016-12-14 18:15       ` Stefan Monnier
2016-12-17 21:11     ` Philipp Stephani
2016-12-17 22:08       ` Stefan Monnier
2016-12-18 19:43         ` Philipp Stephani
2016-12-18 20:15           ` Stefan Monnier
2016-12-23 12:20             ` Philipp Stephani
2016-12-24  1:21               ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv8tr6b0uo.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).