> On Oct 20, 2019, at 7:08 PM, Kosit Supanyo <webdevxp....@gmail.com> wrote:
> 
> Yes because they are statements, that's the point which I've stated many 
> times.

And I am suggesting that a block-enclose expression should not be limited to 
expressions only, but instead be able to use statements in the future. Using 
commas ensures we can never go that route.

> And if your argument is that there's no place in PHP that uses commas within 
> curly braces, you're wrong. PHP already has one.
> 
> use X\Y\Z\{
>     A,
>     B,
>     C,
> };

You have a point. 

But that use-case is not a block, it is an obscure short-hand syntax for which 
nothing else in PHP is similar. I would not expect we should use it as a model 
unless it were for a very similiar thing.

> if you did do some researches

Seriously? 

> you might not think they are inconsistent at all. In fact I'd already gave 
> you some examples in previous reply (C#, Rust).

I did not state it before because I did not want to spend time on things I felt 
were irrelevant but the fact another language uses syntax does not make it 
appropriate for PHP. What makes it appropriate for PHP is "feel", consistency, 
and how sigils are already being used, and how they might be used in the future.

But I am not saying you do not look to other language for inspiration. What I 
am saying is you cannot look to other languages for validation, at least not in 
a vacuum. 

> No one is limiting anything. ... If you think that anything inside curly 
> braces must be separated by semicolon,

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,
};
What if in the future PHP implements variadic syntax for assigning to arrays, 
e.g. $var = 1,2,3 where $var could satisfy a $variadic parameter set of 
parameters w/o requiring `...`?   If PHP embraces that — note GoLang has 
something similar — then will comma syntax allow for it with hacky use of 
parentheses?
$y =  switch ($x) {
   case 1  => $var = 1,2,3, $var[1],
   case -1  => $var = 9,8,7, $var[1],
   default => null,
};

> That's because `throw` do different thing at the engine level not just 
> jumping things like `break`, `continue` or `goto`.

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

> If `break` is allowed in switch-expressions and its behavior is to break 
> outer loop, don't you think it could be an another inconsistency or 
> confusion? Because I'm 100% sure when people see `break` within `switch` 
> they'll all think it should break `switch` not something else.

No.  I would assume the other, so I have to assume I would not be the only one.

> you are the one that limit yourself.

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?


-MIke
P.S. And I do not mean my input is needed for PHP to be the best it can be but 
only that having different opinions debated in a reasoned manner tends to make 
for a better outcome.

Reply via email to