[Xotcl] Default-value substitution using substdefault

Maksym Zinchenko siqsuruq at gmail.com
Fri Aug 12 20:40:08 CEST 2022


Dear Gustaf, sorry I've tried to remove the comma but it breaks the code
completely.
And I can't see minimal example also. I based my code on an example in the
next-scripting tutorial (3.7.6. Defaults substitution):

:property {d:object,type=::D,substdefault {[::D new]}}



On Fri, Aug 12, 2022 at 4:00 PM Gustaf Neumann <neumann at wu.ac.at> wrote:

> Dear Maxsym,
>
> the comma after the variable name "srv" was not correct.
> We should provide an error message for that....
>
> See below for a minimal example showing the correct behavior.
>
> all the best
>
> -gustaf
>
> On 12.08.22 16:25, Maksym Zinchenko wrote:
> > Hello, I'm having trouble to define "srv" property in my superclass with
> > default value from Naviserver command, may be Im doing smth wrong, would
> be
> > so kind to help:
> >
> > nx::Class create dz_superclass {
> >> :property identifier
> >> :property {srv,substdefault=0b111: {[ns_info server]}}
> >> :method init {} {
> >> set :uuid ""
> >> if {[[current object] info vars identifier] eq ""} {
> >> set :identifier ""
> >> } else {
> >> if {[is_uuid ${:identifier}] == 1} {
> >> set :uuid ${:identifier}
> >> }
> >> }
> >> }
> >> }
> > nx::Class create dz_class -superclass dz_superclass {
> >> :method init {} {
> >> if {${:identifier} ne ""} {
> >> set :obj_data [dict getnull [select_all client *
> >> uuid_client=\'${:identifier}\'] 0]
> >> }
> >> }
> >> }
> >>
> > When I create object:
> >
> >> dz_class create o1 -identifier 67720c6d-d00f-479b-85cf-4edaa5a9cb1a
> >>
> > o1 cget -srv
> > Im getting literal "[ns_info server]" instead of my virtual server name
> >
> >
> >> [ns_info server]
> >>
> > Thank you
>
> _______________________________________________
> Xotcl mailing list
> Xotcl at alice.wu.ac.at
> http://alice.wu.ac.at/mailman/listinfo/xotcl
>


More information about the Xotcl mailing list