Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2010-02-11
21:20 • Ticket [1803296fff] namespace ensemble name lookup status still Open with 4 ... artifact: 96989b51fd user: dkf
2009-07-13
19:34 • Ticket [1803296fff]: 1 change artifact: 8301dceafe user: dkf
19:34 • Ticket [1803296fff]: 4 changes artifact: 3466959e94 user: dkf
2009-05-11
21:04 • Ticket [1803296fff]: 4 changes artifact: b02b021a78 user: dkf
2007-09-30
17:24 • Ticket [1803296fff]: 1 change artifact: 116af7d8b3 user: dkf
2007-09-28
15:39 • Ticket [1803296fff]: 4 changes artifact: f8bc836d5b user: hgo
15:13 • Ticket [1803296fff]: 4 changes artifact: ba350fac25 user: hgo
2007-09-27
08:09 • New ticket [1803296fff]. artifact: 6009aa5fec user: hgo

namespace ensemble name lookup

Open1803296fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 17 years ago
Descriptionplain2007-09-27 08:09:08
A way to get the name of the namespace ensemble command that called a name space procedure (or mapped command) would be nice to have.

This could be a new (sub) option to "namespace ensemble" or it could e.g. be an additional key in "info frame".

The reason is that if the name was available in the subcommand body of the ensemble command and multiple ensemble commands for the same namespace was defined, each ensemble could be used as an instance of the namespace and private variables could be handled using the ensemble name as index to e.g. an array.

In this way simple and dynamic objects could be created directly using the namespace commands without the need of an additional OO layer.

An even better way would be to have "ensemble varaibles" local to each ensemble. But that is for Tcl 9 I think.
hgoplain2007-09-28 15:13:24
Logged In: YES 
user_id=1899920
Originator: YES

The use of 
> set self [lindex [info level 0] 0]
would also be OK, although 
> namespace ensemble self
Would be better :-)
hgoplain2007-09-28 15:39:52
Logged In: YES 
user_id=1899920
Originator: YES

Same as 1577492 except that another command should be used?
dkf Ticket [1803296fff]: 1 change [History diff]2007-09-30 17:24:45
dkfplain2009-05-11 21:04:11
If you want "ensemble variables", you might as well go to TclOO which is part of 8.6.
dkfplain2009-07-13 19:34:49
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.
dkf Ticket [1803296fff]: 1 change [History diff]2009-07-13 19:34:50
dkfplain2010-02-11 21:20:31
Hmm, looking at this again, I see a potential problem with ensembles of ensembles. Not sure what to do about it though.
Log in (anonymous is fine) to add a comment.