# [RFC] [Discussion] Allow a trailing comma in function calls

- Thread: https://externals.io/message/100837
- Original archive: https://news-web.php.net/php.internals/100837
- Started by Sammy Kaye Powers on 2017-10-07T18:34:12+00:00
- Messages: 5
- RFC: Allow a trailing comma in function calls (Implemented (PHP 7.3)) — https://externals.io/rfc/trailing-comma-function-calls.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

---

## #100837 — Sammy Kaye Powers — 2017-10-07T18:34:12+00:00

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

Hello internals friends!

The RFC to allow a trailing comma in function calls is up for discussion:

https://wiki.php.net/rfc/trailing-comma-function-calls

Summary:

- Targets PHP 7.3
- The previous vote on this combined function calls & declarations in
the same vote (my bad!)
- This RFC affects function calls only, not declarations

Thanks,
Sammy Kaye Powers
sammyk.me

---

## #100934 — Peter Cowburn — 2017-10-24T15:37:58+00:00

URL: https://externals.io/message/100837#100934 · In reply to: #100837

> Hello internals friends!
>
> The RFC to allow a trailing comma in function calls is up for discussion:
>
> https://wiki.php.net/rfc/trailing-comma-function-calls
>
> Summary:
>
> - Targets PHP 7.3
> - The previous vote on this combined function calls & declarations in
> the same vote (my bad!)
> - This RFC affects function calls only, not declarations
>

I know it's late in the game, but I have a quick question. This RFC
includes a couple of "Not really a function" functions (namely isset() and
unset()) that will also be able to have a trailing comma, but I'm failing
to find the discussion on including "not really a function" calls in this
RFC. Why were those specific non-functions choices included? Why only those?


> Thanks,
> Sammy Kaye Powers
> sammyk.me

---

## #100935 — Sara Golemon — 2017-10-24T16:14:42+00:00

URL: https://externals.io/message/100837#100935 · In reply to: #100934

> I know it's late in the game, but I have a quick question. This RFC
> includes a couple of "Not really a function" functions (namely isset() and
> unset()) that will also be able to have a trailing comma, but I'm failing
> to find the discussion on including "not really a function" calls in this
> RFC. Why were those specific non-functions choices included? Why only those?
>
I'd guess because those are the only constructs which appear
function-like *and* exhibit variadic behavior.
empty/die/exit/print/require/include/require_once/include_once/__HALT_COMPILER
don't have a variadic mode so allowing trailing commas in them would
be pointless.

-Sara

---

## #100960 — Peter Cowburn — 2017-10-27T11:17:22+00:00

URL: https://externals.io/message/100837#100960 · In reply to: #100935

> On Tue, Oct 24, 2017 at 11:37 AM, Peter Cowburn <petercowburn@gmail.com>
> wrote:
> > […]
> and
> > […]
> those?
> > […]
> I'd guess because those are the only constructs which appear
> function-like *and* exhibit variadic behavior.
> empty/die/exit/print/require/include/require_once/include_
> once/__HALT_COMPILER
> don't have a variadic mode so allowing trailing commas in them would
> be pointless.
>

That's a fair point, then maybe we should consider declare() too?  Also, I
know that "echo" is a "doesn't even look like a function" but can that be
considered as if we're changing any language constructs at all in this RFC,
then that might benefit too.  Note, I'm just saying "consider" on purpose,
rather than suggesting any change to the RFC actually be made.


>
> -Sara

---

## #100966 — Sara Golemon — 2017-10-27T13:46:47+00:00

URL: https://externals.io/message/100837#100966 · In reply to: #100960

> 
> > […]
>
> That's a fair point, then maybe we should consider declare() too?
>
Perhaps, but since we've already entered voting, it'll have to be a
separate RFC at this point.  That, or we reset and I don't think it's
worthwhile for declare because it's only got three possible values,
all of which can easily fit a single line.

> Also, I
> know that "echo" is a "doesn't even look like a function" but can that be
> considered as if we're changing any language constructs at all in this RFC,
> then that might benefit too.  Note, I'm just saying "consider" on purpose,
> rather than suggesting any change to the RFC actually be made.
>
At a shot-from-the-hip guess, I'd assume that would introduce parser
ambiguity because of the lack of delimiting parenthesis.

-Sara
