[wx-dev] Re: wxArray::Join and wxArray::Split

Armel Asselin asselin.armel at wanadoo.fr
Fri Jan 19 08:13:17 PST 2007


> AA> for example, i needed to concat list of parameters; which can be of 
> the form
> AA> "a" , "b", "c" or "a,b" , "c"
> AA> both must give "a,b,c" when Join(",") is called... and yes splitting 
> would
> AA> not give the input and it is -intended-.
> AA> [the example above is from ECMAScript 3rd edition]
>
> Wow. So if you pass a parameter containing a comma to a ECMAScript
> function it interprets it as 2 parameters? What a great feature!
in the call: new Function("a", "b", "c",  "return a+b+c"), yes it should be 
equivalent to new Function ("a,b", "c", "return a+b+c").
ECMAScript is used every day by millions of people (ECMAScript is the 
standardized subset of JavaScript, ActionScript...)

> Honestly, this just confirms me in my position: let's leave stuff like
> this to ECMAScript. We use (mainly) C++ and I believe that making the
> program correct is more important than making it cute.
and basically escaping systematically will create other problems: imagine 
that for whatever reason the programmer must Join in several steps, in a 
tree like manner or simply inner+top level, the outer Join(s) must not 
escape the strings and if there is no such option the Join function will 
simply be not usable, leasing the pleasure to the user to code again Join( ) 
by hand.

Armel






More information about the wx-dev mailing list