[Xotcl] parameters to keep Class objects
Stefan Sobernig
stefan.sobernig at wu.ac.at
Tue Sep 12 10:01:43 CEST 2023
Hi Maksym!
I would recommend using a "property", watch:
package req nx
nx::Class create a {
:public method hmmm {} {
return "Hmmmm!!!"
}
}
nx::Class create b {
:property -accessor public aObj:object,type=::a
:public method saysmth {} {
puts "Hello!? [${:aObj} hmmm]"
}
}
# in init.tcl / created once
::b create bobj
# somewhere else (later):
::bobj aObj set [::a new]
::bobj saysmth
What do you think?
HTH, Stefan
> Hello, can I use parameters to keep Class objects? Like this:
>
> package require nx
>>
>> nx::Class create a {
>> :public method hmmm {} {
>> return "Hmmmm!!!"
>> }
>> }
>>
>> nx::Class create b {
>> :method init {} {
>> set :aObj [a new]
>> }
>>
>> :public method saysmth {} {
>> puts "Hello!? [${:aObj} hmmm]"
>> }
>> }
>>
>> ::b create bobj
>> ::bobj saysmth
>>
> Is it possible that it will not be set if I create my "bobj" from init.tcl
> in Naviserver at startup?
>
> Thank you in advance
> _______________________________________________
> Xotcl mailing list
> Xotcl at alice.wu.ac.at
> http://alice.wu.ac.at/mailman/listinfo/xotcl
More information about the Xotcl
mailing list