# new foo()->bar() syntax error : "new" associativity

- Thread: https://externals.io/message/88491
- Original archive: https://news-web.php.net/php.internals/88491
- Started by Yasuo Ohgaki on 2015-09-25T04:12:00+00:00
- Messages: 2
- 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

---

## #88491 — Yasuo Ohgaki — 2015-09-25T04:12:00+00:00

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

Hi all,

https://bugs.php.net/bug.php?id=70549

It seems this is better to be fixed in near future.
Let "new" be associative? Currently, it's syntax error.
Was there discussion for this with
https://wiki.php.net/rfc/uniform_variable_syntax ?

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #88625 — Andrea Faulds — 2015-10-01T20:49:26+00:00

URL: https://externals.io/message/88491#88625 · In reply to: #88491

Hi Yasuo,

Yasuo Ohgaki wrote:
>
> https://bugs.php.net/bug.php?id=70549
>
> It seems this is better to be fixed in near future.
> Let "new" be associative? Currently, it's syntax error.
> Was there discussion for this with
> https://wiki.php.net/rfc/uniform_variable_syntax ?
>

I think that we should keep `new` working the way it does. While some 
other languages do make `new Foo->bar` be `(new Foo)->bar`, I don't 
think that's very intuitive. The whitespace between `new` and the class 
name has made me always read it as `new (Foo->bar)` instead. Continuing 
to require brackets here will mean people don't misinterpret it.

Also, as Nikita noted, there might be compatibility issues.

Thanks.

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