En mar, 19 may 2020 08:53:46 +0200 Manuel Canga
escribió
>
> Hi, Internals,
>
>
>
> En dom, 17 may 2020 06:33:51 +0200 Peter Stalman
> escribió
> > A few thoughts:
> >
> >
> > 1. I agree with the sentiment that this syntactic sugar doesn't
> >
Hi, Internals,
En dom, 17 may 2020 06:33:51 +0200 Peter Stalman
escribió
> A few thoughts:
>
>
> 1. I agree with the sentiment that this syntactic sugar doesn't
> actually save any verbosity, so it's not really syntactic sugar at
> all.
>
>
> 2. There appears to now
A few thoughts:
1. I agree with the sentiment that this syntactic sugar doesn't
actually save any verbosity, so it's not really syntactic sugar at
all.
2. There appears to now be another RFC by Pavel Patapau, specifically
focused on a Guard statement as a new keyword
Hi internals,
I think it's just as good to write:
if ($condition) return $retval;
Yes, there are subtle semantic differences the new syntax would emphasize, but
it doesn't feel like it justifies it. New syntax also means the need to support
it, for IDEs and other tools, static analysis tools,
Hello,
Not it's not and will likely never be so using `guard` is a really bad idea.
Best regaeds,
Benas Seliuginas
Benas,
> On May 15, 2020, at 04:33, Benas IML wrote:
>
> Hey,
>
> `guard` would be a keyword this means that all of the classes, interfaces and
> traits named Guard would be illegal. Therefore Laravel's `Guard` interface
> would be incompatible with PHP 8 which in turn means thousands of web
Hey,
`guard` would be a keyword this means that all of the classes, interfaces
and traits named Guard would be illegal. Therefore Laravel's `Guard`
interface would be incompatible with PHP 8 which in turn means thousands of
web applications would be too.
Best regards,
Benas Seliuginas
Le Sun, 10 May 2020 10:49:15 -0500,
Ralph Schindler a écrit :
> The chosen syntax is:
>
>return if ( if_expr ) [: optional_return_expression] ;
>
> As a contrived example:
>
> function divide($dividend, $divisor = null) {
> return if ($divisor === null || $divisor === 0);
>
I just think that this way is more compatible witth the reading. "Return X
if Y" seems better than "return (if) X: (then) Y". Too the ":" could
conflicts with return type.
Em dom, 10 de mai de 2020 16:59, Ralph Schindler
escreveu:
>
>
> On 5/10/20 1:56 PM, David Rodrigues wrote:
> > Suggestion:
Hi Ralph,
Like others, I think this feels too narrow in its scope, and doesn't add
enough over existing syntax.
You mention that Ruby has a similar feature, but there it's not a
special syntax for guard clauses per se, but a "modifier" form of the if
statement:
Benas,
> On May 10, 2020, at 15:19, Benas IML wrote:
>
> Hello,
>
> I think that we SHOULD not introduce a new keyword (e. g. guard) since that
> would be a "major major" backwards incompatibility. "Guard" is a really
> generic
> word and a great example of that is Laravel and their
On 5/10/20 1:56 PM, David Rodrigues wrote:
Suggestion:
return if $x > 1; (to return "void")
return $y if ($x > 1 && $x < 5);
break if $x > 1;
break 2 if $x > 1;
throw new Exception if $x > 1;
100% that will/should be a votable alternative option should this get to
the voting phase.
I
This proposal looks way too specific to me. I'm a big fan of returning
early -- but also of throwing early, breaking early and continuing
early. Supporting this just for returns seems odd / inconsistent to me.
I agree with this sentiment, and I'll update the PR accordingly and this
will be
Hello,
I think that we SHOULD not introduce a new keyword (e. g. guard) since that
would be a "major major" backwards incompatibility. "Guard" is a really
generic
word and a great example of that is Laravel and their authentication guards.
In general, I don't think that early returns require a
Suggestion:
return if $x > 1; (to return "void")
return $y if ($x > 1 && $x < 5);
break if $x > 1;
break 2 if $x > 1;
throw new Exception if $x > 1;
Em dom, 10 de mai de 2020 15:48, Nikita Popov
escreveu:
> On Sun, May 10, 2020 at 5:49 PM Ralph Schindler
> wrote:
>
> > Hi!
> >
> >
> > #
On Sun, May 10, 2020 at 5:49 PM Ralph Schindler
wrote:
> Hi!
>
>
> # Intro
>
> I am proposing what is a near completely syntactical addition (only
> change is to language.y) to the language. The best terminology for this
> syntax is are: `return if`, "return early", or "guard clauses".
>
>
Am 10.05.20 um 18:26 schrieb John Bafford:
Hi Ralph,
On May 10, 2020, at 11:49, Ralph Schindler wrote:
Hi!
# Intro
I am proposing what is a near completely syntactical addition (only change is to language.y) to the
language. The best terminology for this syntax is are: `return if`,
On Sun, 10 May 2020 at 17:49, Ralph Schindler
wrote:
> Hi!
>
>
> # Intro
>
> I am proposing what is a near completely syntactical addition (only
> change is to language.y) to the language. The best terminology for this
> syntax is are: `return if`, "return early", or "guard clauses".
>
>see:
Hi Ralph,
> On May 10, 2020, at 11:49, Ralph Schindler wrote:
>
> Hi!
>
>
> # Intro
>
> I am proposing what is a near completely syntactical addition (only change is
> to language.y) to the language. The best terminology for this syntax is are:
> `return if`, "return early", or "guard
19 matches
Mail list logo