Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Ryan Pallas
On Sat, Sep 19, 2015 at 5:29 PM, Lester Caine wrote: > On 19/09/15 22:56, Rowan Collins wrote: > >>> If what you want to do is avoid the notice, then you don't need to > >>> "find out before calling is_null", you need to call isset *instead > >>> of* is_null. Again, ignore the name, and concentra

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Lester Caine
On 19/09/15 22:56, Rowan Collins wrote: >>> If what you want to do is avoid the notice, then you don't need to >>> "find out before calling is_null", you need to call isset *instead >>> of* is_null. Again, ignore the name, and concentrate on what it >>> actually does. >> BUT ISSET RETURNS FALSE FOR

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Rowan Collins
On 19/09/2015 22:43, Lester Caine wrote: On 19/09/15 22:22, Rowan Collins wrote: If what you want to do is avoid the notice, then you don't need to "find out before calling is_null", you need to call isset *instead of* is_null. Again, ignore the name, and concentrate on what it actually does.

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Lester Caine
On 19/09/15 22:22, Rowan Collins wrote: > If what you want to do is avoid the notice, then you don't need to "find out > before calling is_null", you need to call isset *instead of* is_null. Again, > ignore the name, and concentrate on what it actually does. BUT ISSET RETURNS FALSE FOR A VARIABL

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Rowan Collins
On 19 September 2015 15:49:55 BST, Lester Caine wrote: >On 19/09/15 13:15, Rowan Collins wrote: >If there was a bug with 'isset' it is that it returns false for a >variable that IS SET to null. I honestly think that the only problem there is the name. If instead of isset() and empty() we had qui

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread François Laupretre
Le 19/09/2015 20:28, Benoit Schildknecht a écrit : What about the context sensitive lexer ? exists() would be reserved as a function name, but not more than that. You're right. I had been testing it on PHP 5 only. On PHP 7, I just checked that 'isset()' can be used as a method name. So, the B

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Benoit Schildknecht
Le Sat, 19 Sep 2015 19:44:01 +0200, "François Laupretre" a écrit: Le 19/09/2015 14:25, Rowan Collins a écrit : - a syntactic sugar for array_key_exists and property_exists, maybe called hasitem(); hasitem($foo['bar']) would check $foo has the item 'bar', but hasitem($foo) would be an er

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread François Laupretre
Le 19/09/2015 14:25, Rowan Collins a écrit : - a syntactic sugar for array_key_exists and property_exists, maybe called hasitem(); hasitem($foo['bar']) would check $foo has the item 'bar', but hasitem($foo) would be an error The most important, IMO, is a more intuitive, readable alternative

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Lester Caine
On 19/09/15 13:15, Rowan Collins wrote: >> I don't >> >see any 'completely new type of code' ... only a different frame in >> >which the variables are held. > It's "completely new" because you can't do it right now, that's all. > > I'm just trying to separate two different justifications for reque

Re: [PHP-DEV] Coding styles ...

2015-09-19 Thread Rowan Collins
On 19 September 2015 10:48:17 BST, Lester Caine wrote: >I get that a lot of people think that the only way forward with PHP is >fully typed, strict checking and blocking anything that may be deemed >to >be risky. However PHP7 has not yet dropped the simple object-less style >of programming that it

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Rowan Collins
On 19 September 2015 00:04:46 BST, "François Laupretre" wrote: >So, as everyone seems to have exposed his arguments, I think we need an >RFC and a patch now. Unless anyone volunteers, I'll write the patch. >Who >can write the RFC ? Robert ? I may have given the impression of stubbornness in thi

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Rowan Collins
On 18 September 2015 23:16:51 BST, Lester Caine wrote: > I don't >see any 'completely new type of code' ... only a different frame in >which the variables are held. It's "completely new" because you can't do it right now, that's all. I'm just trying to separate two different justifications for r

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Rowan Collins
On 19 September 2015 09:36:12 BST, Lester Caine wrote: > I first hit this particular one becuase of notices >appearing on what had been clean code. And NO switching off those >notices is not the right fix, but it is the ONLY fix at the moment. Please show me an example where isset() gives a notic

[PHP-DEV] Coding styles ...

2015-09-19 Thread Lester Caine
I get that a lot of people think that the only way forward with PHP is fully typed, strict checking and blocking anything that may be deemed to be risky. However PHP7 has not yet dropped the simple object-less style of programming that it originally developed from. That is why tidying up a simple p

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Lester Caine
On 19/09/15 00:20, Stanislav Malyshev wrote: >> element exists will send you to hell." won't change anything. People >> > currently writing 'isset($foo['bar'])' won't change it for >> > 'array_key_exists('bar',$foo)'. Just because it is longer, less >> > readable, and you need to remember argument

Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28?

2015-09-19 Thread Lauri Kenttä
On 2015-09-17 11:58, Rowan Collins wrote: Interestingly, ... there's no way I know of to detect if a parameter was omitted from your function call rather than passed an explicit null; There is! It's called func_num_args, and it's very ugly. -- Lauri Kenttä -- PHP Internals - PHP Runtime Devel