Re: [RFC] [DISCUSSION] Scalar Pseudo-type

From: Date: Fri, 29 Dec 2017 17:30:27 +0000
Subject: Re: [RFC] [DISCUSSION] Scalar Pseudo-type
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-101448@lists.php.net to get a copy of this message
Am 29.12.2017 um 18:24 schrieb Fleshgrinder:
On 12/29/2017 6:21 PM, lists@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

« previous php.internals (#101448) next »