Subject: Re: bug#66706: [PATCH] Automatic elisp dialect insertion

From: Stefan Monnier <[email-masked]>
Date: Tue, 24 Oct 2023 22:01:25 -0400

> I want this off by default.  We teach users to enable lexical binding in
> the Lisp introduction and a myriad of other places; inserting lexical
> binding cookies is not "the icing on the cake", but a gesture that
> implies we should override the judgement of our users, and are willing
> to browbeat them into abiding by such notions of ours.

The lexbind dialect is the dialect we recommend:

    Lately Emacs is moving towards using lexical binding in more and
    more places, with the goal of eventually making lexical binding the
    default.  In particular, all Emacs Lisp source files and the
    @file{*scratch*} buffer use lexical scoping.

So why should a new file default to using the dynbind dialect instead?

> Similar measures taken by other software bespeaks the existence of a
> sense of superiority in their developers; doubtless,

We simply can't satisfy everyone: either we impose the dynbind
dialect by default (the current situation) or we impose the lexbind
dialect by default.  In both cases you can look at it as something
imposed out of a sense of superiority, but I don't think that is
a useful way to look at it.

> they think it beyond their users to read several pages of
> documentation pertaining to lexical binding, and to make from that an
> informed decision.

Those users who read all the docs can easily turn that option off if
they so wish.  We shouldn't decide on what's a good defaults based
on them.

> We never insert text to enforce our conceptions of good practice in any
> major mode.  Such is the first step down a very precipitous slope, which
> culminates in the adoption of the haughty attitude that other software
> has seized upon with particular zeal.

Just to be clear: the long term goal is to eliminate the dynbind
dialect, or at least make it be an opt-in that requires taking extra
steps, such as adding a cookie to the file, whereas the lexbind dialect
should be the default.  Not because dynbind is evil.  Not because it
imposes an undue burden on the implementation.
But because having two dialects imposes an undue burden on our users.
Those who read all the docs may not care, but all the others are
vulnerable to the usual "I copied the code from that webpage and it
doesn't work" because the code on that webpage used the other dialect.

So the question is how to move from here to there in the least
painful way and I believe that inserting this cookie by default is a step
that will make this transition less painful.

        Stefan