[CM] Question about unexpected let binding behaviour

chohag at jtan.com chohag at jtan.com
Thu Apr 23 15:48:03 PDT 2026


bil at ccrma.Stanford.EDU writes:
> Having goofed around with this for a morning,
> I think inlet and sublet should treat duplicate
> variables as an error.  Will this greatly
> affect anyone?
>

It's how I assumed it worked until I discovered that it didn't, so
I won't have any problem with that.

Although not an error, per se. I assumed/hoped this code would run
without failing. I didn't have a prior notion of which 'a I would
get (that's what documentation is for) but I assumed I would get
only one of them:

        (define-macro (foo . ARGS) (inlet 'a "a" , at ARGS))
        (define bar (foo 'a "A"))

Is (bar 'a) "a" or "A"? As S7 generally has a "fail forward" approach
I'd suggest the latter.

But given that (let ((a "a") (a "A")) ...) is an error I am open
to the idea of (inlet 'a "a" 'a "A") being an error also but then
I have to check my ARGS for duplicates and decide which ones to
remove...

I understand where you're coming from with cutlet but likewise I
think it's one of those things that looks good in theory but has
no practical use.

Matthew


More information about the Cmdist mailing list