As far as I see it, the dilambda solution is not transparent in the sense
that
in order to access a variable "var1" you need to "call" it like
(var1)
.. so to access and call a function you'd need to do ((var2) my-arg)

Not sure the mindset around srfi-212 but at least for me seems an elegant
way for enabling redefinition of variables/functions of some module and have
its changes reflected on the places where this module was imported.

On Fri, 2 Oct 2020 at 16:08, <[email protected]> wrote:

> 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.
>
>
_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to