[Xotcl] How do I get a parameters default-value?
Gustaf Neumann
neumann at wu-wien.ac.at
Tue Jul 18 15:11:15 CEST 2006
Dear Florian,
info parameter has a well known bug that it returns just the value of
the last parameter invocation for the class.
to get the full list, you have to do something like
X parameter {{p1 val1}}
...
X parameter [concat [X info parameter] {{p2 val2} {p3 val3}}]
There is an undocumented feature to access the default values via:
puts d=[X set __defaults(p1)]
note that this might change in the future.
i have locally a complete rewrite of the parameter system of xotcl based
on single and multivalued slots,
but i have still to implement an as-far-as possible backward compatible
top-level layer for it.
It waits as well for a stress and feature test for a relational database
layer we are developing,
but anyhow, it should become part of the next release of xotcl.
greetings
-gustaf
Murr, Florian schrieb:
> package require XOTcl
> namespace import xotcl::*
>
> # Let's say, I got:
>
> Class X -parameter {
> {p1 val1A}
> }
> X create x1 -p1 x1val1
>
> # ...
>
> # Now I change the default-values
> X parameter {
> {p1 val1B}
> }
> X create x2 -p1 x2val1
>
> # How do I get the current default-value 'val1B' for p1?
> # Note 'X info parameter' is no option, since after:
>
> X parameter {}
> puts "X parameter = [X info parameter]"
> X create x3
> puts "x3 p1 --> [::x3 p1]" ;# still works.
>
> # So the default-values are remembered somewhere!
> # My guess was somewhere around '::xotcl::Class::Parameter', but I
> just
> # could not find, where? - and how to access them?
> #
> # Somehow there must be a better way to access the current
> default-values
> # then via some newly created dummy object?!
>
> # (May be even the "old" default-values 'val1A, val2A' (for ::x1)
> are still remembered somewhere?)
> #
> # regards,
> # - Florian
>
> _______________________________________________
> Xotcl mailing list
> Xotcl at alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>
More information about the Xotcl
mailing list