[Xotcl] Default-value substitution using substdefault

Gustaf Neumann neumann at wu.ac.at
Fri Aug 12 18:59:39 CEST 2022


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



More information about the Xotcl mailing list