help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inline function expansion


From: Emanuel Berg
Subject: Re: inline function expansion
Date: Fri, 12 May 2023 08:25:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]