GNU bug report logs -
#42147
28.0.50; pure vs side-effect-free, missing optimizations?
Previous Next
Reported by: Andrea Corallo <andrea_corallo <at> yahoo.it>
Date: Tue, 30 Jun 2020 22:28:02 UTC
Severity: normal
Found in version 28.0.50
Done: Mattias EngdegÄrd <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hello Andrea,
> In my version I assumed (after a look to the manual) to have strings to
> be immutable only at speed 3. Is it safe to assume this always instead?
Ultimately it depends on the transformations you do, but yes: this patch substitutes let-bound names for their values, and since the behaviour of mutating string literals is undefined, it's safe. Consider:
(let ((s "abc"))
(f s)
s)
It doesn't matter what 'f' does; since it isn't permitted to mutate its argument string, the transformation to
(progn (f "abc") "abc")
is safe (assuming lexical binding, since f could otherwise set s to something else).
> Also I wanted ask why symbols are not included but only keywords, is
> this to respect the side effect of interning them or something else?
Symbols are included, but since this is (normalised) Lisp source, plain symbols are variables; constants of symbol type are represented as (quote SYM), matched by the and-expression. Keywords are just symbols whose name begin with a colon, like :chocolate, and need no quoting.
This bug report was last modified 4 years and 282 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.