Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30008 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99563 invoked by uid 1010); 31 May 2007 20:37:46 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99548 invoked from network); 31 May 2007 20:37:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 May 2007 20:37:46 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain l-i-e.com from 67.139.134.202 cause and error) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:3249] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/B2-17260-9123F564 for ; Thu, 31 May 2007 16:37:46 -0400 Received: (qmail 91697 invoked by uid 98); 31 May 2007 20:37:46 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.01 (clamdscan: 0.88.7/3335. Clear:RC:1(127.0.0.1):. Processed in 0.075988 secs); 31 May 2007 20:37:46 -0000 Received: from localhost (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 31 May 2007 20:37:46 -0000 Received: from 216.230.84.67 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Thu, 31 May 2007 15:37:46 -0500 (CDT) Message-ID: <43689.216.230.84.67.1180643866.squirrel@www.l-i-e.com> In-Reply-To: <465D9040.6030001@iamjochem.com> References: <56275.216.230.84.67.1180484964.squirrel@www.l-i-e.com> <465D9040.6030001@iamjochem.com> Date: Thu, 31 May 2007 15:37:46 -0500 (CDT) To: "Jochem Maas" Cc: "Ken Stanley" , internals@lists.php.net Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] late static binding From: ceo@l-i-e.com ("Richard Lynch") On Wed, May 30, 2007 9:54 am, Jochem Maas wrote: > Richard Lynch wrote: >> Maybe I'm just confused (well, I'm always confused...) but if a >> Class >> has multiple children, how the heck would PHP know which child:: to >> call?... > > the use of the name 'child' is very confusing, I would prefer 'super' > or 'static' ... > regardless the concept is actually quite simple: > > interface DOInfo { > static function getTableName(); > } > > abstract class DataObject implements DOInfo { > static function findRange() { > $table = super::getTableName(); > return $foo; // $foo is a collection of whatever (e.g. Product > objects) > } > > static function getTableName() { > throw new Exception('be a dear and implement '.__METHOD__.' in your > subclass'); } > > } > > class Product extends DataObject { > static function getTableName() { return 'PRODS'; } > } > > $products = Product::findRange(); > > excuse me if I've just committed a grave sin against the OO Codex in > writing something > that either isn't 'correct' or is syntactically incorrect according to > the current > state of php - hopefully the idea is clear anyway. You may think this is "quite simple" but I've skimmed it several times and have no idea what the heck is going on... I do know that 'super', to me, implies superclass which PHP just calls parent:: so I don't like that either. If it's just calling the static method of the interface parent-y thingie, I dunno, maybe just static:: would work? -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?