TIP #312

View: New views
1 Messages — Rating Filter:   Alert me  

TIP #312

by Rene Zaumseil-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hallo,

sorry for the delay. But I was on vacation.

Kevin Kenny wrote:
>     The behaviour when a string, a byte array or a list exceeds the
>     given /size/ is not specified.  I presume it is to throw an
>     appropriate error.
>
>     The behaviour when a list is shorter than the given /size/ is
>     not specified, and I'm not sure what desirable behaviour
>     would be.
In both cases an error will be thrown. If I remember correctly this was
specified in the original proposal of the 'link' command and is incorrectly
deleted on the removal of this command.

>     The behaviour of Tcl_LinkArray with /size/==1 is specified
>     incorrectly.  A string is not the same as a singleton list
>     containing the string.  I would expect that Tcl_LinkArray
>     with /size/==1 would accept singleton lists and assign the
>     sole element of the array according to the value of the
>     singleton.
>
>     In other words, if a is linked to an array of integers
>     of length 1  and b is linked to an integer, I expect
>
>       set a {{10}} - interprets {{10}} as the singleton list
>                      comprising the string "10", and places
>                      10 in the sole array element.
>       set b {{10}} - The string "{10}" is not an integer;
>                      throw an error.
Your concern is answered in the tip description (under 'New C API'):

   ... If the given size is 1, then we have the same functionality as before.
   With size > 1, the linked Tcl variable is a list variable. ...

The new command only add functionality for real lists.
All existing behaviour (single variables) remain the same!

>
>     If c is linked to an array of strings of length 1 and
>     d is linked to a string, I expect
>
>      set c {{this is a string}} - sets the sole element of
>                                   the array to
>                                   "this is a string"
>      set d {{this is a string}} - sets the string to
>                                   "{this is a string}"
>      set c {this is a string} - error, too many elements
>                                 for the array
>      set d {this is a string} - sets the string to
>                                 "this is a string"
>      set c \{ - error, malformed list
>      set d \{ - sets the string to a single opening brace
TIP 312 propose no array of strings! You are wrong here.
The new TCL_LINK_CHARS link a string of 'size' length to a tcl variable.
Again as above, the given string on the tcl side must always have exactly
these length. Otherwise you get an error.

>
>     I seem to recall raising these concerns back in February or
>     so, but never heard back from Rene how he proposed to address
>     them.
Sorry but I could not find any mail from this date.


If the above comments are the reason to reject the tip I hope you can
reconsider your mention.


rene

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tcl-Core mailing list
Tcl-Core@...
https://lists.sourceforge.net/lists/listinfo/tcl-core
LightInTheBox - Buy quality products at wholesale price!