Where in the V8 source does the automatic cast for BinaryOperation occour?
0
I stumbled again in the good old '12' + 2 = '122' I wanted to deeply understand what happens here, so my first thesis was that Maybe Javascript casts the right operand to the type of the first one and then operates, like so: '12' + String(2) = '122' all good... But no, because 12 + '2' = '122' too; So the engine's magic is clearly favoring to concat over casting to number. My second thesis was then Maybe the engine enumerates all operands and looks for an "operator override", similar to C#? And then favor executing that over doing the self-magic thing? My confusion got even weirder when I realized that also '5' * '8' = 40 , it casts both operands to Number and does the operation. The only way I could possibly...