[Xotcl] NX objects and namespaces
Maksym Zinchenko
siqsuruq at gmail.com
Thu Dec 29 19:37:08 CET 2022
Hello, first of all Happy new year for all!
I have a doubt about an object as a parameter and namespaces. For example I
have 2 classes:
package require nx
>
> nx::Class create aClass {
> : public method print {} {
> puts "I'm an a object: [[self] info name] -> [[self] info parent] "
> }
> }
>
> nx::Class create bClass {
> :property pr:object,required
>
> :method init {} {
> puts "a_obj print result: "
> ${:pr} print
> }
> }
>
> aClass create a_obj
> bClass create b_obj -pr a_obj
>
It works the way it's supposed to work. Now inside the namespace:
namespace eval testNameSpace {
> aClass create a_obj1
> a_obj1 print
> bClass create b_obj1 -pr a_obj1
> }
>
This will give me an error, because NX is trying to execute object passed
as a parameter in global namespace:
I'm an a object: a_obj1 -> ::testNameSpace
> a_obj print result:
> invalid command name "a_obj1"
>
My question is, I might be doing something wrong, what is the right way to
do it? Or when I pass Object as parameter I need to add namespace manually,
why it's not assuming [namespace current]?
Thank you
More information about the Xotcl
mailing list