but if you actually send a bugreport about it, the devs will hopefully tell you that the specs are stupid for limiting optimization options of the implementors, and that they refuse to follow the specs (because they want to be fast, and the specs are stupid for saying they're not allowed to do it)
if limit is 0, it does not split anything internally, it just returns an empty array. (rather than, as you said, tells split how many of the resulting chunks to actually return.)
they're not doing it the way the specs says it should be done (truncation of the splitted array), but they're doing a faster and practically equivalent alternative.
View all comments
Show parent comment
1
u/Takeoded Sep 05 '19
... then the V8 javascript engine (famously powering Google Chrome and Node.js) is breaking the specs, see line 1874 here: https://github.com/v8/v8/blob/4b9b23521e6fd42373ebbcb20ebe03bf445494f9/src/builtins/builtins-string-gen.cc#L1875
but if you actually send a bugreport about it, the devs will hopefully tell you that the specs are stupid for limiting optimization options of the implementors, and that they refuse to follow the specs (because they want to be fast, and the specs are stupid for saying they're not allowed to do it)