Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-11 Thread Rowan Collins
On 11 September 2014 04:02:43 GMT+01:00, Park Framework wrote: >> You know, “int”, “float”, “string” etc. aren’t currently reserved >words. Well, they are in the context of casts: $a = (int)'42'; $a = (string)42; etc > We could add functions, or even make them reserved words and add >internal

Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-10 Thread Park Framework
> You know, “int”, “float”, “string” etc. aren’t currently reserved words. We > could add functions, or even make them reserved words and add internal > functions (à la isset), so int(‘2’), float(‘2.0’), string(‘test’) etc. > > Or perhaps class-like constructors? $a = new int('2'); ? Would kinda

Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-10 Thread Andrea Faulds
On 10 Sep 2014, at 18:41, Rowan Collins wrote: > I think this came up during the previous discussion, and I actually think it > would be quite nice to have some functions both to perform a "strict"/"safe" > cast (and raise E_CATCHABLE_ERROR or perhaps throw TypeCastException), and to > check

Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-10 Thread Rowan Collins
Michael Wallner wrote (on 10/09/2014): .oO(ext/filter) ? Maybe I'm just missing some better documentation, but my main problems with ext/filter are: 1) Many users don't know it exists, or how to use it. 2) It's pretty verbose and complex for such a simple task as "is this thing a valid inte

Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-10 Thread Michael Wallner
On 10/09/14 19:41, Rowan Collins wrote: > Andrea Faulds wrote (on 09/09/2014): >> If people want strict casting, we can add new functions or operators >> for that specifically. > > I think this came up during the previous discussion, and I actually > think it would be quite nice to have some funct

Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-10 Thread Rowan Collins
Andrea Faulds wrote (on 09/09/2014): If people want strict casting, we can add new functions or operators for that specifically. I think this came up during the previous discussion, and I actually think it would be quite nice to have some functions both to perform a "strict"/"safe" cast (and

Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-09 Thread Mike Willbanks
> Hi! > > > No, no it would not. PHP’s explicit casts cannot fail, and there is > > absolutely no good reason to change this. If people want strict > > casting, we can add new functions or operators for that specifically. > > But to break explicit casts and make them sometimes fail would cause > >

Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-09 Thread Stas Malyshev
Hi! > No, no it would not. PHP’s explicit casts cannot fail, and there is > absolutely no good reason to change this. If people want strict > casting, we can add new functions or operators for that specifically. > But to break explicit casts and make them sometimes fail would cause > innumerable b

Re: [PHP-DEV] make casts more strict in PHP 7

2014-09-09 Thread Andrea Faulds
On 9 Sep 2014, at 20:26, Robert Stoll wrote: > Personally, I do not like such inconsistencies either but I like that the > conversion rules in Andrea's RFC are more strict. And thus I was asking > myself if it would not make sense to change the current behaviour of > castings and make them more