thekid/rfc — Issue #212: ???
Author: thekid
Created: 2011-10-10 16:05:50+00:00
State: open
Labels: language

Inspired by http://jashkenas.github.com/coffee-script/ and http://groovy.codehaus.org/Operators#Operators-SafeNavigationOperator%28%3F.%29 and the `ifsetor` discussion on PHP-Internals, add the following:

Isset
------
```xp
// Equivalent of if (isset($param)) { ... }
if ($param?) { ... }

// Equivalent of if (isset($hash[$key])) { ... }
if ($hash[$key]?) { ... }
```

Null-Safe Object Operator
----------------------------------
```xp
// Equivalent of isset($url) ? $url.getParam('p') : null;
$url?.getParam('p');
```

The Existential Operator
--------------------------------
```xp
// Equivalent of NULL === ($__r= @$hash[$key]) ? $default : $__r;
return $hash[$key] ?? $default;
```