Hi internals

After Levis email yesterday we discussed his suggestions in private. I
did some investigation and did find a way to reuse the current switch
syntax. The main problem of the ambiguity was the empty switch
statement vs expression:

```
// Could be a switch expression or a switch statement with an empty
statement (;)
switch ($x) {};
```

Disallowing the switch expression to be empty solves the ambiguity.

```
// This code throws a parser error
$x = switch ($y) {};
```

It's not optimal but everything else will require significant changes
in the grammar and have other downsides. I updated the RFC
accordingly.

Ilija

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

Reply via email to