[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question with binding

In article <3140@kalliope.rice.edu> I wrote:
$The reason is that you can devise your own security blanket (and sleep
$tight ;-}) with the macro system that comes with any Scheme. The
$declare-constant and undeclare-constant that I referred to in my
$earlier posting are now simple macros. One method would be:
$(defmacro (declare-constant x)
$  `(put 'x 'constant t))
$(defmacro (undeclare-constant x)
$  `(put 'x 'constant nil))
$(defmacro (setq x v)
$  `(if (get 'x 'constant)
$       (error "hey watch out, salman rushdie is out to set constants!")
$       (set! x ,v)))

All the x's above should have commas before them. I guess the constant
shuttling between the new extend-syntax (which doesn't use the
backquote system) and the old def*macro (which does) has taken its

We must believe in free will. We have no choice.       --Isaac Bashevis Singer