From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: Re: How to tame compiler? Date: Sun, 2 May 2021 22:58:07 -0300 Message-ID: References: <875z03th9b.fsf@web.de> <87v981wv3f.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24271"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 03 03:59:04 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ldNrU-00069j-5A for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 03 May 2021 03:59:04 +0200 Original-Received: from localhost ([::1]:56288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldNrT-0007AR-7r for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 21:59:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldNqq-0007AL-KC for help-gnu-emacs@gnu.org; Sun, 02 May 2021 21:58:24 -0400 Original-Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:35498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldNqo-0003St-IK for help-gnu-emacs@gnu.org; Sun, 02 May 2021 21:58:24 -0400 Original-Received: by mail-pl1-x633.google.com with SMTP id t21so2009594plo.2 for ; Sun, 02 May 2021 18:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=qaz3+xtS/lLzpr4ac5rcMkDuHz5iwHWyMQXIVfb8z84=; b=RRc87AXq4YzLE5VWqgvUOt3JsZ2V1m2nYzyZEFMPxjxYbPkrkvW+jDs0IuMeDz/cIX HN7xd+4DAu9pJTLA2vAwq558llcOSef0g/TYjp/+J1QH8TwPY1icuJO4fUQ2KLcv15X/ YI878fSlFxeh4MR1VSH82rAEORXxJ01zo4QRZIVhMbgytdlfKSrlg//UAB4CA/UpxKK5 3wy2nG0nnTik9n+YwsYZCwxPbBf90QTeI8wHNNOToVpNxR8nMLOhbnp/Du6mqwR+mr91 drMIlN3whuFVO/U73Szh2nDkIltuoYzrPLH55K9lIc8E6csujMcA8hK5hFGsBsTK2e+Q 8bAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=qaz3+xtS/lLzpr4ac5rcMkDuHz5iwHWyMQXIVfb8z84=; b=dfr/wJjr5ClfGgyXz21h2+tx69zklWmPDxsAaIWXkT6aaViZGyiVpT3JyuY95vnxaz z+V9vvgVR9Rn+sc/fGQszooaoj72jN0BVl6jx8Nr35RiALgwMx6b2bHbywvdgyHPGyJP oFIhkP5OMSdM2j1AIK57f6oEtBTx96kJK/g+4XWv6psXXMvJTwJUxcqIWAu/HIsZ3ivN CNYIUhFQUk8Bzaqwbs+4nNmxUUDdVFB/eLxSEt69wFb5wpMmgZ1fd9SyHPeUj7/bx9bj 67bau3r24n3mEpSvbUdOmevgG7tksAgHGisJqWhIX39O9GoyKxSjHK1QUdom/Y8uoJUl HzTg== X-Gm-Message-State: AOAM5319HdYlTd1Pd7XaxSOpMfcZCWupBkBDXx21IPaYBnvpj0/CWbOK RGmy6JQmsX5NNojz5eUXKzxTml2YonStQUAegz/J+LX5Aqo= X-Google-Smtp-Source: ABdhPJx57zR54F4GSc3TrHnn428bp1uKmUaKLFsjM8szxC9gAqC8DlRaCu2WB706cirkFc7HDTfnTtcximulYsssKqs= X-Received: by 2002:a17:90a:a613:: with SMTP id c19mr28579945pjq.117.1620007099467; Sun, 02 May 2021 18:58:19 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=eduardoochs@gmail.com; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129363 Archived-At: On Sun, 2 May 2021 at 20:32, Jean Louis wrote: > > * Stefan Monnier [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 shor= tly > > > tell the disadvantages of using `eval', then people would be more ope= n > > > 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 b= e > > 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 thos= e > > 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 cod= e > > 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-scope= d > > 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: > > =E2=9F=A6 (sql "SELECT count(1) FROM people") =E2=9F=A7 > > or > > =E2=9F=A6 (clisp-macro (princ (format nil "~R" (expt 2 50)))) =E2=9F=A7 > > 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 =3D), Eduardo Ochs http://angg.twu.net/#eev