Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47628 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2522 invoked from network); 25 Mar 2010 22:31:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2010 22:31:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 188.40.37.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 188.40.37.16 hq1.backendmedia.com Linux 2.6 Received: from [188.40.37.16] ([188.40.37.16:52019] helo=hq1.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/52-25388-D54EBAB4 for ; Thu, 25 Mar 2010 17:31:58 -0500 Received: from localhost (unknown [127.0.0.1]) by hq1.backendmedia.com (Postfix) with ESMTP id A3E0E2E30011; Thu, 25 Mar 2010 22:31:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from hq1.backendmedia.com ([127.0.0.1]) by localhost (hq1.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id odkICb2OdLYg; Thu, 25 Mar 2010 23:31:53 +0100 (CET) Received: from [192.168.0.151] (217-162-131-234.dclient.hispeed.ch [217.162.131.234]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by hq1.backendmedia.com (Postfix) with ESMTPSA id 1F5E52E3000E; Thu, 25 Mar 2010 23:31:52 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Thu, 25 Mar 2010 23:31:53 +0100 Cc: Jonathan Bond-Caron , "'PHP Developers Mailing List'" Content-Transfer-Encoding: quoted-printable Message-ID: <9E774246-BAC7-4296-9D3D-BDBEF1E91296@pooteeweet.org> References: <690D1362-7F1D-47B9-A4BF-EEA9CF38C5B0@pooteeweet.org> <001501cacb73$398c6420$aca52c60$@com> To: Stefan Marr X-Mailer: Apple Mail (2.1077) Subject: Re: [PHP-DEV] horizontal reuse: traits vs. grafts From: mls@pooteeweet.org (Lukas Kahwe Smith) On 25.03.2010, at 21:23, Stefan Marr wrote: > Hi: >=20 >=20 > On 24 Mar 2010, at 17:58, Jonathan Bond-Caron wrote: >> One thing I feel is missing from the RFC is how is_a() and instanceof = are >> affected with traits or grafts. > Well, my personal (I admit very academic) position is: > - Traits are not classes > - Traits are not interfaces > - Traits are not types > - Traits cannot be instantiated=20 >=20 > Thus, there is no meaning of a is_a and instanceof, and it would not = provide any meaningful information since you can exclude methods from a = Trait in a composition. >=20 > Thus, you should resort to interfaces for use-case where you need to = ensure that an object provides a certain set of methods. >=20 > Traits are purely for behavior, the class hierarchy or interface = should provide the type-information/relations. >=20 >=20 >> It's seem to me that a defining a 'trait' should be advertised = strictly as >> an 'advanced multiple inheritance technique' to reuse pieces of code = and it >> shouldn't be considered as an object (grafts proposal). > It is not an object, right. You can not instantiate traits. > But, I would not speak of multiple inheritance. I would prefer = something along the lines of 'sustainable copy'n'past reuse'. I think Stefan used the right metaphor in the RFC: its language level = copy paste. regards, Lukas Kahwe Smith mls@pooteeweet.org