unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eduardo Ochs <eduardoochs@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: How to tame compiler?
Date: Sun, 2 May 2021 22:58:07 -0300	[thread overview]
Message-ID: <CADs++6jD3+vApjjMUfpHHRPqR18Dj1WKfVmi4GSyZyTJcjepYQ@mail.gmail.com> (raw)
In-Reply-To: <YI8yW+mvrGgBeHR6@protected.localdomain>

On Sun, 2 May 2021 at 20:32, Jean Louis <bugs@gnu.support> wrote:
>
> * Stefan Monnier <monnier@iro.umontreal.ca> [2021-05-03 01:30]:
> > >> I know I sound like a broken clock, but [...]
> > > I think you would sound more like an unbroken clock if you would shortly
> > > tell the disadvantages of using `eval', then people would be more open
> > > to alternatives.
> >
> > Code always starts in the form of a string somewhere, i.e. data, and
> > somewhere along the lines it gets transformed into something that can be
> > executed, i.e. code.
> >
> > `eval` is one way to do that, but it's a quite restrictive, because it
> > doesn't give any opportunity to do something useful with the data
> > representation of the code before we run it.  I.e. it makes it hard to
> > compile the code to make it more efficient, it makes it virtually
> > impossible to give feedback about problems in the code (except for those
> > problems which lead to "hard errors"), and for the same reason it makes
> > it hard to provide any other kind of help in writing the code (like code
> > completion).
> >
> > In the current context of Emacs, places that use `eval` tend to presume
> > that variables have names and that those names are significant,
> > i.e. they presume dynamic scoping, and for the same reason that it's
> > hard to provide feedback about problems in code that is passed to `eval`
> > it's very hard (both for tools and for humans) to figure out what needs
> > to be done in order for the code to work correctly in the lexical-scoped
> > dialect of ELisp.
> >
> >
> >         Stefan
>
> Thank you. I agree with compiler issues.
>
> In the context of template expansion, would there be some larger
> program and they are in background somewhat larger, those programs or
> functions may and do reside in packages with lexical scoping, rather
> for verification of the code. When certain function runs well, they
> are proven and they may be then embedded into the text. It could be as
> simple as:
>
> ⟦ (sql "SELECT count(1) FROM people") ⟧
>
> or
>
> ⟦ (clisp-macro (princ (format nil "~R" (expt 2 50)))) ⟧
>
> Those are usually smaller snippets that are verified outside of the
> text template beforehand, and previewed before publishing. If anything
> goes wrong, they may evaluate to empty string and continue with
> parsing of the text. Previewer may decide if function works or not,
> basically, if the text is ready to be published or not.
>
> Would there be larger or more complex code, then such can be invoked
> beforehand in form of a report, or file, and its result could be
> included into the page by one of the methods. In general the embedded
> Emacs Lisp will never be used or installed as a package, neither byte
> compiled or otherwise verified for correctness as how we usually do it
> with Emacs Lisp files.
>
> It is one of multiple programming paradigms of Lisp.
>
>
>
> --
> Jean


Hi Jean-Louis,

just as a curiosity, here is how eev implements template
interpolation:

  http://angg.twu.net/eev-current/eev-template0.el.html
  http://angg.twu.net/eev-current/eev-template0.el

I tried several other implementations of template interpolation
functions before that one, and from time to time I would find another
way that would be both simpler and more powerful than the previous
one... the one above is so simple that in one of the times that I gave
a minicourse on LaTeX and Emacs I followed the code of `ee-template0'
with the students in the third day of the minicourse - one day after
teaching them briefly how to understand code with `defun's and `let's.

My trick to handle lexical binding was to tell the students that
dynamic binding is much easier to understand than lexical binding, and
that they should treat dynamic binding as an advanced topic that would
make more sense when they had at least one week of experience with
Emacs - and my minicourse was only five days long, from monday to
friday... but the students in that minicourse were mathematicians with
little experience in programming, not compsci people who would see
immediately that dynamic binding is "wrong".

  Cheers =),
    Eduardo Ochs
    http://angg.twu.net/#eev



  reply	other threads:[~2021-05-03  1:58 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 14:43 How to tame compiler? Jean Louis
2021-04-22 14:46 ` Stefan Monnier
2021-04-22 15:47   ` Jean Louis
2021-04-22 16:06   ` Jean Louis
2021-04-30 13:31   ` Jorge P. de Morais Neto
2021-04-30 19:38     ` rcd-template-eval - was " Jean Louis
2021-04-30 19:48     ` rcd-template-eval, much is in Org mode Jean Louis
2021-04-30 20:06       ` Tassilo Horn
2021-04-30 22:08       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 23:04         ` Org mode rant Jean Louis
2021-05-01  0:46           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01  6:10             ` Jean Louis
2021-05-01  6:34               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01  9:41                 ` On markdown images Jean Louis
2021-05-01  9:59                   ` Yuri Khan
2021-05-01 10:18                     ` Jean Louis
2021-05-01 11:09                       ` Yuri Khan
2021-05-01 11:25                         ` Jean Louis
2021-05-02 19:30                         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-03  5:43                           ` Yuri Khan
2021-05-03 17:08                             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-03 23:22                               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-04  2:39                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01  5:00           ` Org mode rant Bastien
2021-05-01  5:10             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01  9:16             ` Jean Louis
2021-05-01 10:06               ` Bastien
2021-05-01 10:42                 ` Jean Louis
2021-05-01 10:10               ` Bastien
2021-05-01 11:19                 ` Jean Louis
2021-05-01 13:48                 ` [External] : " Drew Adams
2021-05-01 14:05                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01 10:10               ` Bastien
2021-04-30 20:23     ` eval myths - Re: How to tame compiler? Jean Louis
2021-04-30 22:11       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 23:07         ` Jean Louis
2021-05-01  0:28           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01  8:13       ` tomas
2021-04-30 22:06     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 22:20       ` Stefan Monnier
2021-04-30 22:31         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 22:50           ` Stefan Monnier
2021-04-30 22:56             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01  0:44 ` Michael Heerdegen
2021-05-01  3:49   ` Stefan Monnier
2021-05-01  4:55     ` Michael Heerdegen
2021-05-01  6:34     ` Jean Louis
2021-05-01 13:38       ` Stefan Monnier
2021-05-01 16:19         ` Jean Louis
2021-05-02  5:41     ` Michael Heerdegen
2021-05-02  7:37       ` Jean Louis
2021-05-02  7:45       ` Jean Louis
2021-05-02  9:06         ` tomas
2021-05-02 11:18           ` Jean Louis
2021-05-02 12:24             ` tomas
2021-05-02 18:17               ` Jean Louis
2021-05-02 12:06           ` Stages of WWW development compared to Emacs Lisp development Jean Louis
2021-05-02 16:51             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-02 18:37               ` Jean Louis
2021-05-02 16:45       ` How to tame compiler? Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-02 22:29       ` Stefan Monnier
2021-05-02 23:14         ` Jean Louis
2021-05-03  1:58           ` Eduardo Ochs [this message]
2021-05-03  6:51             ` Eval in templates - " Jean Louis
2021-05-01  4:53   ` Michael Heerdegen
2021-05-01  7:05     ` Jean Louis
2021-05-01  7:59       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01  6:03   ` Jean Louis
2021-05-01  6:17     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-02  5:58     ` Michael Heerdegen
2021-05-02  6:54       ` Jean Louis
2021-05-03 21:39       ` 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=CADs++6jD3+vApjjMUfpHHRPqR18Dj1WKfVmi4GSyZyTJcjepYQ@mail.gmail.com \
    --to=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).