No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Possible bug in NX
From: Victor Mayevski <vitick_at_gmail.com>
Date: Sun, 20 Mar 2011 19:56:48 -0700
Well, that makes sense. It turned out that handling spaces in object
names is a complete nightmare. I decided that it is much easier to get
rid or replace the spaces than try to predict and catch every event of
spaces in object names breaking my script.
On Tue, Mar 15, 2011 at 10:29 PM, Gustaf Neumann <neumann_at_wu-wien.ac.at> wrote:
> Dear Victor,
>
> i don't think, nx/xotcl should brace a scalar return values. Look at plain
> Tcl:
> Tcl does not brace a string with a space either:
>
> % set x "a b"
> a b
>
> For what reason should nx/xotcl do it? There are many other commands in nx,
> doing the same, such as e.g. "create"
>
> % nx::Object create "a b"
> ::a b
> % nx::Object create "a b::c d"
> ::a b::c d
> % nx::Object create "a b::e"
> ::a b::e
>
> ... and therefore "info parent" has no reason to add braces:
>
> % "a b::c d" info parent
> ::a b
>
> In situations, where a list is returned (potentially multiple elements) the
> elements have to be are proper list elements and therefore these elements
> are escaped, even if the result is a list with a single element:
>
> % "a b" info children
> {::a b::e} {::a b::c d}
>
> This is the same in plain Tcl as well: "info commands" returns a list of
> elements:
>
> % info commands "::a *"
> {::a b}
> % info commands "::a b::*"
> {::a b::e} {::a b::c d}
>
> again, the command as a scalar:
>
> % lindex [info commands "::a b::*"] 0
> ::a b::e
> %
>
> So, the rule is: list are properly escaped, scalars are the plain values.
>
> all the best
> -gustaf
>
> On 16.03.11 01:48, Victor Mayevski wrote:
>>
>> Hello Gustaf,
>>
>> I encountered an issue with [info parent] and where parent's name
>> contains a space. While [info children] behaves correctly by returning
>> a list:
>> {::pa rent::child}
>> [info parent] just returns the name:
>> ::pa rent
>> instead of:
>> {::pa rent}
>> This is fixable by using [list [info parent]] but I wonder if that
>> should be the default behavior in NX anyway?
>>
>> Thanks,
>>
>> Victor
>
>
Date: Sun, 20 Mar 2011 19:56:48 -0700
Well, that makes sense. It turned out that handling spaces in object
names is a complete nightmare. I decided that it is much easier to get
rid or replace the spaces than try to predict and catch every event of
spaces in object names breaking my script.
On Tue, Mar 15, 2011 at 10:29 PM, Gustaf Neumann <neumann_at_wu-wien.ac.at> wrote:
> Dear Victor,
>
> i don't think, nx/xotcl should brace a scalar return values. Look at plain
> Tcl:
> Tcl does not brace a string with a space either:
>
> % set x "a b"
> a b
>
> For what reason should nx/xotcl do it? There are many other commands in nx,
> doing the same, such as e.g. "create"
>
> % nx::Object create "a b"
> ::a b
> % nx::Object create "a b::c d"
> ::a b::c d
> % nx::Object create "a b::e"
> ::a b::e
>
> ... and therefore "info parent" has no reason to add braces:
>
> % "a b::c d" info parent
> ::a b
>
> In situations, where a list is returned (potentially multiple elements) the
> elements have to be are proper list elements and therefore these elements
> are escaped, even if the result is a list with a single element:
>
> % "a b" info children
> {::a b::e} {::a b::c d}
>
> This is the same in plain Tcl as well: "info commands" returns a list of
> elements:
>
> % info commands "::a *"
> {::a b}
> % info commands "::a b::*"
> {::a b::e} {::a b::c d}
>
> again, the command as a scalar:
>
> % lindex [info commands "::a b::*"] 0
> ::a b::e
> %
>
> So, the rule is: list are properly escaped, scalars are the plain values.
>
> all the best
> -gustaf
>
> On 16.03.11 01:48, Victor Mayevski wrote:
>>
>> Hello Gustaf,
>>
>> I encountered an issue with [info parent] and where parent's name
>> contains a space. While [info children] behaves correctly by returning
>> a list:
>> {::pa rent::child}
>> [info parent] just returns the name:
>> ::pa rent
>> instead of:
>> {::pa rent}
>> This is fixable by using [list [info parent]] but I wonder if that
>> should be the default behavior in NX anyway?
>>
>> Thanks,
>>
>> Victor
>
>