Artifacts Associated With Ticket 2960227fffffffffffffffffffffffffffffffff
Ticket change [ca4d56a044] (rid 95317) by wiede on 2010-02-27 15:03:38:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Using the "my" command of an object when the object's class is created with createWithNamespace option shows that the "my" command uses the wrong namespace when created with the object. Use of createWithNamespace object for the object too fails with complaining that the namespace cannot be created, as it already exists. My quick hack was to add a flag to AllocObject and to the Class structure. the class structure has a flag use_declarer_ns, which is set to1 if the createWithNamespace option is used and the object on creation uses classPtr->thisPtr->selfCls->use_declarer_ns when calling AllocObject. I am not sure, if that's a suitable solution, but at least my example works with it. The example is in the attached file. Be aware that also the FRQ for the -use_declarer_ns option is necessary for that example to work.
- foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "wiede"
- subsystem initialized to: "35. TclOO Package"
- title initialized to: "problem with my command"
- type initialized to: "Bug"
Add attachment "t9.tcl" [f724c93a31] (rid 91322) by wiede on 2010-02-27 22:03:39.
Ticket change [aeac56a955] (rid 101681) by wiede on 2010-02-27 22:03:39:
- icomment:
File Added - 364686: t9.tcl
- login: "wiede"
- mimetype: "text/plain"
- username: "wiede"
- icomment:
Ticket change [f9ebca42c2] (rid 91779) by dkf on 2010-02-28 13:40:12:
- icomment:
I don't understand the nature of this bug. The [my] command just uses the object's private namespace because all method invocations do that. That's what standard methods are defined to do. (A different method type could do something else; the choice of which namespace to make current is part of the method implementation and not the core method system, as can be seen from the way that forwarded methods are handled.) Because it is vital that we hang some bits and pieces of state off the namespace - it's a fundamental design decision which permeates everything - we *have* to create a namespace during object creation; using an existing namespace isn't going to work. Right now, I suspect that a custom method type might be all that you're looking for.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [a958fe888f] (rid 99135) by dkf on 2010-02-28 13:45:19:
- icomment:
BTW, what is that example script supposed to actually output? :-) (At a guess you're complaining about the fact that [my] isn't a global command? If so, tough. Lots of other code depends on the fact that every object has its own [my], and that each of them knows which particular object is being talked about. For one thing, it is at the heart of how to do callbacks from traces, binding scripts, etc.)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [1f7fafa3c5] (rid 91156) by wiede on 2010-02-28 16:07:27:
- icomment:
File Added - 364782: t9.log
- login: "wiede"
- mimetype: "text/plain"
- username: "wiede"
- icomment:
Add attachment "t9.log" [96f137faab] (rid 106422) by wiede on 2010-02-28 16:07:27.
Ticket change [091045d569] (rid 89656) by wiede on 2010-02-28 16:12:34:
- icomment:
The problem is, that calling an objects method, which has the use_declarer_ns flag set, this method is executed in the classes namespace. In that namespace there is no [my] command available, as that is in the object's namespace. I don't know how to call another method within that object from the executed method. It is correct, that on the C-level I could implement a similar command, which is available in the classes namespace. An example output is in the 2nd attachment.
- login: "wiede"
- mimetype: "text/plain"
- username: "wiede"
- icomment:
Ticket change [82a8020bea] (rid 117267) by wiede on 2010-03-01 20:55:38:
- icomment:
Having had a deeper look at the wanted behaviour, I have found out, that what I need is a command similar to the [my] command in every class namespace of the object's classes. I have added a ::oo::define itclthis part for providing that, which does provide what I need and with that the wanted functionality is available. So it is up to you Donal, if that is a bug or not, at least I have a solution for the problem.
- login: "wiede"
- mimetype: "text/plain"
- username: "wiede"
- icomment:
Ticket change [2bb5012750] (rid 118787) by dkf on 2010-03-02 21:02:51:
- icomment:
I'm not quite sure where to store the information about what the subject of the "instance-my" command is.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [b3cd64ced6] (rid 124913) by dkf on 2012-04-10 15:31:38:
- priority changed to: "6"
Ticket change [b44fe791b3] (rid 139911) by dkf on 2014-09-14 16:38:54:
- closer changed to: "nobody"
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "7 High"
- severity changed to: "Minor"
Ticket change [9d79af840d] (rid 140971) by dkf on 2014-12-18 13:58:47:
- closedate changed to: "2457010.08249843"
- closer changed to: "dkf"
- icomment:
Ah! I understand now. <p> TclOO <i>will</i> always create the namespace for the instance of the object; it needs to have the right deletion callback configured at the C level for object destruction to work. Without that callback, there's a gigantic memory leak. Because of that basic constraint, that namespace needs to not exist prior to the call to the <tt>createWithNamespace</tt> method. <p> I don't plan to allow two instances to have the <i>same</i> instance namespace. That would enormously complicate the cleanup code, which is already pretty tricky...
- login: "dkf"
- mimetype: "text/html"
- resolution changed to: "Wont Fix"
- status changed to: "Closed"
- username: "dkf"