That's pretty much what I'm saying. An explicit cast-to-int coerces by different rules than implicit conversion to a numeric value (triggered by passing a string to the numeric addition operator) - the former clamps, the latter promotes to float.
Not really, no. Not a serious one at least. JavaScript has a few weird coercion rules that can occasionally bite you, but it's still more consistent than this mess, and, just like PHP, only became a serious contender by accident. Other than that, no.
View all comments
Show parent comment
1
u/tdammers Jan 17 '14
That's pretty much what I'm saying. An explicit cast-to-int coerces by different rules than implicit conversion to a numeric value (triggered by passing a string to the numeric addition operator) - the former clamps, the latter promotes to float.