Hi internals,
I realise we're tight to the deadline but from my calculations,
this RFC should fit with 2w discussion and 2w voting before feature freeze.
The proposal is to allow two statements to skip parentheses so they don't
look like expressions.
This goes to declare
and __halt_compiler
.
Changes have already been implemented and respective PR's are linked to the
RFC.
You can find the RFC at
https://wiki.php.net/rfc/language-constructs-syntax-changes
There is no BC break!
Proposed changes only allow certain constructs to be considered valid.
Cheers,
Michał Marcin Brzuchalski
On Sun, Jul 5, 2020 at 9:36 AM Michał Marcin Brzuchalski <
michal.brzuchalski@gmail.com> wrote:
Hi internals,
I realise we're tight to the deadline but from my calculations,
this RFC should fit with 2w discussion and 2w voting before feature freeze.The proposal is to allow two statements to skip parentheses so they don't
look like expressions.
This goes todeclare
and__halt_compiler
.
Changes have already been implemented and respective PR's are linked to the
RFC.You can find the RFC at
https://wiki.php.net/rfc/language-constructs-syntax-changesThere is no BC break!
Proposed changes only allow certain constructs to be considered valid.
I don't think introducing alternative syntax for declare and halt_compiler
is a good idea. It introduces two ways to write the same thing, without
much benefit I can see.
Your stated goal is to make it clearer that these aren't functions, but
language constructs. I'm not sure your change helps that much: While
"__halt_compiler()" looks like a function call, "__halt_compiler" looks
like a constant lookup. For the declare syntax, "declare(a = 1)" is already
illegal syntax for functions, even with the parentheses.
Regards,
Nikita
Hi Nikita,
pon., 13 lip 2020 o 12:41 Nikita Popov nikita.ppv@gmail.com napisał(a):
On Sun, Jul 5, 2020 at 9:36 AM Michał Marcin Brzuchalski <
michal.brzuchalski@gmail.com> wrote:Hi internals,
I realise we're tight to the deadline but from my calculations,
this RFC should fit with 2w discussion and 2w voting before feature
freeze.The proposal is to allow two statements to skip parentheses so they don't
look like expressions.
This goes todeclare
and__halt_compiler
.
Changes have already been implemented and respective PR's are linked to
the
RFC.You can find the RFC at
https://wiki.php.net/rfc/language-constructs-syntax-changesThere is no BC break!
Proposed changes only allow certain constructs to be considered valid.I don't think introducing alternative syntax for declare and halt_compiler
is a good idea. It introduces two ways to write the same thing, without
much benefit I can see.Your stated goal is to make it clearer that these aren't functions, but
language constructs. I'm not sure your change helps that much: While
"__halt_compiler()" looks like a function call, "__halt_compiler" looks
like a constant lookup. For the declare syntax, "declare(a = 1)" is already
illegal syntax for functions, even with the parentheses.
I can agree with "__halt_compiler;" similar to constant lookup, which
indeed does not mate it more clear.
Regarding the second syntax for "declare" what I wanted to achieve is
reduce the number of different syntaxes and we do have quite a few in PHP.
I've noticed that the "declare" syntax is quite similar to the const
declare if you simply remove parentheses,
which therefore IMO increases readability, consider this example:
declare strict_types = 1;
const GEAR_LIMIT = 5;
From parser perspective, these both use const_list and only differ by a
first keyword and looks similar and present the same syntax construct.
Which currently is not true and they're both presented as a different
syntax.
By introducing an alternative syntax I planned to deprecate the old as soon
as we could potentially do that.
I believe it'd be hard until we have ticks directive.
Cheers,
Michał Marcin Brzuchalski
Hey Michał,
Personally, I think instead of making declare(strict_types=1);
to look
more like a constant, we should make it look more like a function.
Since it seems that the named parameters RFC is going to be accepted, I
think allowing for alternative declare(strict_types: 1);
syntax would
make much more sense.
Best regards,
Benas
On Mon, Jul 13, 2020, 2:08 PM Michał Marcin Brzuchalski <
michal.brzuchalski@gmail.com> wrote:
Hi Nikita,
pon., 13 lip 2020 o 12:41 Nikita Popov nikita.ppv@gmail.com napisał(a):
On Sun, Jul 5, 2020 at 9:36 AM Michał Marcin Brzuchalski <
michal.brzuchalski@gmail.com> wrote:Hi internals,
I realise we're tight to the deadline but from my calculations,
this RFC should fit with 2w discussion and 2w voting before feature
freeze.The proposal is to allow two statements to skip parentheses so they
don't
look like expressions.
This goes todeclare
and__halt_compiler
.
Changes have already been implemented and respective PR's are linked to
the
RFC.You can find the RFC at
https://wiki.php.net/rfc/language-constructs-syntax-changesThere is no BC break!
Proposed changes only allow certain constructs to be considered valid.I don't think introducing alternative syntax for declare and
halt_compiler
is a good idea. It introduces two ways to write the same thing, without
much benefit I can see.Your stated goal is to make it clearer that these aren't functions, but
language constructs. I'm not sure your change helps that much: While
"__halt_compiler()" looks like a function call, "__halt_compiler" looks
like a constant lookup. For the declare syntax, "declare(a = 1)" is
already
illegal syntax for functions, even with the parentheses.I can agree with "__halt_compiler;" similar to constant lookup, which
indeed does not mate it more clear.Regarding the second syntax for "declare" what I wanted to achieve is
reduce the number of different syntaxes and we do have quite a few in PHP.
I've noticed that the "declare" syntax is quite similar to the const
declare if you simply remove parentheses,
which therefore IMO increases readability, consider this example:declare strict_types = 1;
const GEAR_LIMIT = 5;From parser perspective, these both use const_list and only differ by a
first keyword and looks similar and present the same syntax construct.
Which currently is not true and they're both presented as a different
syntax.By introducing an alternative syntax I planned to deprecate the old as soon
as we could potentially do that.
I believe it'd be hard until we have ticks directive.Cheers,
Michał Marcin Brzuchalski
The proposal is to allow two statements to skip parentheses so they don't
look like expressions.
I like small improvements like this one. They may not look like much but
they do add up to arrive at a cleaner language in the long run.
However, I do think the RFC should also propose to deprecate the current
syntax. Having two competing types of syntax is probably worse than
having one slightly odd syntax.
Regards,
Dik
Hello,
I'm withdrawing the RFC since there is not much interest in it.
Cheers,
Michał
niedz., 5 lip 2020 o 09:35 Michał Marcin Brzuchalski <
michal.brzuchalski@gmail.com> napisał(a):
Hi internals,
I realise we're tight to the deadline but from my calculations,
this RFC should fit with 2w discussion and 2w voting before feature freeze.The proposal is to allow two statements to skip parentheses so they don't
look like expressions.
This goes todeclare
and__halt_compiler
.
Changes have already been implemented and respective PR's are linked to
the RFC.You can find the RFC at
https://wiki.php.net/rfc/language-constructs-syntax-changesThere is no BC break!
Proposed changes only allow certain constructs to be considered valid.Cheers,
Michał Marcin Brzuchalski