@main[][sDir]
$tClass[^table::create{sName
a.p
b.p
c.p
d.p
}]
$sDir[176_dir]
^tClass.menu{
^use[$sDir/$tClass.sName]
}
|
var value |
| local |
not local |
self |
^one[]
^two[]
^print[MAIN vars;$MAIN:CLASS]
^hr[]
$oa1[^a::create[]]
^add_methods[$oa1]
^oa1.run[]
^print[first a instance (dynamic, has @OPTION in self);$oa1;$.bProcess(true)]
$oa2[^a::create[]]
^print[second a instance without setting vars (dynamic, has @OPTION in self);$oa2;$.bProcess(true)]
^print[a without setting vars (static, has @OPTION in self);$a:CLASS]
^a:run[]
^print[a (static, has @OPTION in self);$a:CLASS]
^hr[]
^b:run[]
^print[b (static, no @OPTION in self);$b:CLASS]
$ob[^b::create[]]
^add_methods[$ob]
^ob.run[]
^print[b (dynamic, no @OPTION in self);$ob;$.bProcess(true)]
^hr[]
^c:run[]
^print[c (static, child of 'a', no @OPTION in self);$c:CLASS]
$oc[^c::create[]]
^oc.run[]
^print[c (dynamic, child of 'a', no @OPTION in self);$oc]
^hr[]
^d:run[]
^print[d (static, child of 'a', has @OPTION in self);$d:CLASS]
$od[^d::create[]]
^od.run[]
^print[d (dynamic, child of 'a', has @OPTION in self);$od]
@one[][locals;one_1]
$one_1[one_1] ^rem{ local }
$one_2[one_2] ^rem{ local because of 'locals' }
$self.one_3[one_3] ^rem{ not local }
@two[][two_1]
$two_1[two_1] ^rem{ local }
$two_2[two_2] ^rem{ not local }
$self.two_3[two_3] ^rem{ not local }
@add_methods[uObject]
^process[$uObject]{@three[][locals^;three_1]
^$three_1[three_1]
^$three_2[three_2]
^$self.three_3[three_3]^#0A@four[][four_1]
^$four_1[four_1]
^$four_2[four_2]
^$self.four_3[four_3]
}
@hr[sTitle]
^if(def $sTitle){$sTitle}{ } |
@print[sTitle;uObject;hParam]
^hr[$sTitle]
^vars[Method with [^;locals^;];$uObject;one]
^vars[Method without [^;locals^;];$uObject;two]
^if($hParam.bProcess){
^vars[Runtime added method with [^;locals^;];$uObject;three]
^vars[Runtime added method without [^;locals^;];$uObject;four]
}
@vars[sTitle;uObject;sPrefix]
| $sTitle |
^var[$uObject.[${sPrefix}_1]] |
^var[$uObject.[${sPrefix}_2]] |
^var[$uObject.[${sPrefix}_3]] |
@var[sValue]
^if(def $sValue){$sValue}{undef}