Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-03-22
15:55 • Ticket [1577282fff] TIP 283: ensemble's command resolution status still ... artifact: 6608e05308 user: jan.nijtmans
2009-07-13
19:35 • Ticket [1577282fff]: 5 changes artifact: c31f8fef1e user: dkf
2006-11-02
03:40 • Ticket [1577282fff]: 4 changes artifact: b0deb1e6cc user: msofer
03:40 • Add attachment tip283-1.patch to ticket [1577282fff] artifact: 93f207052a user: msofer
03:40 • Ticket [1577282fff] TIP 283: ensemble's command resolution status still ... artifact: 6fa09f1082 user: msofer
2006-10-26
08:13 • Ticket [1577282fff]: 5 changes artifact: 7791bb00a8 user: msofer
08:13 • Add attachment tip283.patch to ticket [1577282fff] artifact: 6930bd699d user: msofer
2006-10-16
19:49 • Ticket [1577282fff] TIP 283: ensemble unknown should use ns path status st... artifact: 4d89c0db4f user: msofer
2006-10-15
01:16 • Ticket [1577282fff]: 4 changes artifact: 2fdf3359ae user: msofer
01:16 • Add attachment eunknown.patch to ticket [1577282fff] artifact: 9baefd2c87 user: msofer
01:16 • Ticket [1577282fff] ensemble unknown should use ns path status still Open ... artifact: fc284096e4 user: msofer
2006-10-14
17:28 • New ticket [1577282fff]. artifact: 2ffe5e3e96 user: msofer

TIP 283: ensemble's command resolution

Open1577282fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 3 years ago
Descriptionplain2006-10-14 17:28:58
[namespace unknown] should be able to follow [namespace
path] and [namespace unknown] lookup behaviour.

After application of [Patch 1577278], adding a line
  iPtr->lookupNsPtr = ensemblePtr->nsPtr;
just before the call to Tcl_EvalObjv in
NamespaceImplementationCmd enables this behaviour.

If the registered ensemble unknownProc returns a FQ
command as first element of the list, the resolution is
still global. If the name is not FQ, the resolution
will follow whatever rules the ensemble's namespace has
set in place.
msoferplain2006-10-15 01:16:15
Logged In: YES 
user_id=148712

Patch for docs and tests attached
msoferplain2006-10-15 01:16:16
File Added - 198173: eunknown.patch
msofer Ticket [1577282fff]: 1 change [History diff]2006-10-16 19:49:40
msoferplain2006-10-26 08:13:12
File Added - 200065: tip283.patch

Logged In: YES 
user_id=148712

Updated patch: code, docs, (incomplete) tests
msoferplain2006-11-02 03:40:27
Logged In: YES 
user_id=148712

Updated patch that works in HEAD. It breaks test cmdAH-24.12
in a weird manner - by breaking autoloading of [clock scan].
The reason is exposed below; the problem with clock can be
fixed easily, but the wider problem may be more important.

*** DANGER ***

As the "fix" for [info level] in HEAD was reverted (Bug
1577492, previously called "let [info level] know ensemble
rewrites"), this new feature breaks nother usual idiom.

  'uplevel 1 [info level 0]' is NOT GUARANTEED to call the
present proc again

This is because:
(a) 'namespace ensemble' does not push a new frame
(b) 'namespace ensemble' calls by simple name (non qualified)
(c) 'info level 0' reflects only the actual call, ie, a
simple name

As an illustration, with this patch we get:

% namespace eval a {
    variable ct 0
    namespace ensemble create -map {x scan}
    proc scan args {
        variable ct
        if {$ct} {
            puts YES
            return
        }
        incr ct
        uplevel 1 [info level 0]
    }
}
% a x
wrong # args: should be "scan string format ?varName varName
...?"
msoferplain2006-11-02 03:40:28
File Added - 201011: tip283-1.patch
dkfplain2009-07-13 19:35:57
The NRE-enabled command dispatch function allows control over the command resolution context. Might be worth looking at whether this FRQ can be dealt with through that route.
jan.nijtmanswiki2024-03-22 15:55:31

Ping. Found this ooooooold ticket. Related to [910d67a229]?

Log in (anonymous is fine) to add a comment.

Attachments: