unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Eduardo Ochs <eduardoochs@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: [External] : Supplying DOC string in a `defun' using `defvar'
Date: Thu, 3 Jun 2021 12:19:32 +0300	[thread overview]
Message-ID: <YLiepCIJGOWgti73@protected.localdomain> (raw)
In-Reply-To: <CADs++6iDix7NyPhisgWjrwwDd7SLvjoaK38RqGo96fQ7CjfjFA@mail.gmail.com>

* Eduardo Ochs <eduardoochs@gmail.com> [2021-06-03 10:24]:
> On Thu, 3 Jun 2021 at 03:52, Jean Louis <bugs@gnu.support> wrote:
> >
> > And I have a package as RCD Template Interpolation System for Emacs
> > https://hyperscope.link/3/7/1/3/3/RCD-Template-Interpolation-System-for-Emacs.html
> >
> > that is separate package because I keep it dynamically not lexically,
> > with intention. It is used in business to personalize emails and
> > communication, like yesterday 756 times. There is no lexical bindings
> > involved and currently I don't know how would I implement it with
> > lexical bindings involved. I hope dynamic bindings will never go.
> 
> 
> Me too.
> 
> I use - zillions of times a day - a template function that is
> intrinsically incompatible with lexical binding - this one:
> 
>   http://angg.twu.net/eev-current/eev-template0.el.html
> 
> and I believe that dynamic binding is much easier to understand and to
> explain than lexical binding... also, I interact with beginners a lot,
> and currently what I say to them is: "learn dynamic binding first,
> even though it is being sort of deprecated, and don't try to use
> lexical binding until you have at least one week of experience with
> Emacs Lisp... after that you'll be able to compare the two and lexical
> binding will make much more sense".
> 
> I really hope that people realize the dynamic binding is great as an
> educational tool, and that they will keep it available forever, with
> all the adequate warnings and caveats - "for the sake of the
> secretaries"... see:
> 
>   https://www.gnu.org/software/emacs/emacs-paper.html#SEC29

From same document:
https://www.gnu.org/software/emacs/emacs-paper.html#SEC17

It is not necessary for dynamic scope to be the only scope rule
provided, just useful for it to be available.

(defun foo1 (x) (foo2))
(defun foo2 () (+ x 5))
(foo1 1) ⇒ 6
(foo2)

More information from the same document:

Formal Parameters Cannot Replace Dynamic Scope

Some language designers believe that dynamic binding should be
avoided, and explicit argument passing should be used instead. Imagine
that function A binds the variable FOO, and calls the function B,
which calls the function C, and C uses the value of FOO. Supposedly A
should pass the value as an argument to B, which should pass it as an
argument to C.

This cannot be done in an extensible system, however, because the
author of the system cannot know what all the parameters will
be. Imagine that the functions A and C are part of a user extension,
while B is part of the standard system. The variable FOO does not
exist in the standard system; it is part of the extension. To use
explicit argument passing would require adding a new argument to B,
which means rewriting B and everything that calls B. In the most
common case, B is the editor command dispatcher loop, which is called
from an awful number of places.

What's worse, C must also be passed an additional argument. B doesn't
refer to C by name (C did not exist when B was written). It probably
finds a pointer to C in the command dispatch table. This means that
the same call which sometimes calls C might equally well call any
editor command definition. So all the editing commands must be
rewritten to accept and ignore the additional argument. By now, none
of the original system is left!

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/



  reply	other threads:[~2021-06-03  9:19 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 23:00 Supplying DOC string in a `defun' using `defvar' ludvig-faddeev
2021-05-31 23:11 ` 2QdxY4RzWzUUiLuE
2021-05-31 23:13 ` Jean Louis
2021-05-31 23:32   ` ludvig-faddeev
2021-05-31 23:43     ` Jean Louis
2021-06-01  0:14   ` 2QdxY4RzWzUUiLuE
2021-06-01  0:23     ` Jean Louis
2021-06-01  0:35       ` Jean Louis
2021-06-01  0:40       ` Michael Heerdegen
2021-06-01  1:00         ` ludvig-faddeev
2021-06-01  1:07         ` Jean Louis
2021-06-01  1:28           ` Michael Heerdegen
2021-06-01  1:33             ` Jean Louis
2021-06-01 13:39               ` Michael Heerdegen
2021-06-01 16:31                 ` Jean Louis
2021-06-01 22:44                   ` Michael Heerdegen
2021-06-01  3:26   ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-01  5:19     ` Christopher Dimech
2021-06-01 14:31       ` Michael Heerdegen
2021-06-01 14:41         ` Christopher Dimech
2021-06-01 15:01           ` [External] : " Drew Adams
2021-06-01 15:05             ` Christopher Dimech
2021-06-01 15:38               ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-01 18:20                 ` Christopher Dimech
2021-06-01 18:25                   ` Eli Zaretskii
2021-06-01 18:33                     ` Christopher Dimech
2021-06-02  2:53                   ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-02 22:46                   ` Michael Heerdegen
2021-06-02 22:56                     ` Christopher Dimech
2021-06-03  6:52                       ` Jean Louis
2021-06-03  7:23                         ` Eduardo Ochs
2021-06-03  9:19                           ` Jean Louis [this message]
2021-06-03 14:17                             ` Eduardo Ochs
2021-06-02 15:59                 ` FW: " Drew Adams
2021-06-02 16:19                   ` Christopher Dimech
2021-06-02 17:24                     ` Drew Adams
2021-06-02 18:14                       ` Christopher Dimech
2021-06-01 22:39               ` Michael Heerdegen
2021-06-01 22:43                 ` Christopher Dimech
2021-06-02  2:55                   ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-02  4:55                     ` Christopher Dimech
2021-06-02  5:06                       ` Jean Louis
2021-06-02 13:09                       ` Stefan Monnier
2021-06-02 13:35                         ` Christopher Dimech
2021-06-02 14:43                           ` Christopher Dimech
2021-06-02 15:08                           ` Stefan Monnier
2021-06-02 16:14                             ` Christopher Dimech
2021-06-02 15:53                         ` Drew Adams
2021-06-02 18:35                           ` Stefan Monnier
2021-06-02 18:59                             ` Jean Louis
2021-06-02 19:55                               ` Drew Adams
2021-06-02 19:58                             ` Drew Adams
2021-06-02 21:26                               ` Stefan Monnier
2021-06-02 22:24                                 ` Drew Adams
2021-06-02 22:39                                   ` Stefan Monnier
2021-06-02 22:52                                     ` Christopher Dimech
2021-06-02 23:11                                       ` Stefan Monnier
2021-06-03 10:57                                         ` Christopher Dimech
2021-06-03 13:43                                         ` Christopher Dimech
2021-06-03 15:10                                           ` Stefan Monnier
2021-06-03 15:34                                             ` Christopher Dimech
2021-06-03 15:46                                               ` Stefan Monnier
2021-06-03 16:18                                                 ` Christopher Dimech
2021-06-03  6:29                                     ` Jean Louis
2021-06-03  6:22                                 ` Eli Zaretskii
2021-06-03  6:59                                   ` Lars Ingebrigtsen
2021-06-01 15:46             ` Drew Adams
2021-06-01 16:34         ` Jean Louis
2021-06-01 18:51       ` Nick Dokos
2021-06-01 19:02         ` Christopher Dimech
2021-06-01 22:15           ` Robert Thorpe
2021-06-01 23:08             ` Christopher Dimech
2021-05-31 23:20 ` [External] : " Drew Adams
2021-05-31 23:31   ` Michael Heerdegen
2021-05-31 23:46     ` ludvig-faddeev
2021-06-01  0:29       ` Michael Heerdegen
2021-06-01  0:35         ` ludvig-faddeev
2021-06-01  1:08           ` Michael Heerdegen
2021-06-01  1:49             ` ludvig-faddeev
2021-06-01 14:26               ` Michael Heerdegen
2021-06-01 21:50                 ` ludvig-faddeev
2021-06-01 22:22                   ` Michael Heerdegen
2021-05-31 23:40   ` Jean Louis

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=YLiepCIJGOWgti73@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=eduardoochs@gmail.com \
    --cc=help-gnu-emacs@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.
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).