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

2017-12-29 Thread Tony Marston
wrote in message news:4b55eed1-8656-ff70-e4e9-ad5e40213...@rhsoft.net... Am 29.12.2017 um 00:21 schrieb Larry Garfield: Correct. Union types I've always seen presented as offering both union and intersection. There are cases where union is great, and where it's kinda silly. There are case

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

2017-12-29 Thread Fleshgrinder
On 12/29/2017 12:21 AM, Larry Garfield wrote: > On Wednesday, December 27, 2017 3:50:54 AM CST Rowan Collins wrote: >> On 26 December 2017 18:35:29 GMT+00:00, "li...@rhsoft.net" > wrote: >>> Am 26.12.2017 um 19:18 schrieb Larry Garfield: If I may, I think the argument has always been that >>

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

2017-12-29 Thread Rowan Collins
On 29 December 2017 12:08:16 GMT+00:00, Fleshgrinder wrote: >What is the use case for `int|float`? I mean, if f is able to process a >`float` than f is able to process an `int` and since `int` is already >automatically changed to a `float`, well, you're done. I think it is somewhat tedious if we

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

2017-12-29 Thread Fleshgrinder
On 12/29/2017 1:26 PM, Rowan Collins wrote: > On 29 December 2017 12:08:16 GMT+00:00, Fleshgrinder > wrote: >> What is the use case for `int|float`? I mean, if f is able to >> process a `float` than f is able to process an `int` and since >> `int` is already automatically changed to a `float`, wel

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

2017-12-29 Thread li...@rhsoft.net
Am 29.12.2017 um 09:04 schrieb Tony Marston: wrote in message news:4b55eed1-8656-ff70-e4e9-ad5e40213...@rhsoft.net... Am 29.12.2017 um 00:21 schrieb Larry Garfield: Correct.  Union types I've always seen presented as offering both union and intersection.  There are cases where union is great

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

2017-12-29 Thread Stephen Reay
> On 29 Dec 2017, at 19:56, Fleshgrinder wrote: > >> On 12/29/2017 1:26 PM, Rowan Collins wrote: >> On 29 December 2017 12:08:16 GMT+00:00, Fleshgrinder >> wrote: >>> What is the use case for `int|float`? I mean, if f is able to >>> process a `float` than f is able to process an `int` and since

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

2017-12-29 Thread Larry Garfield
On Friday, December 29, 2017 8:20:14 AM CST Stephen Reay wrote: > > On 29 Dec 2017, at 19:56, Fleshgrinder wrote: > >> On 12/29/2017 1:26 PM, Rowan Collins wrote: > >> On 29 December 2017 12:08:16 GMT+00:00, Fleshgrinder > >> > >> wrote: > >>> What is the use case for `int|float`? I mean, if f i

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

2017-12-29 Thread li...@rhsoft.net
Am 29.12.2017 um 13:08 schrieb Fleshgrinder: What is the use case for `int|float`? I mean, if f is able to process a `float` than f is able to process an `int` and since `int` is already automatically changed to a `float`, well, you're done just read the mass of bugreports caused by float answ

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

2017-12-29 Thread Nikita Popov
On Fri, Dec 29, 2017 at 1:08 PM, Fleshgrinder wrote: > On 12/29/2017 12:21 AM, Larry Garfield wrote: > > On Wednesday, December 27, 2017 3:50:54 AM CST Rowan Collins wrote: > >> On 26 December 2017 18:35:29 GMT+00:00, "li...@rhsoft.net" > > wrote: > >>> Am 26.12.2017 um 19:18 schrieb Larry Garfi

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

2017-12-29 Thread li...@rhsoft.net
Am 29.12.2017 um 16:37 schrieb Nikita Popov: Regarding the union type RFCs, from what I remember, one of my personal issues with it were the complex rules involving scalar type unions in weak typing mode. It's non-trivial to decide what a value should be casted to if it does not have the correc

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

2017-12-29 Thread Fleshgrinder
On 12/29/2017 4:37 PM, Nikita Popov wrote: > int|float is the natural type of numeric operations in PHP. Integers > automatically overflow into floating point numbers, so signatures using int > in conjunction with numeric operations are somewhat problematic. > > Having an explicit number type also

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

2017-12-29 Thread Fleshgrinder
On 12/29/2017 4:09 PM, li...@rhsoft.net wrote: > > Am 29.12.2017 um 13:08 schrieb Fleshgrinder: >> What is the use case for `int|float`? I mean, if f is able to process a >> `float` than f is able to process an `int` and since `int` is already >> automatically changed to a `float`, well, you're do

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

2017-12-29 Thread li...@rhsoft.net
Am 29.12.2017 um 18:18 schrieb Fleshgrinder: On 12/29/2017 4:09 PM, li...@rhsoft.net wrote: Am 29.12.2017 um 13:08 schrieb Fleshgrinder: What is the use case for `int|float`? I mean, if f is able to process a `float` than f is able to process an `int` and since `int` is already automatically

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

2017-12-29 Thread li...@rhsoft.net
Am 29.12.2017 um 18:13 schrieb Fleshgrinder: Why exactly is it necessary to support weak mode together with unions and intersections? It is obviously unclear in many situations what should happen, so why not simply bail like in strict mode? is also a good enough way to handle it now as we hav

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

2017-12-29 Thread 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

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

2017-12-29 Thread Markus Fischer
Hi all, On 26.12.17 16:56, Sebastian Bergmann wrote: Am 26.12.2017 um 16:46 schrieb li...@rhsoft.net: would you mind to explain this? "Foo|Bar", "array|string", etc. (still) make no sense to me. "scalar" makes sense to me although it is but an alias for "bool|float|int|string". I followed

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

2017-12-29 Thread li...@rhsoft.net
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,

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

2017-12-29 Thread li...@rhsoft.net
Am 29.12.2017 um 18:29 schrieb Markus Fischer: On 26.12.17 16:56, Sebastian Bergmann wrote: Am 26.12.2017 um 16:46 schrieb li...@rhsoft.net: would you mind to explain this? "Foo|Bar", "array|string", etc. (still) make no sense to me. "scalar" makes sense to me although it is but an alias f

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

2017-12-29 Thread Stephen Reay
> On 30 Dec 2017, at 00:24, Fleshgrinder wrote: > > Again, obviously, the question remains, why would you care? Really, that's what's obvious to you? What's obvious to *me* is that if a method accepts two different types of parameters, you'd want to know which was passed in. -- PHP Internals