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

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

Re: Did `inline' used to do something else?


From: Joost Kremers
Subject: Re: Did `inline' used to do something else?
Date: Sun, 19 Nov 2017 10:53:55 +0100
User-agent: mu4e 1.0-alpha0; emacs 25.3.50.1


On Sat, Nov 18 2017, Eric Abrahamsen wrote:
The function `inline' is an alias for `progn'.

Gnus is full of code where inline is called with a single argument, ie a no-op, which makes me think `inline' used to do something else? I've tried searching git logs, with no results -- did this function used to
actually inline code?

I looked at the source to see where it is defined and found the following in `byte-run.el':

   ;; Redefined in byte-optimize.el.
;; This is not documented--it's not clear that we should promote it.
   (fset 'inline 'progn)

At first, I couldn't find the referenced file `byte-optimize.el', so I went back in time, but this `fset' call plus comment was already present in what seems to be the first version of `byte-run.el' from 25 years ago. Then I noticed that there is a file called `byte-opt.el' and indeed, this is the file being referred to. It contains the following:

   ;;; byte-compile optimizers to support inlining

   (put 'inline 'byte-optimizer 'byte-optimize-inline-handler)

Followed by a definition of `byte-optimize-inline-handler'. There's no mention of the symbol property `byte-optimizer', and I know next to nothing about byte compilation, but its name is suggestive, of course. (In fact, all `defsubst' does is to define a function and to put this property in the function symbol's plist with the value `byte-compile-inline-expand'.)

So, long story short, even though `inline' is presented as an alias for `progn', it's handled differently by the byte compiler, presumably to deal with performance bottlenecks.

--
Joost Kremers
Life has its moments



reply via email to

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