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

Serge Steer Serge.Steer at inria.fr
Wed Mar 9 20:18:03 CET 2016


Le 09/03/2016 00:48, Samuel Gougeon a écrit :
> 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.
Not exactly the same meaning strcat(strarray,"anything") adds "anything" 
between each element of
strarray strcat("foo","blabla") ->"foo" and not "fooblabla"
So it is ok that strcat([], "anything") returns [] as there is no elements.
Serge
>
> 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?
I do not agree for the reason explained above
> 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
>
>
>
> _______________________________________________
> dev mailing list
> dev at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/dev

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


More information about the dev mailing list