Re: [PHP-DEV] Optional $limit argument for debug_backtrace()

2011-04-08 Thread Patrick ALLAERT
2011/4/8 Sebastian Bergmann : > Am 04.04.2011 17:22, schrieb Sebastian Bergmann: >> Any thoughts? > >  Are there any objections to applying the latest version of the patch [1] >  to trunk? I still think that debug_backtrace and debug_print_backtrace >  are in need of refactoring but that should be

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Sanford Whiteman
> First post here; been watching for a while though. Same here. Here's my take: [1] I don't like ?? / ? because it is disjunctive with === / ==.. The extra equals sign strengthens equality comparison, while the extra question mark essentially _weakens_ the ternary operator (making it mo

Re: [PHP-DEV] Optional $limit argument for debug_backtrace()

2011-04-08 Thread Sebastian Bergmann
Am 04.04.2011 17:22, schrieb Sebastian Bergmann: > Any thoughts? Are there any objections to applying the latest version of the patch [1] to trunk? I still think that debug_backtrace and debug_print_backtrace are in need of refactoring but that should be kept separate, I think. -- [1] https:

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Ben Schmidt
On 9/04/11 12:45 AM, Martin Scotta wrote: I just feels that !empty($arr['key']) or isset($arr['key']) do not express the real meaning, instead I would choose to write array_key_exists('key', $arr). It may be slower but it clearly express what I meant. I don't like this. array_key_exists will re

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Matt Pelmear
Hello all, First post here; been watching for a while though. IMHO: 1) Implicit isset() checks in ?: would be bad. This would not "silently improve not-so-well written code"; In fact it would make not-so-well written code more difficult to debug. I can't count the number of times I've run across c

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Hannes Landeholm
Operators should have very specific purpose and function... a ternary if statement should just be another way to express a normal if statement. Making the ? operator suppress the not defined error would be a poor compromise, making PHP inconsistent. Then I'd rather have access of non-defined array

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Martin Scotta
I just feels that !empty($arr['key']) or isset($arr['key']) do not express the real meaning, instead I would choose to write array_key_exists('key', $arr). It may be slower but it clearly express what I meant. Regarding the operators, I believe they will do more harm than good. To check if a varia

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Hannes Landeholm
I think "?!" wouldn't work as an operator as it would conflict with ternary comparision + not operator. Also I don't see the point of adding an operator for "empty" as the function/construct itself is pretty confusing and non-useful as you have to memorize all the things that happen to be considere

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Jordi Boggiano
On 08.04.2011 15:19, Rune Kaagaard wrote: > New syntax: > // a) > $a = get_stuff('foo') ?? 42; > > // b) > $a = get_stuff('foo') ?! 42; This is wrong. The "new syntax" is already available since 5.3.0 and is $a = get_stuff('foo') ?: 42; Now I agree with you, it sounds great and

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Rune Kaagaard
Dear Internals I'm very happy that this is getting some attention again. Please allow me to give my 2 cents too. The text below can also be seen nicely formatted at https://gist.github.com/909711. ## Intro ## Isset and IsNotEmpty operators have for sure been a hot topic for several years now and

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Hannes Landeholm
Hi. I like Adam's suggestion _a lot_ however I'd also find a third case very useful. In addition to: * // standard $value = isset($a[$key]) ? $a[$key] : 'Not set'; // new ?? double ternary that performs isset check and omits second expression $value = $a[$key] ?? : 'Not set'; // new ?? d

RE: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Ford, Mike
> -Original Message- > From: Adam Richardson [mailto:simples...@gmail.com] > Sent: 08 April 2011 08:02 > > Indeed. > > The '?' character already is special, so using '??' seems like a > safe, > practical approach. However, I'd prefer maintaining the form of the > standard > ternary oper

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread dukeofgaming
Hi, just to drop an opinion on something I felt natural when reading this: how about a word instead?: $value = 'Not set' unless $a['key']; I think it would be way more readable. Regards, David On Fri, Apr 8, 2011 at 2:02 AM, Adam Richardson wrote: > > > > > >> We need to be careful about cha

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-08 Thread Adam Richardson
> > >> We need to be careful about changing the beahviour of existing > operators. > Indeed. The '?' character already is special, so using '??' seems like a safe, practical approach. However, I'd prefer maintaining the form of the standard ternary operator with the colon ($value = $var['bar'] ?