# -*- Tcl -*- package require nx::test nx::Test case plain-methods-0 { nx::Class create M1 nx::Object create o { ? {o public method foo {} {return foo}} "::o: unable to dispatch method 'method'" :public object method f args {next} } ? {o mixin M1} "::o: unable to dispatch method 'mixin'" ? {o filter f} "::o: unable to dispatch method 'filter'" ? {lsort [o info object methods]} "f" ? {lsort [o info]} "valid submethods of ::o info: children class has info lookup name object parameter parent precedence variable vars" } # # require the conveniance layer # and make it verbose # package require nx::plain-object-method nx::configure plain-object-method-warning on nx::Test case plain-methods-1 { nx::Class create M1 nx::Object create o { :public method foo {} {return [:pm1]} :public method f args {next} :protected method pm1 args {return pm1} :public alias a ::o::pm1 :public forward fwd %self pm1 :private method priv args {return priv} :method pm2 args {return pm2} :property -accessor public p :variable v1 1 :variable -incremental v2:integer 1 # # public, protected, private # alias, forward # } ? {o info methods} "v2 p foo fwd a f" ? {lsort [o info methods -callprotection protected]} "per-object-slot pm1 pm2" ? {lsort [o info methods -callprotection private]} "priv" ? {o info variables} "::o::per-object-slot::v2 ::o::per-object-slot::p" ? {o info object variables} "::o::per-object-slot::v2 ::o::per-object-slot::p" ? {o info slots} "::o::per-object-slot::v2 ::o::per-object-slot::p" ? {o pm1} "::o: unable to dispatch method 'pm1'" ? {o foo} "pm1" ? {o a} "pm1" ? {o fwd} "pm1" ? {o mixin M1} ::M1 ? {o info mixin classes} ::M1 ? {o mixin ""} "" ? {o info mixin classes} "" ? {o filter f} f ? {o info filter methods} f ? {o filter ""} "" ? {o info filter methods} "" ? {lsort [o info object methods]} "a f foo fwd p v2" ? {lsort [o info]} "valid submethods of ::o info: children class filter has info lookup method methods mixin name object parameter parent precedence slots variable variables vars" }