Re: New feature: sequential constructors
| From: | Sanford Whiteman | Date: | Wed, 03 Jul 2013 21:10:37 +0000 |
| Subject: | Re: New feature: sequential constructors | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68061@lists.php.net to get a copy of this message | ||
> Not that it would be an argument but just for understanding: Do you know
> any scripting language which has this?
Dropping the "scripting" part... IIRC, C++ calls ctors without
arguments automatically like in my 'sequentialBefore' napkin sketch.
C# has language-level support for 'sequentialBefore' type logic in its
initialization list as well (which helps to smooth away the anti-ness
by keeping it out of the ctor code).
Also, here's a fascinatingly stupid bug-as-feature in AS3 (which I
don't remember anything about, having used it basically procedurally
along time ago) http://blogs.adobe.com/cantrell/archives/2008/09/be_careful_how.html.
(Call Super hoisting out of conditionals? How could that have seemed
like a good idea?)
So there is precedent for Contractual Call Super. I don't think the
above implementations are ideal, though, so if someone did go down
this path I think it should be (a) not automatic but dependent on
keyword(s); (b) flexible as far as executing before/after; (c)
deeply-thought-through as far as its impact on class hierarchies that
expand and contract over time.
-- S.