5 ms·
> C++, Java, JavaScript, C#, PHP and who knows how many other languages largely copied the operator precedence rules of C Ok, that's understandable for C++, bu
by rob74 7y ago
> C++, Java, JavaScript, C#, PHP and who knows how many other languages largely copied the operator precedence rules of C
Ok, that's understandable for C++, but for all the other languages I really wonder what the reasoning behind this (if any) was - "our language looks similar to C, so we have to copy as many of its warts as possible so C developers feel at home" ?
- karatestomp 7y agoPHP, at least, is (or used to be, I've been out of that world for... oh wow, a long time now) a really thin layer over C, so that's its excuse.
- uk_programmer 7y agoThey all use the C like syntax (with the exception of PHP, PHP is a bit of a mix tbh). Sometimes it is better to keep with convention rather than change it even though it is considered incorrect.
- ErikCorry 7y agoDart just went ahead and fixed the wrong precedence of &. No complaints as far as I know.