Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50992 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10991 invoked from network); 10 Dec 2010 17:09:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2010 17:09:45 -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:45523] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/19-59644-6DE520D4 for ; Fri, 10 Dec 2010 12:09:43 -0500 Received: from soft83.vub.ac.be ([134.184.43.183]) by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1PR6So-0007PM-2d; Fri, 10 Dec 2010 18:09:01 +0100 Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Fri, 10 Dec 2010 18:09:31 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <9CD87200-33CB-40BE-A81C-36FD7471F59C@stefan-marr.de> <9A31F2F9-ED6B-4BE5-A6E2-EB4536E8667F@stefan-marr.de> 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 10 Dec 2010, at 17:49, Nathan Nobbe wrote: > Def not :D, however, I still think this paradigm is lacking. Don't = you think it makes more sense if I write a trait that expects a given = interface or class to be able to specify said interface/class in it's = entirety with just a single identifier rather than listing out all the = methods? >=20 > For example, I think this would be ugly > trait IteratorHelper{ > abstract public current(); > abstract public key(); > abstract public next(); > abstract public rewind(); > abstract public valid(); > } > ?> >=20 > essentially you're redeclaring the entire interface in the trait, the = same would be true of the public interface of an expected class. i = think it would be much more elegant to allow a specification on the = trait declaration itself, something like >=20 > trait IteratorHelper expects Iterator { > ... > } > ?> :D That was exactly my thought when I was writing my first answer. My second thought was, damn, not another keyword... But since you also seem to see the need, we should give it a thought. Anyone else with an opinion on that? 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