Tcl_CreateEnemble() lacks ClientData,Tcl_CmdDeleteProc args
Closed / Rejected2549883fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 17 years ago
Descriptionplain2009-01-30 18:23:33
Seems there's no way when creating an ensemble command to set a Tcl_CmdDeleteProc. Either a revised interface permitting that, or some advice in the documentation about how to proceed in light of this disability (delete trace? CmdInfo manipulation?) would be in order.
dgpplain2009-01-31 01:24:07
This disability leaks through to the internal TclMakeEnsemble() utility as well.
dgpplain2009-01-31 02:18:17
Also no way to set a ClientData. Without these things, appears very hard to use the public access to ensemble machinery to create an object-like command. Maybe I'm barking up the wrong tree, and should be putting oo facilities to work instead?
dgpplain2009-01-31 02:21:12
well, access to these things is denied because the ensemble machinery itself is making use of them. So what's the way to implement an object-like command?
dkfplain2009-01-31 22:26:28
Try explaining the use-case for this significant increase in complexity first. :-)
dgpplain2009-02-01 01:09:55
The intended use case was to convert the slave interp command returned by [interp create] into an ensemble. The motivation for that was to assist the NRE-enabling of [$slave invokehidden] to fix Tcl Bug 2486550. Since I opened this, I've learned more about NRE and it's now clear that conversion to an ensemble is not necessary, and not really even very helpful in tackling 2486550, so this particular motivating case is no longer active. Now consider it just a feature request for extensions. If an extension wants to create an object-like command, is there a recommended way to build on Tcl_CreateEnsemble() to achieve that? Or is it recommended to use the OO C routines instead?
dkfplain2009-02-23 17:51:59
There is one way to do it now: attach the clientData to the individual subcommands in the ensemble. But the C OO routines are probably easier overall, especially if you're not interested in supporting inheritance. Everything in the OO code is NRE-enabled.
dkfplain2009-07-13 19:33:11
Can also use Tcl_SetEnsembleParameterList to install global extra arguments to every subcommand. If that's not sufficient, it really is time to get busy with TclOO instead.
dkf Closed ticket [2549883fff].
[History diff]2009-07-13 19:33:12
Log in (anonymous is fine) to add a comment.