Re: [PHP-DEV] New RFC : empty() function

2023-10-31 Thread Kamil Tekiela
Hi Alessandro, I would still advise to just let this empty() construct die a natural death. If you want to change anything, you must remember that it's basically a syntactic sugar for `@!$var` For example if(empty($var)) is just if(@!$var) To change this function would require changing the

Re: [PHP-DEV] New RFC : empty() function

2023-10-31 Thread Alessandro Rosa
Thank you, G.P.B. for editing and for sharing your honest viewpoint. I saw your corrections and already fixed some flaws in the RFC text. I raised issues that are critical on my modest viewpoint. I see languages as an optimal mix between semantics, grammar and performance. The built-in empty()

Re: [PHP-DEV] New RFC : empty() function

2023-10-31 Thread G. P. B.
On Tue, 31 Oct 2023 at 11:23, Alessandro Rosa wrote: > Hi Marcos, > > thanks for feedback. > Could you be clearer about your advice and gimme an example please? > I have edited the RFC content to add highlighting, hopefully you can now use that to improve the RFC text. However, I'm not very

Re: [PHP-DEV] New RFC : empty() function

2023-10-31 Thread Alessandro Rosa
Hi Marcos, thanks for feedback. Could you be clearer about your advice and gimme an example please? Alessandro Il giorno mar 31 ott 2023 alle ore 11:59 Marcos Marcolin < marcolin...@gmail.com> ha scritto: > Hi Alessandro, > > It would be better to add syntax highlighting to the code examples

Re: [PHP-DEV] New RFC : empty() function

2023-10-31 Thread Marcos Marcolin
Hi Alessandro, It would be better to add syntax highlighting to the code examples of your RFC, it is not legal to read/understand the texts as if they were just texts. --- Marcos Marcolin Software Engineer | PHP www.marcosmarcolin.com.br

Re: [PHP-DEV] New RFC : empty() function

2023-10-31 Thread Alessandro Rosa
Hi Mr. Tommins, thank you very much for all your very valuable advices. You can read a more robust discussion about my RFC at https://wiki.php.net/rfc/empty_function Regards, Alessandro Rosa Il giorno lun 30 ott 2023 alle ore 23:54 Rowan Tommins < rowan.coll...@gmail.com> ha scritto: > On

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Rowan Tommins
On 30/10/2023 12:24, Alessandro Rosa wrote: I have posted a new RFC at this link https://wiki.php.net/rfc/empty_function where I suggested some improvements to the standard built-in empty() function and provided a number of examples. Hi, and welcome! First, regarding the clarity of the

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Kamil Tekiela
I would be voting against any function that checks for "empty". The `empty()` construct we have now should almost never be used in any reasonable code. It should be avoided at all cost. For this reason, I see no need to introduce a new variant of the same thing. I also don't believe there is any

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Hamza Ahmad
Hi there, it's a legacy function, and I don't think we can afford or we should consider this bc break. Though I don't use this function myself and also prefer other methods of input validation, still there are a lot of people that use it. Renaming this to is_empty will bring a bc break. However,

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Alessandro Rosa
Thanks everybody for joining this discussion. I appreciated a lot the points you raised, as they are helping me to update and improve my rfc, whose meaning, as I hope, would look clearer than the earlier version. Improvements must be achieved, whatever they would cost. Ambiguities shall be

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread tag Knife
> > This is exactly where the problem lies. Is a string with just whitespace > empty? Why would an ArrayObject with count 0 not be considered to be empty > while an array with count 0 is? "empty" is subjective and therefore not a > reliable function to use. Especially in legacy code I find that

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Alessandro Rosa
Thanks everybody for joining this discussion. I appreciated a lot the points you raised, as they are helping me to update and improve my rfc, whose meaning, as I hope, would look clearer than the earlier version. Alessandro Il giorno lun 30 ott 2023 alle ore 16:36 Lynn ha scritto: > On Mon,

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Lynn
On Mon, Oct 30, 2023 at 4:21 PM tag Knife wrote: > > > > However, according to my example, the variable is defined and has its > > value as 0 or false, and empty() returns true anyway. I confess that > > I've had some problems like this, and we chose not to use empty(), as > > sometimes 0 or

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread tag Knife
> > However, according to my example, the variable is defined and has its > value as 0 or false, and empty() returns true anyway. I confess that > I've had some problems like this, and we chose not to use empty(), as > sometimes 0 or false makes sense as a valid value. > That is exactly as the

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Lynn
On Mon, Oct 30, 2023 at 1:24 PM Alessandro Rosa wrote: > Hi, > > I have posted a new RFC at this link > https://wiki.php.net/rfc/empty_function > where I suggested some improvements to the standard built-in empty() > function and provided a number of examples. > > Thanks, > > Alessandro Rosa >

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Marcos Marcolin
Hello, I understand that the idea of ​​the RFC is about some behaviors of empty(), e.g.: ```php $var = ''; var_dump(empty($var)); // true $var= []; var_dump(empty($var)); // true $var= 0; var_dump(empty($var)); // true var_dump(empty($empty)); // true $var= true; var_dump(empty($var)); //

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Aleksander Machniak
On 30.10.2023 13:24, Alessandro Rosa wrote: Hi, I have posted a new RFC at this link https://wiki.php.net/rfc/empty_function where I suggested some improvements to the standard built-in empty() function and provided a number of examples. Forget about deprecating empty(). No chance I'd vote

Re: [PHP-DEV] New RFC : empty() function

2023-10-30 Thread Kamil Tekiela
Hi, I don't understand what you are proposing and what problem you are trying to fix. The RFC is not explaining things well.