Re: RFC: Anonymous Classes

From: Date: Thu, 26 Sep 2013 12:01:29 +0000
Subject: Re: RFC: Anonymous Classes
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Am 26.09.2013 12:16 schrieb "Joe Watkins" <[email protected]>:
> For the following reasons the syntax should remain as it is:
>
>         It is consistent with anonymous function calls - args after
definition ...

I think it is exceedingly rare for anynomous functions to be called at
their point of definition, while the constructor of your anonymous class
will alreays be called there.

>         It does not make sense to pass arguments to a constructor that
might not yet be declared

The constructor will be called after the full class definition has been
seen anyway; where the arguments are put syntactically doesn't change that,
does it?

My proposal ($that = new class(constructor args) places the constructor
args in exactly the same place they are when instantiating a nonanonymous
class.

best regards
  Patrick


Thread (55 messages)

« previous php.internals (#69352) next »