[Scilab-Dev] strcat([],"")~=[]+"" ? <= Re: A+[]

Samuel Gougeon sgougeon at free.fr
Wed Mar 9 00:48:41 CET 2016


Hello,

Le 19/02/2016 10:36, Pierre-Aimé Agnel a écrit :
> Hello,
>
> A flag has been introduced to tackle the A+[] operation
> help("oldEmptyBehaviour")
> oldEmptyBehaviour("on")
> 1 + []
>
> oldEmptyBehaviour("off")
> 1+[]
>
>
> oldEmptyBehaviour("query")
>
>
> We kept the warning for both behaviours if users want to migrate "softly".
> This is also done to protect the scripts.

Up to Scilab 5.5.2, we had
strcat([],"anything") == "" // as well as
[] + "anything" == ""
The fact that both expressions give the same result is correct, since 
they mean exactly the same operation.

But with the new behavior of +[], both results become distinct:
strcat([], "anything")  // still returns "" (scilab 6.0-b1) , while
[]+"anything"  // now returns []

This is why *we **could prefer from strcat([]) or strcat([], "anything") 
now to return [] instead of ""*.
What's your opinion about this?

Moreover, most of string functions processing [] *already* return [] : 
*convstr([]) => [], string([]) => [], etc*.

If the behavior of strcat([]) is changed, this should not depend on the 
oldEmptyBehaviour flag.

Best regards

Alain Lamy and Samuel Gougeon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20160309/8d410bd8/attachment.htm>


More information about the dev mailing list