Hi!

> I think that  `if ($_GET['x']?? === 1)` looks and feels a lot like `if
> (@$_GET['x'] === 1)`...
> 
> Yes, the latter has runtime performance issues and will still send
> notices to error handlers and logs.  But perhaps if we're going to
> extend syntax, the syntax could be something along the lines of:

I'd rather fix @ (or make another operator like @@ that Sara proposed)
to make nullsafe access - and maybe even extend it to full expression
like isset/empty does - so I could do something like
@$foo['bar']->blah->foo['bah'] and have it mean "try to fetch the whole
chain and if something is missing on the way return null". I kinda get
the argument for PHP not doing it by default, though I personally could
live with that too ;) - but I still need this thing quite frequently
when dealing with all kinds of dirty data.

With trailing ?? it is not clear how it would chain, and even if it
chains having something at the end that changes how the expression is
interpreted is both confusing and may be very hard for the parser.

-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to