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

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

bug#13052: 24.3.50; mention recent change of `kbd' to a function in NEWS


From: Drew Adams
Subject: bug#13052: 24.3.50; mention recent change of `kbd' to a function in NEWS
Date: Sat, 1 Dec 2012 18:18:04 -0800

> It's not related to pure storage, but to whether the function is
> "pure" (without side effecs). If the function is pure and the
> arguments satisfy `macroexp-const-p' it is possible to do some
> optimization during byte-compilation. See lisp/emacs-lisp/byte-opt.el,
> around line 560 or so.

Thanks.  So I guess that means that if I have a similar (e.g., identical, for
discussion) function and I put property `pure' on it then I will get the same
optimization?

I was thinking this had something to do with pure storage, so it would do no
good to add that property to code I write.

Is the only requirement that the function have no side effects and each of its
arguments satisfies `macroexp-const-p'?

What happens if someone erroneously adds that property to a function that is not
pure but whose args all satisfy `macroexp-const-p'?  Do you just lose the
optimization or could something much worse happen?

Looking at the byte-opt.el code briefly, it looks like the byte code would be
incorrect.  It looks as if adding non-nil property `pure' is a pretty strong
declaration to the compiler, not just a hint, and it could have bad results if
applied in the wrong place.  Am I reading that right?

In any case, this property should be documented.






reply via email to

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