Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50920 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47293 invoked from network); 9 Dec 2010 08:09:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2010 08:09:32 -0000 Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; 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:39882] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/C3-16752-9BE800D4 for ; Thu, 09 Dec 2010 03:09:30 -0500 Received: from cust194-138.dsl.as47377.net ([62.166.194.138] helo=[192.168.0.26]) by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1PQbYb-0006Lg-Ck; Thu, 09 Dec 2010 09:08:56 +0100 Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Thu, 9 Dec 2010 09:09:03 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <9CD87200-33CB-40BE-A81C-36FD7471F59C@stefan-marr.de> References: To: Nathan Nobbe X-Mailer: Apple Mail (2.1082) Subject: Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks From: php@stefan-marr.de (Stefan Marr) Hi Nathan: On 09 Dec 2010, at 08:44, Nathan Nobbe wrote: > Hi, >=20 > I think traits will lend themselves to frequent runtime checking = against the > type of class in which they were used. Consider a trait designed for = use > with an Iterator class; the first thing might be to check the type of = $this. Why would you need such a check? You want to ensure that the class that is using your trait obeys a = certain interface, right? More specifically, you need it to implement a number of methods of an = interface, correct? So, why not asking for it explicitly? next() ... } } ?> Does that what you want it to do? 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