[Chicken-users] Why define-constant is not a constant?

2015-12-07 Thread Joe Python
I was expecting the identifier 'test1' to not change by using the
define-constant form.
However i was still able to redefine test1? How to tell the chicken
compiler to declare test1 to be a constant for real?




CHICKEN
(c) 2008-2015, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.10.0 (rev b259631)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2015-08-04 on yves.more-magic.net (Linux)

#;1> (define-constant test1 "initial value")
#;2> (define test1 "I got changed")
#;3> test1
"I got changed"
#;4>

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Why define-constant is not a constant?

2015-12-07 Thread Evan Hanson
Hi Joe,

That's not really what `define-constant` is for. Here, "constant" means
"constant value", not "lexical identifier that can't be changed".

Even so, the compiler does happen to do what you're expecting (as
opposed to the interpreter, where `define-constant` is equivalent to
`define`):

$ cat foo.scm
(define-constant test1 "initial value")
(define test1 "I got changed")
(print test1)
$ csc foo.scm
$ ./foo
initial value

Cheers,

Evan

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users