unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 1ecd350 2/2: Evaluate some unnecessarily quoted lambdas
       [not found] ` <20200621124629.C414420A26@vcs0.savannah.gnu.org>
@ 2020-06-21 16:18   ` Stefan Monnier
  2020-06-21 18:08     ` Basil L. Contovounesios
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2020-06-21 16:18 UTC (permalink / raw)
  To: emacs-devel; +Cc: Basil L. Contovounesios

> -	(lambda-code (byte-compile '(lambda ()))))
> +        (lambda-code (byte-compile (lambda ()))))

I can't believe I'm doing that, but: this hunk is wrong!

`byte-compile` takes source code as input, not values.  It does go to
the trouble of trying to handle the case where we pass it a function
value that's not yet compiled because it's an important use-case in
practice, but it's better to avoid it since the above means that we'll
first turn '(lambda () ()) into a closure object which `byte-compile`
then has to convert back to something like (lambda () ()).


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: master 1ecd350 2/2: Evaluate some unnecessarily quoted lambdas
  2020-06-21 16:18   ` master 1ecd350 2/2: Evaluate some unnecessarily quoted lambdas Stefan Monnier
@ 2020-06-21 18:08     ` Basil L. Contovounesios
  0 siblings, 0 replies; 2+ messages in thread
From: Basil L. Contovounesios @ 2020-06-21 18:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> -	(lambda-code (byte-compile '(lambda ()))))
>> +        (lambda-code (byte-compile (lambda ()))))
>
> I can't believe I'm doing that, but: this hunk is wrong!
>
> `byte-compile` takes source code as input, not values.  It does go to
> the trouble of trying to handle the case where we pass it a function
> value that's not yet compiled because it's an important use-case in
> practice,

(Also it's advertised in its docstring.)

> but it's better to avoid it since the above means that we'll
> first turn '(lambda () ()) into a closure object which `byte-compile`
> then has to convert back to something like (lambda () ()).

Ah okay.  I admit the main reason I thought the hunk was okay is because
(byte-compile (lambda ())) and (byte-compile '(lambda ())) produce the
same byte-code.

Thanks for catching that, now reverted.

Revert last change in benchmark.el
0792f8e4f0 2020-06-21 19:01:40 +0100
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0792f8e4f0de2328c57d552a5845bdf77265a971

-- 
Basil



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-21 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200621124626.3690.70321@vcs0.savannah.gnu.org>
     [not found] ` <20200621124629.C414420A26@vcs0.savannah.gnu.org>
2020-06-21 16:18   ` master 1ecd350 2/2: Evaluate some unnecessarily quoted lambdas Stefan Monnier
2020-06-21 18:08     ` Basil L. Contovounesios

Code repositories for project(s) associated with this public inbox

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

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).