On 20 June 2018 at 17:19, Levi Morrison <le...@php.net> wrote: > Bad behavior of existing functions does not mean we should create new > functions with the same bad behavior. If you believe lack of education > regarding array destructuring is an issue then we can use this example > specifically in the docs for these functions; problem solved. >
I'm torn between your point of view and Enno's. Note that we're not talking about "lack of education regarding array destructuring", because there's no array being destructured; we're talking about "lack of education regarding the side-effect behaviour of the array destructuring operator when given a non-array input". It's a pretty obscure, seemingly undocumented, language feature, and one which the RFC you linked seems to have originally classed as unwanted behaviour. If it was used in a prominent example, maybe other uses for this idiom might start cropping up, and people would start using it. Even so, if I saw it while reviewing or debugging code, I would probably be tempted to refactor it to something "less clever" so that the intent was clearer. On balance, I don't think the example you gave is a compelling reason, on its own, to go with your suggested signature. The separate functions feel more convenient in a lot of cases, but maybe less so in others. Regards, -- Rowan Collins [IMSoP]