Hi Wolfgang, On Mon 21 Mar 2011 01:24, Wolfgang J Moeller <w...@heenes.com> writes:
> (define (unintern sym) ; UNINTERN: delete (local) shadowing symbol > (module-remove! (current-module) sym) > (if #f #f)) > > (define (undefine sym) ; UNDEFINE: provide an #<undefined> shadowing > symbol > (module-ensure-local-variable! (current-module) sym) > (variable-unset! (module-variable (current-module) sym)) > (if #f #f)) > > are what I wanted, in order to > (a) undo MACRO definitions - you can't re-DEFINE a name after DEFINE-SYNTAX; You can certainly re-define a name after define-syntax. This used to not be the case, at least with psyntax, but this changed at some point in upstream psyntax, and I merged in similar functionality in our copy sometime last year or the year before. > (b) recover built-in functions once you have re-defined them; Hummmm. However, functions which have been defined in your module in terms of your local functions might keep a hold on your local functions. Whether this happens depends on whether the code in question has been run or not, and whether the code was introduced from a macro or not. For the mechanism, see "Compiled Procedures are VM Programs" in the manual. Basically I'm hesitant to include such functionality in Guile itself, because it gets harder for me (as maintainer, bug-hunter, etc) to reason about users' code after you ,undefine. > (c) test code that uses UNDEFINED? . How is this different from (not (defined? 'sym)) ? And what kind of code would you use this for? Cheers, Andy -- http://wingolog.org/