Am 29.12.2017 um 18:24 schrieb Fleshgrinder:
On 12/29/2017 6:21 PM, li...@rhsoft.net wrote:
no, when i accept "int|float" i don't get something converted at all and
i can handle the cases different - when it#s silently casted to a float
i have no way to know it was a int at call time
Again, obviously, the question remains, why would you care? Please
provide convincing arguments as this would become the body of the
corresponding RFC. Adding that type is super simple, the question is why
is it so super handy?
beause i can insert the value to a int field of a database without
additional costs, because i can write faster code-paths dealing with
integers which don't have all the magic problems of floats and so on
PS: Despite union and intersection types, they automatically allow this
form and I repeat that I am totally in favor of them. The question is
truly about `number` only which would accept `int` and `float` (no
`string`)
nobody needs "number" - the problem is that people downvoted the union
RFC for no good reasons and "i don't see a benefit, i don't like it" are
no valid reasons to do so - and to the other guy which asked why someone
should up-vote for something he don't understand - nobody says that - i
didn't know that voting for each and any RFC is mandatory - so just
ignore it when you don#t care instead downvote
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php