Weird Dynamic Binding Idea: Climbing The Chain?

I've lamented the performance impacts of having to search "specifier" binding chains to look things up, and how it's nice that it finds newly emerging elements (like declarations that get added to modules) but how uncacheable it is...

But there's an odd thing about a chain of lookup that keeps compounding, in that you could ask not to take the first match, but to involve a count of how many times you've found it.

There are already some ideas for what leading tuple might mean, but... let's imagine it being used for this purpose. It could be something else:

x: 10

foo: func [x] [
    let x: 30
    print [x .x ..x]   ; What if this printed `30 20 10` ??
]

foo 20

Just a thought. Things are pretty chaotic in binding, and having code demonstrate such a "meta-awareness" of what's going on in the binding above seems like it could be moreso. But it's crossed my mind a couple times so I thought I'd mention it.

1 Like