[CM] srfi 212 - define-alias

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Fri Oct 2 07:08:34 PDT 2020


I think dilambda gives that functionality, at the cost
of some additional parentheses (which at least make it
explicit that something not-entirely-simple is going on):

(define-macro (alias var1 var2)
   `(define ,var1 (dilambda
		  (lambda ()
		    ,var2)
		  (lambda (val)
		    (set! ,var2 val)))))

(define lt (inlet 'var1 32))
(alias var2 (lt 'var1))

(display (var2)) (newline)
(set! (var2) 12)
(display lt) (newline)
(display (var2)) (newline)

I don't like the idea that setting one apparently simple
variable secretly changes another.  srfi-212 appears to me
to be yet another attempt to kludge around bugs in standard
scheme's hygienic macros, while disregarding the damage
this does outside those macros.



More information about the Cmdist mailing list