Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42044 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40814 invoked from network); 25 Nov 2008 02:27:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2008 02:27:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=christopher.vogt@rwth-aachen.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=christopher.vogt@rwth-aachen.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain rwth-aachen.de from 134.130.7.73 cause and error) X-PHP-List-Original-Sender: christopher.vogt@rwth-aachen.de X-Host-Fingerprint: 134.130.7.73 mta-2.ms.rz.RWTH-Aachen.DE Solaris 10 (beta) Received: from [134.130.7.73] ([134.130.7.73:33524] helo=mta-2.ms.rz.rwth-aachen.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/01-32521-5A26B294 for ; Mon, 24 Nov 2008 21:27:49 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=ISO-8859-1 Received: from ironport-out-1.rz.rwth-aachen.de ([134.130.5.40]) by mta-2.ms.rz.RWTH-Aachen.de (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008)) with ESMTP id <0KAV00EVVAUA5B40@mta-2.ms.rz.RWTH-Aachen.de> for internals@lists.php.net; Tue, 25 Nov 2008 03:27:46 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.33,661,1220220000"; d="scan'208";a="91508498" Received: from zelos.rz.rwth-aachen.de (HELO relay-auth.rwth-aachen.de) ([134.130.3.23]) by ironport-in-1.rz.rwth-aachen.de with ESMTP; Tue, 25 Nov 2008 03:27:46 +0100 Received: from [192.168.1.127] (alania-134-130-78-10.nn.RWTH-Aachen.DE [134.130.78.10] (may be forged)) (authenticated bits=0) by relay-auth.rwth-aachen.de (8.13.8/8.13.1/1) with ESMTP id mAP2Ri9t029910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 25 Nov 2008 03:27:44 +0100 Message-ID: <492B62A1.2000207@rwth-aachen.de> Date: Tue, 25 Nov 2008 03:27:45 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666 To: Marcus Boerger Cc: Stefan Marr , internals@lists.php.net References: <002b01c92d67$ae92fdc0$0bb8f940$@de> <79.C8.07308.CDE4C194@pb1.pair.com> <49203DF2.1020006@stefan-marr.de> <45289205.20081125005213@marcus-boerger.de> In-reply-to: <45289205.20081125005213@marcus-boerger.de> X-Enigmail-Version: 0.95.7 OpenPGP: Subject: Re: [PHP-DEV] Grafts, Traits, horizontal reuse From: christopher.vogt@rwth-aachen.de (Christopher Vogt) Hej Marcus, I like your approach. It is clear and simple. It would probably solve 90% of the cases, where delegation is needed. I want to add that a manually defined method should automatically overwrite a delegated method of the same name. But I also want to bring up two reasonable situations your approach does not cover. Your approach does not allow to delegate only a selection of methods. This makes sense in order to limit the delegation to known functionality. To stick to your example, without selective delegation, new methods added to Counter would be automatically delegated to CounterUser. This might break things. A second situation not covered by your approach is renaming of delegated methods. This can be desirable due to name clashes or name changes for better understandability. Of course there is always the fall back to manually implementing delegation. And your approach alone would already be quite useful syntactic sugar. But additional syntactic sugar for the two situations described above would still be nice :). Another thing. I am not sure if you intended that, but I think delegation should not force using an Interface definition. Interfaces are helpful in combination with type hinting, but for people who prefer duck typing, it is reasonable to not explicitly define them. Let's leave this choice to the people :). Best regards Christopher