Hi Mike

> Ok, so let's look at a scenario. Will we be able to do this in the future,
> if we decide to allow multiple expressions to result in a final value?
> $y = switch ($x) {
>     case 1 => $arr = get_array(), array_pop($arr),
>     case -1 => $arr = get_array(), array_unshift($arr),
>     default => null,
> };


As I told you in previous reply, I'm working on block-expressions as well.
So if PHP has block-expressions you can do the same this way:

$y = switch ($x) {
    case 1 => eval {
        $arr = get_array();
        give array_pop($arr);
    },
    case -1 => eval {
        $arr = get_array();
        give array_shift($arr);
    },
    default => null,
};

Which is obviously cleaner and more powerful.

Are you saying it is literally impossible given the current engine, or just
> that it has not been done with `break`, `continue` or `goto`?


Yes, it is impossible to break out of an ongoing function call without
exceptions.

Your response makes me think you are responding in anger? I am not arguing
> in anger myself, so I hope that I am not causing you to reply in anger? I
> am merely asking posing technical challenges in hopes to ensure that PHP is
> the best it can be.  I assume we all want that?


No, I was not angry. Just a little bit tired. I appologize making you feel
that way.

Regards

Reply via email to