# [VOTE] Uniform Variable Syntax

- Thread: https://externals.io/message/75310
- Original archive: https://news-web.php.net/php.internals/75310
- Started by Nikita Popov on 2014-07-07T14:18:19+00:00
- Messages: 18
- RFC: Uniform Variable Syntax (Implemented (PHP 7.0)) — https://externals.io/rfc/uniform_variable_syntax.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #75310 — Nikita Popov — 2014-07-07T14:18:19+00:00

URL: https://externals.io/message/75310#75310

Hi internals!

I've started the vote on the Uniform Variable Syntax RFC:

    https://wiki.php.net/rfc/uniform_variable_syntax#vote

You can review the discussion about this RFC here:

    http://markmail.org/message/mr4ihbubfbdxygci

The vote requires a 2/3 majority and is planned to end on 2014-07-14. The
RFC targets PHP 6.

Thanks,
Nikita

---

## #75314 — Laruence — 2014-07-07T14:42:34+00:00

URL: https://externals.io/message/75310#75314 · In reply to: #75310

Hey:



> Hi internals!
>
> I've started the vote on the Uniform Variable Syntax RFC:
>
>     https://wiki.php.net/rfc/uniform_variable_syntax#vote
>
> You can review the discussion about this RFC here:
>
>     http://markmail.org/message/mr4ihbubfbdxygci
>
> The vote requires a 2/3 majority and is planned to end on 2014-07-14. The
> RFC targets PHP 6.


sorry for didn't read the RFC before,

but I can not vote for yes.. here are some words in RFC:

1. "The current patch introduces a new “write context” issue. Namely
($foo)['bar'] = 'baz' will not behave this same was as $foo['bar'] =
'baz'. In the former case an undefined variable notice will be thrown
if $foo does not exist, whereas the latter does not throw a notice."

2. "As these changes only apply to some very rarely used syntax, the
breakage seems acceptable for PHP 6."


I don't think we should introduce a new thing which is not perfect or
"confused".. it looks like we fixed a mess with a new mess.

it make me think we should : "don't fix it until it is broken"

thanks


>
> Thanks,
> Nikita



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #75315 — Andrea Faulds — 2014-07-07T14:46:30+00:00

URL: https://externals.io/message/75310#75315 · In reply to: #75314

> 1. "The current patch introduces a new “write context” issue. Namely
> ($foo)['bar'] = 'baz' will not behave this same was as $foo['bar'] =
> 'baz'. In the former case an undefined variable notice will be thrown
> if $foo does not exist, whereas the latter does not throw a notice."
> 
> 2. "As these changes only apply to some very rarely used syntax, the
> breakage seems acceptable for PHP 6."
> 
> 
> I don't think we should introduce a new thing which is not perfect or
> "confused".. it looks like we fixed a mess with a new mess.
> 
> it make me think we should : "don't fix it until it is broken”

We are fixing what is broken here; the variable syntax is counter-intuitive at the moment, and they make the syntax more consistent overall.

Also, parentheses in PHP are always a source of issues. I don’t think they’ll ever quite work properly unless we switch to using an AST-based parser someday.
--
Andrea Faulds
http://ajf.me/

---

## #75316 — Laruence — 2014-07-07T14:54:18+00:00

URL: https://externals.io/message/75310#75316 · In reply to: #75315

>
> 
>
> > […]
>
> We are fixing what is broken here; the variable syntax is counter-intuitive at the moment, and they make the syntax more consistent overall.
>
> Also, parentheses in PHP are always a source of issues. I don’t think they’ll ever quite work properly unless we switch to using an AST-based parser someday.

then we won't need to temporarily fix it..

anyway, it's just my 2 cents

thanks
> --
> Andrea Faulds
> http://ajf.me/
>
>
>
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #75317 — Laruence — 2014-07-07T15:03:18+00:00

URL: https://externals.io/message/75310#75317 · In reply to: #75315

Hey:


>
> 
>
> > […]
>
> We are fixing what is broken here; the variable syntax is counter-intuitive at the moment, and they make the syntax more consistent overall.
>
> Also, parentheses in PHP are always a source of issues. I don’t think they’ll ever quite work properly unless we switch to using an AST-based parser someday.

    I've change my opinion.....

    I will vote for yes...

thanks
> --
> Andrea Faulds
> http://ajf.me/
>
>
>
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #75319 — Ivan Enderlin @ Hoa — 2014-07-07T15:11:44+00:00

URL: https://externals.io/message/75310#75319 · In reply to: #75316

> 
> > […]
> then we won't need to temporarily fix it..
>
> anyway, it's just my 2 cents
While I deeply agree with you (introducing something we will need to fix 
later is not a good idea), this RFC fixes a lot of real, concrete and 
immediate issues that are blocking for the emergence of new tools (for 
example, a grammar of PHP that can be used by AST-compliant tools). 
Moreover, it defines a clear base for the semantics of variables. Known 
issues are well-spotted and define the very next steps of the work. 
Parentheses are interpreted in various ways according to the language 
and the area. Thus, a lot of (smart and calm) discussions will be 
required. However, this RFC is targeting PHP6 (and not 7… just kidding… 
or not… o_O), so we have time to fix the next spotted issues before the 
final release. Let's cut the giant task into small ones. I think this is 
the approach of Nikita since he has honestly exposed the known issues.

Cheers :-).

-- 
Ivan Enderlin
Developer of Hoa
http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/

Member of HTML and WebApps Working Group of W3C
http://w3.org/

---

## #75320 — Ferenc Kovacs — 2014-07-07T15:14:07+00:00

URL: https://externals.io/message/75310#75320 · In reply to: #75310

> Hi internals!
>
> I've started the vote on the Uniform Variable Syntax RFC:
>
>     https://wiki.php.net/rfc/uniform_variable_syntax#vote
>
> You can review the discussion about this RFC here:
>
>     http://markmail.org/message/mr4ihbubfbdxygci
>
> The vote requires a 2/3 majority and is planned to end on 2014-07-14. The
> RFC targets PHP 6.
>
> Thanks,
> Nikita
>

Hi,

just a small note, there is an empty todo block which probably should be
removed:
https://wiki.php.net/rfc/uniform_variable_syntax#todo

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

---

## #75337 — Derick Rethans — 2014-07-08T14:48:32+00:00

URL: https://externals.io/message/75310#75337 · In reply to: #75310

> Hi internals!
> 
> I've started the vote on the Uniform Variable Syntax RFC:
> 
>     https://wiki.php.net/rfc/uniform_variable_syntax#vote
> 
> You can review the discussion about this RFC here:
> 
>     http://markmail.org/message/mr4ihbubfbdxygci
> 
> The vote requires a 2/3 majority and is planned to end on 2014-07-14. The
> RFC targets PHP 6.

I've just voted "no" for this, because it introduces a tiny BC break. 
Now, I realize this is a tiny BC break, but it is just *those* that 
drive people nuts when upgrading. There is so much non-public code - a 
cursor check of Symfony and ZF is not representative.

cheers,
Derick

---

## #75338 — Andrea Faulds — 2014-07-08T14:51:00+00:00

URL: https://externals.io/message/75310#75338 · In reply to: #75337

> I've just voted "no" for this, because it introduces a tiny BC break. 
> Now, I realize this is a tiny BC break, but it is just *those* that 
> drive people nuts when upgrading. There is so much non-public code - a 
> cursor check of Symfony and ZF is not representative.

It is a tiny BC break and it’s for PHP NEXT (i.e 6 or 7), not 5.6. Why not? It’s a tiny change which will bother some people but make everyone else’s life easier.
--
Andrea Faulds
http://ajf.me/

---

## #75342 — Pierre Joye — 2014-07-08T16:48:36+00:00

URL: https://externals.io/message/75310#75342 · In reply to: #75338

>
> 
>
> > […]
>
> It is a tiny BC break and it’s for PHP NEXT (i.e 6 or 7), not 5.6. Why not? It’s a tiny change which will bother some people but make everyone else’s life easier.

Voted +1, obviously for having that in php6, not 5.7. This tiny BC is
then more than OK.

Cheers,
-- 
Pierre

@pierrejoye | http://www.libgd.org

---

## #75345 — Kris Craig — 2014-07-08T23:06:14+00:00

URL: https://externals.io/message/75310#75345 · In reply to: #75342

> 
> > […]
> not? It’s a tiny change which will bother some people but make everyone
> else’s life easier.
>
> Voted +1, obviously for having that in php6, not 5.7. This tiny BC is
> then more than OK.
>
> Cheers,
> --
> Pierre
>
> @pierrejoye | http://www.libgd.org
>
> --
> 
> 
>
>
Also +1.  Major version increments always have BC breaks, and not just tiny
ones, either.

--Kris

---

## #75349 — Julien Pauli — 2014-07-09T21:04:51+00:00

URL: https://externals.io/message/75310#75349 · In reply to: #75345

> 
>
> > […]
> Also +1.  Major version increments always have BC breaks, and not just tiny
> ones, either.

+1 as well.

For a next major, every tip making things cleaner is welcome, and this
is little BC.

Julien

---

## #75485 — Nikita Popov — 2014-07-14T16:35:08+00:00

URL: https://externals.io/message/75310#75485 · In reply to: #75310

> Hi internals!
>
> I've started the vote on the Uniform Variable Syntax RFC:
>
>     https://wiki.php.net/rfc/uniform_variable_syntax#vote
>
> You can review the discussion about this RFC here:
>
>     http://markmail.org/message/mr4ihbubfbdxygci
>
> The vote requires a 2/3 majority and is planned to end on 2014-07-14. The
> RFC targets PHP 6.
>

The vote closed with 30 in favor and 1 against, as such the RFC is accepted.

I will delay merging the patch until the situation regarding phpng and PHP
6 is more clear.

Thanks,
Nikita

---

## #75839 — Ferenc Kovacs — 2014-07-22T12:38:07+00:00

URL: https://externals.io/message/75310#75839 · In reply to: #75485

> 
>
> > […]
>
> The vote closed with 30 in favor and 1 against, as such the RFC is
> accepted.
>
> I will delay merging the patch until the situation regarding phpng and PHP
> 6 is more clear.
>
> Thanks,
> Nikita
>

Hi Nikita,

Derick mentioned in his blogpost(
http://derickrethans.nl/uniform-variable-syntax.html) that "You can't
really write a scanner for it, as the code could already have been
converted.".
I know that you posted https://gist.github.com/nikic/ffd019ef78b72934c7cc
which uses PhpParser\Lexer from your PHP-Parser project, so my
understanding was that it is possible to detect those expressions with both
the current php stable version and with the new one containing the
uniform_variable_syntax changes.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

---

## #75841 — Andrea Faulds — 2014-07-22T12:44:33+00:00

URL: https://externals.io/message/75310#75841 · In reply to: #75839

> Derick mentioned in his blogpost(
> http://derickrethans.nl/uniform-variable-syntax.html) that "You can't
> really write a scanner for it, as the code could already have been
> converted.”.

Of course what he said was true, but I’m not sure it’s important. If you scan your code before converting, or you revert to where you were prior to conversion (any project with proper version control should be able to do this) and then scan it, it’s going to work.

--
Andrea Faulds
http://ajf.me/

---

## #75844 — Jannik Zschiesche — 2014-07-22T13:12:50+00:00

URL: https://externals.io/message/75310#75844 · In reply to: #75839

Hi Ferenc,


> 
> 
> 
> 
> > […]
> 
> Hi Nikita,
> 
> Derick mentioned in his blogpost(
> http://derickrethans.nl/uniform-variable-syntax.html) that "You can't
> really write a scanner for it, as the code could already have been
> converted.".
> I know that you posted https://gist.github.com/nikic/ffd019ef78b72934c7cc
> which uses PhpParser\Lexer from your PHP-Parser project, so my
> understanding was that it is possible to detect those expressions with both
> the current php stable version and with the new one containing the
> uniform_variable_syntax changes.


the point Derick was trying to make is that you can’t build a scanner that automatically checks whether you rewrote this particular piece of code already or not.
You can find the code pieces which match the constructs affected by the BC, but the scanner can’t decide, whether they are already fixed (= they are ok as they stand).

Which makes the burden of the update smaller, but you still need to check every match yourself, whether it will (still) work.

(at least I read it like this)

Cheers
Jannik


> 
> -- 
> Ferenc Kovács
> @Tyr43l - http://tyrael.hu

---

## #75850 — Rowan Collins — 2014-07-22T13:47:01+00:00

URL: https://externals.io/message/75310#75850 · In reply to: #75844

Jannik Zschiesche wrote (on 22/07/2014):
> the point Derick was trying to make is that you can’t build a scanner that automatically checks whether you rewrote this particular piece of code already or not.
> You can find the code pieces which match the constructs affected by the BC, but the scanner can’t decide, whether they are already fixed (= they are ok as they stand).

I thought for each ambiguous case whose behaviour would change, there is 
a pair of unambiguous forms (one for each interpretation) which work the 
same under both parsers?

If so, wouldn't it be possible to change every occurrence detected by 
the scanner to the appropriate unambiguous form (even if that is 
technically unnecessary for that particular case); then when you re-ran 
the scanner, it wouldn't find the same ones again?

I'm probably missing a subtlety here, though...
-- 
Rowan Collins
[IMSoP]

---

## #75852 — Andrea Faulds — 2014-07-22T13:56:46+00:00

URL: https://externals.io/message/75310#75852 · In reply to: #75850

> I thought for each ambiguous case whose behaviour would change, there is a pair of unambiguous forms (one for each interpretation) which work the same under both parsers?

That’s correct. For projects you want to run on both PHP 5 and PHP 6, this could be done.

--
Andrea Faulds
http://ajf.me/
