Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42327 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88912 invoked from network); 18 Dec 2008 11:59:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Dec 2008 11:59:20 -0000 Authentication-Results: pb1.pair.com header.from=dave@dmi.me.uk; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dave@dmi.me.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain dmi.me.uk designates 213.171.205.116 as permitted sender) X-PHP-List-Original-Sender: dave@dmi.me.uk X-Host-Fingerprint: 213.171.205.116 unknown Received: from [213.171.205.116] ([213.171.205.116:46474] helo=scaramanga.siterage.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/E0-18353-71B3A494 for ; Thu, 18 Dec 2008 06:59:19 -0500 Received: from localhost (scaramanga.siterage.net [127.0.0.1]) by localhost.akadia.com (SiteRage Mail Server) with ESMTP id 7E71953581; Thu, 18 Dec 2008 11:59:16 +0000 (GMT) X-Spam-Flag: NO X-Spam-Score: -4.347 X-Spam-Level: X-Spam-Status: No, score=-4.347 required=5 tests=[ALL_TRUSTED=-1.8, AWL=0.052, BAYES_00=-2.599] Received: from scaramanga.siterage.net ([127.0.0.1]) by localhost (scaramanga.siterage.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2JlghJE9EzPT; Thu, 18 Dec 2008 11:59:15 +0000 (GMT) Received: from [192.168.201.2] (ip9.net195-72-173.ci-net.com [195.72.173.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by scaramanga.siterage.net (SiteRage Mail Server) with ESMTPSA id 274FECEBF; Thu, 18 Dec 2008 11:59:15 +0000 (GMT) Message-ID: <494A3B12.80509@dmi.me.uk> Date: Thu, 18 Dec 2008 11:59:14 +0000 User-Agent: Thunderbird 2.0.0.18 (X11/20081105) MIME-Version: 1.0 To: Nathan Rixham CC: internals@lists.php.net References: <69.22.48223.7E389494@pb1.pair.com> In-Reply-To: <69.22.48223.7E389494@pb1.pair.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Q on Primitives From: dave@dmi.me.uk (Dave Ingram) Nathan Rixham wrote: > [...] > > while I'm here I may as well also ask about further adding type > hinting for the existing scalars and array. +1, but I don't know what might have stopped it being implemented before (time, parsing API changes, etc), so it would be interesting to look into the history. > and finally different method signatures such as: > > class Whatever { > public function __construct(Bar b); > public function __construct(Foo f); > public function doSomething(Bar b); > public function doSomething(Foo f); > } +1. Having overloaded function definitions like this would be very useful, but I don't know how awkward it would be to implement - I don't know how the function pointers are currently stored. I could imagine adding information about the type signature to the internal method name, and looking up based on that... but then I don't know how it's stored so I might be talking rubbish! Also, what about this case: class MyTestClass { public function blah(Foo $f); public function blah(Bar $b); public function blah($v); } I would argue that the most specific function should be called, but how costly would that be to determine? What if you have a "Baz" subclass of Bar, but no corresponding method? What if Bar itself is a subclass of Foo? Dave