[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] how to unintern a symbol
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] how to unintern a symbol |
Date: |
Mon, 2 Feb 2015 20:11:20 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Feb 02, 2015 at 11:55:12AM -0700, Alexej Magura wrote:
> AFAICT that just defines a symbol to itself, and only then if you run:
>
> (define foo 1)
> (define foo (unintern 'foo))
> (eq? foo |foo|) => #t
>
> But, as I said, that only defines 'foo as |foo|: it doesn't
> /undefine/ the symbol, and it needs to have side-effects, since the
> CL /unintern/ AFAIK effects the targeted package, or in our case
> module.
>
> After uninterning /foo/, if I were to enter foo into the REPL to be
> evaluated, it would throw an unbound variable exception.
I wasn't aware of that CL behaviour. IIUC that's actually conflating
two different things: creating an uninterned symbol and "unbinding"
an interned symbol. I don't know of a way to unbind a variable through
Scheme, but you can set the symbol's value slot (0) to C_SCHEME_UNBOUND
in C. This has to go with the warnings "Don't try this at home", and
"this voids your warranty". :)
Cheers,
Peter
signature.asc
Description: Digital signature