I must be missing something here - but are non-positional arguments not permitted on the init proc? A transcript of my attempts below...
thanks in advance for any help. -shishir
% Class foo -parameter {{-a "apple"}} ::foo % foo instproc init {{-a "apple"} args} {} % foo f ::f % foo f -a "banana" ::f: unable to dispatch method 'a' during '::f a' % foo f a "banana" ::f % foo instproc init {{-a "apple"} args} { puts "a=$a args=$args" } % foo f a "banana" a=apple args=a banana ::f % foo f -a "banana" ::f: unable to dispatch method 'a' during '::f a' % foo instproc init {{a "apple"} args} { puts "a=$a args=$args" } % foo f a "banana" a=a args=banana ::f %
Shishir Ramam schrieb:
I must be missing something here - but are non-positional arguments not permitted on the init proc? A transcript of my attempts below...
Dear Shishir,
The recommendation is, not to use nonposargs in init, since providing values in the "-" syntax conflicts syntactically with object configuration.
You can use nonposargs in "init" it with some more syntax like in the following example e.g. in factory methods:
Class foo -parameter {{-a "apple"}} foo instproc init {{-a "apple"} args} { puts a=$a} foo f foo f [list -init -a "banana"]
See as well:
http://groups.google.at/group/comp.lang.tcl/browse_frm/thread/26b2e0ac8edfab...
best regards -gustaf neumann