On Tue, Sep 12, 2017 at 10:20:24AM +0200, LemonBoy wrote:
> Hello hackers,
> after debugging some code I noticed the compiler was smashing the type for 
> some
> list I had defined via `define-constant`. That's not needed since the 
> constants
> aren't exported nor they are modifiable so here's a patch to make the
> scrutinizer aware of that.

I think this patch is too dangerous.  The reason is that the compiler does
absolutely nothing to prevent mutation of "constants":

$ cat test.scm
(define-constant foo '(a b c))
(set-car! foo 1)
(print foo)

(set-cdr! foo 2)
(print foo)

$ csc -O3 test.scm
$ ./test
(1 b c)
(1 . 2)

Now I'd agree your patch would be a good thing, but _only_ if we can make
the compiler enforce immutability of constant objects (which can't be
done in general, AFAIK).

Cheers,
Peter

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to