Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68064 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3640 invoked from network); 3 Jul 2013 23:35:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2013 23:35:47 -0000 Authentication-Results: pb1.pair.com header.from=swhitemanlistens-software@cypressintegrated.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=swhitemanlistens-software@cypressintegrated.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cypressintegrated.com designates 173.1.104.101 as permitted sender) X-PHP-List-Original-Sender: swhitemanlistens-software@cypressintegrated.com X-Host-Fingerprint: 173.1.104.101 rproxy2-b-iv.figureone.com Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) Received: from [173.1.104.101] ([173.1.104.101:56546] helo=rproxy2-b-iv.figureone.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/10-02453-155B4D15 for ; Wed, 03 Jul 2013 19:35:46 -0400 Received: from localhost ([216.220.114.66]) by rproxy2-b-iv.figureone.com (Brand New Heavy v1.0) with ASMTP id OEM79242 for ; Wed, 03 Jul 2013 16:35:42 -0700 Date: Wed, 3 Jul 2013 19:34:55 -0400 Reply-To: Sanford Whiteman X-Priority: 3 (Normal) Message-ID: <48725092.20130703193455@cypressintegrated.com> To: Florin Patan In-Reply-To: References: <1668753851.20130703140514@cypressintegrated.com> <51D46981.7050902@b1-systems.de> <1579496223.20130703144829@cypressintegrated.com> <51D477C5.6020907@b1-systems.de> <1233362173.20130703171037@cypressintegrated.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] New feature: sequential constructors From: swhitemanlistens-software@cypressintegrated.com (Sanford Whiteman) > I've been thinking about this for a bit and even if you are right > about being nice to have a way to call a function always after > constructor. It could happen. You could have a DB class and in > constructor the user/pass/host/options and then a separate method for > init(). But that's not Call Super. Call Super specifically refers to always calling an overridden method of the same name (and usually same signature in languages supporting overloading) in a base class (usually the closest parent). Let's not mix up concepts: the relationship between methods of the same name in the a class hierarchy has specific semantic baggage, if not a single agreed-upon meaning, thus how some people say "you should always be able to call super" while others say "you should never just assume you can call super *and* should never author an API that requires it" and still others say "you can't assume, but the requirement happens, and when it is required the language should be able to enforce the requirement." > But more often than not, I want to be able to dictate what the > program is doing when I'm using libraries and so on that I'm > extending, not the libraries do stuff on their own. The question regarding Call Super isn't about libraries doing "stuff on their own" vs. "stuff you dictate." It's about "doing stuff on their own" vs. "dictating that you remember to do stuff for bug-free operation, being unable to do that stuff on their own." Languages that have Call Super as a flexible, baked-in language feature are able to contractually ensure Call Super _if a superclass author chooses to use the pattern_. Doesn't mean you have to use it, but it means you don't have to cross your fingers if you do use it. (In the case of C++, you're always using the pattern if you have a base ctor.) Languages that don't support Call Super still have to support code using the pattern in the real world, because not every user will use the alternative Template Method due to seeming complexity (even if TM is less prone to error). But those languages won't offer any way of catching omissions in a subclass. -- S.