| Ticket UUID: | 2000423 | ||
| Title: | re-implement [namespace code] | ||
| Type: | RFE | Created on: | 2008-06-23 03:05:55 |
| Submitter: | dgp | Assigned to: | msofer |
| Subsystem: | 21. [namespace] | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2019-06-03 16:15:52 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | None | ||
| Description: | ||||
[namespace code] constructs a script using the [namespace inscope] command to do its work. [namespace inscope] is difficult to understand. I wonder whether the new [apply] command has enough power to serve as the primitive on which an equivalent, but different implementation of [namespace code] could be written. | ||||
| User Comments: | ||||
dkf added on 2008-06-23 15:46:51:
Logged In: YES
user_id=79902
Originator: NO
Experimentation indicates that the following is equivalent to 'namespace inscope', apart from the magical horror in [unknown].
apply {{ns prefix args} {uplevel 1 [list namespace eval $ns $prefix $args]}}
Don't know if this means that it is something you'd actually want to use though. That's not the most elegant code I've written.
tallniel added on 2008-06-30 23:25:08:
Logged In: YES
user_id=102050
Originator: NO
My guess is that the following should be roughly equivalent to [namespace code], but
would want to be a lot more sure of that "roughly":
proc ns_code args { list apply [list {} $args [uplevel 1 namespace current]] }
Was that what you were considering, DGP?
msofer added on 2008-08-06 21:57:23:
Logged In: YES user_id=148712 Originator: NO The ugly hack in init.tcl: we should just REMOVE IT NOW! Let Itcl add that to ::unknown in its own loader, Tcl works fine without that. See Itcl's patch #2040295 at https://sourceforge.net/tracker/index.php?func=detail&aid=2040295&group_id=13244&atid=313244 msofer added on 2008-08-07 02:24:53:
Logged In: YES user_id=148712 Originator: NO Ugly hack in init.tcl now gone dgp added on 2019-06-03 16:15:52:
Now that TIP 284 is getting consideration, another look at this may also be in order? | ||||
