Should String.prototype.split accept variable arguments optionally?

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Oct 16 11:03:51 PDT 2013


How could change 12+ years of legacy be considered inexpensive ?

Non "highly trained professionals" should be simple things or try to learn
something new that won't hurt, that's why Stack Overflow exists in first
place, to ask for help or explanations about things.

This request sounds to me like "I don't fully understand how `Math.expm1()`
works so please make it simpler" ... legitimate to ask but I would not
expect a language core change because of my lack of knowledge.

With great powers come great responsibilities ... you wanna code? So please
do it right ;-)

(not directed to you and I am sure you got what I mean)

Obviously this is just my personal opinion.

Cheers




On Wed, Oct 16, 2013 at 10:56 AM, Benjamin (Inglor) Gruenbaum <
inglor at gmail.com> wrote:

> On Wed, Oct 16, 2013 at 8:18 PM, Andrea Giammarchi <
> andrea.giammarchi at gmail.com> wrote:
>
> >also, this is the same: `myString.split(/[ -/+]/)`
>
> Yes, that's true, not sure how that works for multi character delimiters.
>
> > maybe it's better to explain those users that knowing RegExp might bring
> benefits for their purpose (coding) ?
>
> This is not the first or last thing in a language that is intended to make
> life easier for users who are not highly trained professionals. I agree
> that the added value is not huge here, but implementation is pretty
> inexpensive and I can see people use this.
>
>
>
> On Wed, Oct 16, 2013 at 8:18 PM, Andrea Giammarchi <
> andrea.giammarchi at gmail.com> wrote:
>
>> also, this is the same:
>>
>> `myString.split(/[ -/+]/)`
>>
>> maybe it's better to explain those users that knowing RegExp might bring
>> benefits for their purpose (coding) ?
>>
>>
>> On Wed, Oct 16, 2013 at 10:14 AM, Andrea Giammarchi <
>> andrea.giammarchi at gmail.com> wrote:
>>
>>> I stopped here
>>>
>>>
>>> On Wed, Oct 16, 2013 at 5:54 AM, Benjamin (Inglor) Gruenbaum <
>>> inglor at gmail.com> wrote:
>>>
>>>>
>>>> ```
>>>>     myString.split(/ |-|\/|\+/g); // this is no fun to read
>>>>
>>>>     myString.split(" ","-","/","+"); // this is easier
>>>>     myString.split([" ","-","/","+"]); // this is also easier.
>>>>
>>>> ```
>>>>
>>>
>>>
>>> easier for who ?
>>>
>>> All I was doing is being sure no double quoting was missing or not
>>> escaped correctly ... also you don't need the g flag and RegExp is much
>>> more powerful than multiple strings
>>>
>>> `myString.split(/before(and|or)?after/);`
>>>
>>> instead of 3 partially repeated nonsense ?
>>>
>>> My 2 cents
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131016/fd4cf226/attachment.html>


More information about the es-discuss mailing list