Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62159 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49707 invoked from network); 14 Aug 2012 19:58:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2012 19:58:40 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.193 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.193 smtp193.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.193] ([67.192.241.193:42113] helo=smtp193.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/50-47147-EEDAA205 for ; Tue, 14 Aug 2012 15:58:38 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp19.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id EE50D3C867B; Tue, 14 Aug 2012 15:58:35 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp19.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id B48543C82F1; Tue, 14 Aug 2012 15:58:35 -0400 (EDT) Message-ID: <502AADEB.2020102@sugarcrm.com> Date: Tue, 14 Aug 2012 12:58:35 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Anthony Ferrara CC: "internals@lists.php.net" References: <502A81AD.1070303@ralphschindler.com> <502AA750.1060406@ralphschindler.com> In-Reply-To: <502AA750.1060406@ralphschindler.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Decorators Revisited From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Simply because your object responds to all the same methods of, for > example, the FooInterface, does not make it a FooInterface subtype. It > just means that in the "duck typing" sense of the phrase, it can act > like a FooInterface for people that are not necessarily concerned that > it's actually not is_a() FooInterface. Excellent point here. I have a feeling that with these proposals people want to eat a cake and have it too. To have strictly defined typing structure enforced by strict parameter checks, instanceof checks, etc. and at the same time have the freedom of duck typing. I don't think it's going to work well - if you want duck typing, that's one thing, if you want class hierarchy, that's another thing. Both are viable models for different cases, but I don't see how they can work using the same operators and language constructs. They should be distinct. Now, we could probably make duck typing a bit easier by allowing to check if specific object can respond to specific interface. But I'm not sure if it's worth the effort - why not just have it implement the interface then? In any case, I think duck typing improvement may be a good place for proposals, but let's not confuse it with inheritance hierarchy. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227