Re: proposed access modifier "silent" ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

From: Date: Mon, 11 Apr 2011 12:52:09 +0000
Subject: Re: proposed access modifier "silent" ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-51862@lists.php.net to get a copy of this message
If doing the suppression of undefined notices be better if the ? was put after the opening square bracket, thereby removing the ambiguity (which I think would be more troublesome than you think)? $array[?"foo"]
I suppose a non-array-specific version would be to put it after the $. $?variable $?array['foo']['bar'] I wonder if you could even use : with this syntax. $?variable:"default" $?array['foo']['bar']:"default" Perhaps using it in function definitions is something to consider, too, for a callee-specified undefined-notice-silencing mechanism. function foo($?arg) { } Doesn't work for the variable arguments case, though, without resorting to something IMHO ugly/hard-to-read-and-understand like: function foo(?) { } It's another idea to throw in the mix, though. I do think the 'silent' modifier that was the original suggestion in this thread is worth further thought. It may well allow userland functions to be developed, which might be a benefit. I personally, though, think a modified ternary operator like the proposed ??: or the syntax above, is better. Ben.

« previous php.internals (#51862) next »