emacs-devel
[Top][All Lists]
Advanced

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

Re: "simplifications"


From: David Kastrup
Subject: Re: "simplifications"
Date: Mon, 19 Nov 2007 16:19:10 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> is not my idea of fun, or legible, or maintainable, or... you pick the
>> word. Not that c??r is much of an improvement; we should be able to
>> define accesor functions in the package
>
>>  (defsubst ring--vec (ring)
>>     (cdr (cdr ring)))
>
>> and have the byte-compiler optimize them away.
>
> 1 - if you use defsubst* the byte-code will look good.
> 2 - you can use defstruct to get all that and more.
> 3 - I don't think it's worth the trouble to make the byte-optimizer more
>     complex for such little benefit.  If you want to improve it, use the
>     lexbind branch: it's a much saner starting point.
>
>
>         Stefan "whose local Emacs hacks include some byte-optimizer
>                 improvement which does manage to optimize `cadr' but it's too
>                 much work works with too many limitations and on top of
>                 that, it's not even clear that the optimization is
>                 always correct: it doesn't account for the case where
>                 you do
>                 (defsubst cadr (debug-on-error) (car (cdr debug-on-error)))
>                 in which case the optimization is not semantics preserving"

defsubst is an advanced construct.  I think it is reasonable to give
fewer guarantees about its operation than we do for defun.

-- 
David Kastrup




reply via email to

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