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

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

Re: Additional side-effect-free functions


From: David Kastrup
Subject: Re: Additional side-effect-free functions
Date: 30 Mar 2002 17:58:10 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

jyavner@comcast.net (Jonathan Yavner) writes:

> JY>     truncate
> DK> This can raise a range-error exception.
> 
> There are two classes of side-effect-free functions.
>    (side-effect-free error-free) means function cannot signal.
>    (side-effect-free t) means function makes no assignments
> The distinction matters only if you set byte-compile-delete-errors to
> nil.
> 
> cons has (side-effect-free error-free), even though it increments the
> variable cons-cells-consed.
> 
> car is (side-effect-free t),  so why not truncate?

Sorry, I have not looked too closely into matters before replying.
Unless floating point error state is somewhat persistent in Emacs,
you would appear to be more or less right.

> JY> format-time-string
> DK> This depends on the current time
> 
> So?  It doesn't *change* the time.  If you have code like
>     (prog1 47 (format-time-string "%Y"))
> nothing goes wrong if the compiler just reduces this to 47.

But if you have code like
(format-time-string "%Y")
things go wrong if the compiler reduces this to "2002".

> JY>     make-symbol
> DK> This changes the obarray.
> 
> It shouldn't.  That's intern's job.

Probably.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: David.Kastrup@t-online.de



reply via email to

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