Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68056 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79462 invoked from network); 3 Jul 2013 19:13:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2013 19:13:18 -0000 Authentication-Results: pb1.pair.com header.from=lang@b1-systems.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=lang@b1-systems.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain b1-systems.de designates 84.200.69.220 as permitted sender) X-PHP-List-Original-Sender: lang@b1-systems.de X-Host-Fingerprint: 84.200.69.220 mx1.b1-systems.de Received: from [84.200.69.220] ([84.200.69.220:56279] helo=mx1.b1-systems.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B5/A8-30639-CC774D15 for ; Wed, 03 Jul 2013 15:13:17 -0400 Received: from [192.168.1.17] (cable-158-181-84-94.cust.telecolumbus.net [158.181.84.94]) by mx1.b1-systems.de (Postfix) with ESMTPSA id 90C884075 for ; Wed, 3 Jul 2013 21:08:59 +0200 (CEST) Message-ID: <51D477C5.6020907@b1-systems.de> Date: Wed, 03 Jul 2013 21:13:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: internals@lists.php.net References: <1668753851.20130703140514@cypressintegrated.com> <51D46981.7050902@b1-systems.de> <1579496223.20130703144829@cypressintegrated.com> In-Reply-To: <1579496223.20130703144829@cypressintegrated.com> X-Enigmail-Version: 1.6a1pre Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2EWPVPFGKUFEVHCSHWGHF" Subject: Re: [PHP-DEV] New feature: sequential constructors From: lang@b1-systems.de (Ralf Lang) ------enig2EWPVPFGKUFEVHCSHWGHF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03.07.2013 20:48, Sanford Whiteman wrote: >> Most often if I need a super __construct(), I don't need it exactly >> before or exactly after the bottom constructor but at a specific point= >> where I can setup super's input data and do stuff to its output. >=20 > I've most often seen, or reluctantly implemented, the Call Super > antipattern by putting the call at the bottom of sub code. >=20 > It's true that it's an antipattern regardless of "advisory" placement. > But to me, somewhere-in-the-middle is even smellier than usual, since > in human hands that's got to be more prone to failure. >=20 > I think if Contractual Call Super were considered for the language it > should have before and after variants, not just after. There isn't a > practical way to declare "at some point," is there, even if you wanted > it? No, that's why I am asking. Why is it an anti-pattern to call a known super constructor? Not knowing the implementation details, I still know the documented api (which is all a class should ask for). >> What is the typical use case for calling all supers (before or after t= he >> class' __construct itself) ? >=20 > I can't think of a valid case in my memory for _all_ supers. Typically > you mean to call the immediate super _or_ the root super. Which is of > course the problem with the "advisory" form of this pattern, since > innocently inserting an intermediate class breaks your code. This makes it more complicated. Do you mean next super or root super (or root-1 as any class object is an "object" ? I don't mean to disrupt any ideas. I just think how I would use or expect to use the feature. > If this feature were introduced, I see no reason for it to be allowed > to call more than one method for each occurrence of 'sequential' > keyword. >=20 > That is, >=20 > class A { sequentialBefore function __construct() {} } > class Asub extends A { function __construct() {} } > class Asubsub extends Asub { function __construct() {} } >=20 > would run A::__construct and then Asubsub::construct() >=20 > class A { sequentialBefore function __construct() {} } > class Asub extends A { sequentialBefore function __construct() {} } > class Asubsub extends Asub { function __construct() {} } >=20 > would run A::__construct, Asub::__construct, Asubsub::__construct >=20 > class A { sequentialBefore function __construct() {} } > class Asub extends A { sequentialAfter function __construct() {} } > class Asubsub extends Asub { function __construct() {} } >=20 > would run A::__construct, Asubsub::construct(), Asub::__construct > I'm not particularly cheering for this feature but enjoy thinking > about how it might work. If you see my notes on the previous thread > you can see I'm pretty adamant about Call Super being very bad > _unless_ it's baked into the language in an interesting way. Not that it would be an argument but just for understanding: Do you know any scripting language which has this? This would help me seeing the idea as I know some of them. =09 --=20 Ralf Lang Linux Consultant / Developer Mail: lang@b1-systems.de B1 Systems GmbH Osterfeldstra=C3=9Fe 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 ------enig2EWPVPFGKUFEVHCSHWGHF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlHUd8gACgkQCs1dsHJ/X7D90gCgzJM/9TiOO61tJYRkkFrqmzf6 j9IAnRKiu738zQn8KGzPDCu1RNK2rt44 =8Qxp -----END PGP SIGNATURE----- ------enig2EWPVPFGKUFEVHCSHWGHF--