Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47618 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53743 invoked from network); 25 Mar 2010 20:23:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2010 20:23:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 85.88.12.247 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 85.88.12.247 toolslave.net Received: from [85.88.12.247] ([85.88.12.247:42250] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/78-11385-D36CBAB4 for ; Thu, 25 Mar 2010 15:23:26 -0500 Received: from cust194-138.dsl.as47377.net ([62.166.194.138] helo=[192.168.0.16]) by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1NutaG-0001Sq-Ah; Thu, 25 Mar 2010 21:23:18 +0100 Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii In-Reply-To: <001501cacb73$398c6420$aca52c60$@com> Date: Thu, 25 Mar 2010 21:23:12 +0100 Cc: "'Lukas Kahwe Smith'" , "'PHP Developers Mailing List'" Content-Transfer-Encoding: quoted-printable Message-ID: References: <690D1362-7F1D-47B9-A4BF-EEA9CF38C5B0@pooteeweet.org> <001501cacb73$398c6420$aca52c60$@com> To: Jonathan Bond-Caron X-Mailer: Apple Mail (2.1077) Subject: Re: [PHP-DEV] horizontal reuse: traits vs. grafts From: php@stefan-marr.de (Stefan Marr) Hi: 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 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. Thus, you should resort to interfaces for use-case where you need to = ensure that an object provides a certain set of methods. Traits are purely for behavior, the class hierarchy or interface should = provide the type-information/relations. > 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'. Best regards Stefan --=20 Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525