all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: inline function expansion
Date: Fri, 12 May 2023 08:25:43 +0200	[thread overview]
Message-ID: <87o7mqxdzs.fsf@dataswamp.org> (raw)
In-Reply-To: CAM=F=bAsVyhMN2JEaqsExBb9_G4c52ABoXqX5m+-_WtrBDHnYQ@mail.gmail.com

Lynn Winebarger wrote:

> I was working off of the description in "Evolution of Emacs
> Lisp", page 45, which gives the example of cl-type-p for
> evaluation of constant expressions at compile-time via
> inline functions (figure 2)

I still don't know what constant expressions are, is it Elisp
pieces of source that all evaluate to something based only on
entities that themselves don't change, so the whole thing can
be optimized, i.e. replaced by this value so computation won't
be done over and over?

How do you check is something is a constant expression or not?

> The info documentation does not include any examples
> involving inline-const-p, and in fact, I cannot find any
> code in the emacs lisp directory, or in the source of
> a couple of thousand packages, that makes use of
> inline-const-p or inline-const-val *other* than this
> exact function.

Sounds like you found something interesting ...

> I'd like to define inline- variants of pure subrs, e.g.
> arithmetic operators, type-predicates, that evaluate during
> macroexpansion rather than involving the compiler's
> optimization phase.

But what does it matter when it happens, as long as it is done
when it is supposed to be used?

Compiling is a modular process with different stages. (It
would be interesting BTW to see a list of these stages, along
with the technical terms what is happening at each stage.
For example, you have used the word "dispatch" several times,
which I also haven't come across in the Elisp world
until now.)

> I think it will be easier to ensure compile-time generic
> methods (e.g. a macro that simply calls a generic method)
> will (or at least can) dispatch during macro-expansion,
> without involving the byte-compiler's optimization phase.

Okay now I see, you want to switch order, or duplicate the
optimization so it happens before as well, in your case so you
can have inline functions even at macro-expansion time?

But what will be the advantage of that compared to doing
it after? Unless you want to optimize and inline the
macro-expansion process as well ...

-- 
underground experts united
https://dataswamp.org/~incal




  reply	other threads:[~2023-05-12  6:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-07 14:32 inline function expansion Lynn Winebarger
2023-05-07 17:51 ` Basile Starynkevitch
2023-05-07 19:48 ` Philip Kaludercic
2023-05-07 20:16   ` Lynn Winebarger
2023-05-08  0:21     ` Emanuel Berg
2023-05-08 11:12       ` Lynn Winebarger
2023-05-08  2:03   ` Lynn Winebarger
2023-05-11  7:11   ` Lynn Winebarger
2023-05-12  6:25     ` Emanuel Berg [this message]
2023-05-18 14:56     ` Lynn Winebarger
2023-05-19 13:31       ` Stefan Monnier
2023-05-20 14:18         ` Lynn Winebarger
2023-05-20 15:32           ` Stefan Monnier
2023-05-21 12:47             ` Lynn Winebarger
2023-05-18 18:29     ` Stefan Monnier
2023-05-19  0:22       ` Lynn Winebarger
2023-05-19 13:07         ` Stefan Monnier
2023-05-20 15:01           ` Lynn Winebarger
2023-05-20 15:48             ` Stefan Monnier
2023-05-27 14:34               ` Lynn Winebarger
2023-05-28 14:12                 ` Lynn Winebarger
2023-05-28 14:57                 ` Stefan Monnier
2023-05-28 22:42                   ` Lynn Winebarger
2023-05-29  2:59                     ` Stefan Monnier
2023-06-06 22:38                       ` Lynn Winebarger

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

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

  git send-email \
    --in-reply-to=87o7mqxdzs.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.