[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Additional side-effect-free functions
From: |
Jonathan Yavner |
Subject: |
Re: Additional side-effect-free functions |
Date: |
Sat, 30 Mar 2002 16:50:42 GMT |
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?
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.
JY> make-symbol
DK> This changes the obarray.
It shouldn't. That's intern's job.