Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67833 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22589 invoked from network); 25 Jun 2013 22:16:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jun 2013 22:16:38 -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 108.166.43.91 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.91 smtp91.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.91] ([108.166.43.91:60018] helo=smtp91.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 19/62-11452-5C61AC15 for ; Tue, 25 Jun 2013 18:16:38 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp4.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 50D5014042B; Tue, 25 Jun 2013 18:16:35 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp4.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id E4F57140425; Tue, 25 Jun 2013 18:16:34 -0400 (EDT) Message-ID: <51CA16C2.2000100@sugarcrm.com> Date: Tue, 25 Jun 2013 15:16:34 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Anthony Ferrara CC: Laruence , "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: Protocol Type Hinting From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > This may sound trivial, but imagine this. Right now Zend and Symfony have > very similar providers for certain tasks. One of the ones that comes to > mind (besides logging) is caching. If you want to use a Zend component in > an Symfony app while still using caching today, you'd need to shim together > an adapter to satisfy the zend cache interface with the symfony cache > interface. Which means your project now depends on all three, as well as > requiring the zend cache code for the sole purpose of loading the interface > required by the component. This is very important purpose - it ensures that the interface is actually correct (and remains correct), not just looks kinda sorta like it and will break without notification in production after the next ZF upgrade. > Instead, the zend component could depend on the narrow api that it needs. > It only calls the ->get($key) and ->set($key, $value) methods, so create a > (new?) interface with that limited API, and then type against it as a Do you really want to accept any object that implements methods named "get" and "set" there, even if they don't have anything to do with caching at all? What about an object that implements __call - would you accept it too? If not - why not, you certainly can call get and set on it? > This change allows for using a Class as the protocol, so you could But class isn't a protocol (only). If you say you've got PDO object, you expect it to be PDO object with all that docs say PDO object does, not only functions with names that looks like ones PDO object would have. I don't see what could I do with object all I know about is that it has method "query". Who knows what that "query" method might do? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227