[Xotcl] Default-value substitution using substdefault
Maksym Zinchenko
siqsuruq at gmail.com
Sat Aug 13 13:07:41 CEST 2022
Thank you Gustaf, I can see that the problem is in freedom, and people say
that freedom is a good thing :)
This works as I expected:
:property {srv:substdefault {[ns_info server]}}
About the suspicious characters, I doubt that there will be people who will
name their properties like this: ',&';\/', I think we can even limit it to
alphanumeric characters without punctuation.
Thanks again for the excellent explanation and examples.
On Sat, Aug 13, 2022 at 9:28 AM Gustaf Neumann <neumann at wu.ac.at> wrote:
> Dear Maxym,
>
> I've looked again into your original problem, concerning measures to
> address
> the problem earlier. The problem is that nx/xotcl are very liberal on
> what is
> allowed as a property name (maybe sometimes too liberal). In the example,
> the string "srv,substdefault=0b111" is interpreted as the name of the
> property.
> When accessing the property, the name abbreviation rules kick in, and
> one can
> access it via "-srv", but as well via every other abbreviation such as
> "-srv,subst".
> Since the whole spec is treated as a name, "substdefault" does not kick in.
>
> I have added now a warning to complain about suspicious characters in a
> property name, that hints an error (here a ",").
>
> We are close to a new release of NSF, but I will wait for your feedback....
>
> all the best
>
> -gustaf
>
>
> % nx::Class create dzs {
> :property {srv,substdefault=0b111: {[nsf::is object ::nx::Class]}}
> :create o1
> }
> ::dzs
> %
> % o1 cget -srv
> [nsf::is object ::nx::Class]
> % o1 cget -srv,
> [nsf::is object ::nx::Class]
> % o1 cget -srv,subst
> [nsf::is object ::nx::Class]
> _______________________________________________
> Xotcl mailing list
> Xotcl at alice.wu.ac.at
> http://alice.wu.ac.at/mailman/listinfo/xotcl
>
More information about the Xotcl
mailing list