Here's my thought as to why lexicals are now failing in tcl:

When PDD20 hit, tcl was reworked to use .HLL_map of .LexPad to .DynLexPad, then walked up the lexpad whenever trying to access lexicals.

When PDD21 hit, I replaced all use of

.namespace [ 'Tcl' ]

with

.HLL 'Tcl', 'tcl_group'
.namespace [ '' ]

To get the *namespace* effect, but: this now removes the HLL lexpad mapping that was established once at startup, which kills my lexical support.

So, I need:

.HLL 'Tcl', 'tcl_group'
.HLL_map .LexPad, .DynLexPad
.namespace [ '' ]

Except this doesn't always work since the .DynLexPad isn't loaded by default, so I really need:

.sub hacky :immediate :anon
  P0 = loadlib "dynlexpad"
.end
.HLL 'Tcl', 'tcl_group'
.HLL_map .LexPad, .DynLexPad
.namespace [ '' ]

I can avoid loading the dynlex lib each time, if I'm clever, but then I have to be clever. Or I could put those six lines into a .Tcl() macro and apply liberally.

Any thoughts?

Reply via email to