From: Donal K. Fellows on
On 28 July, 10:42, Lawrence Woodman <nos...(a)example.com> wrote:
> I'm guessing from your reply that I may have misunderstood this more than
> I realized.  If I run Tcl_EvaLObjEx() with "namspace current" from a
> method that I have created, I get "::" returned, indicating that it is
> running in the global namespace.  Should this not happen?

Depends on the flags parameter. If called with that set to zero, then
you'll use the Tcl-level caller's context. That might be global. :-)

I think I know what the issue is and why we've been talking past each
other. TclOO doesn't push stack frames for you in its abstract method
machinery. That has many consequences, but what it does mean is that
you need to be a bit careful in your method implementations; you don't
see any object variables or local commands by default.

Donal.
From: Lawrence Woodman on
On Wed, 28 Jul 2010 05:37:20 -0700, Donal K. Fellows wrote:

> On 28 July, 10:42, Lawrence Woodman <nos...(a)example.com> wrote:
>> I'm guessing from your reply that I may have misunderstood this more
>> than I realized.  If I run Tcl_EvaLObjEx() with "namspace current" from
>> a method that I have created, I get "::" returned, indicating that it
>> is running in the global namespace.  Should this not happen?
>
> Depends on the flags parameter. If called with that set to zero, then
> you'll use the Tcl-level caller's context. That might be global. :-)
>
> I think I know what the issue is and why we've been talking past each
> other. TclOO doesn't push stack frames for you in its abstract method
> machinery. That has many consequences, but what it does mean is that you
> need to be a bit careful in your method implementations; you don't see
> any object variables or local commands by default.

Ah got it, so the method is running in the same namespace as the caller.
This explains why TCL_NAMESPACE_ONLY wasn't working for variables
either. I assumed it referred to the namespace that the object was in.
I have just written a bit of code to confirm my understanding and it has
all become clear now.

Thanks for helping with this. Without realizing I could have had all
sorts of weird problems.


Lawrence