Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67834 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24885 invoked from network); 25 Jun 2013 22:22:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jun 2013 22:22:16 -0000 Authentication-Results: pb1.pair.com header.from=g.b.yahav@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=g.b.yahav@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.54 as permitted sender) X-PHP-List-Original-Sender: g.b.yahav@gmail.com X-Host-Fingerprint: 209.85.160.54 mail-pb0-f54.google.com Received: from [209.85.160.54] ([209.85.160.54:47075] helo=mail-pb0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/F2-11452-7181AC15 for ; Tue, 25 Jun 2013 18:22:15 -0400 Received: by mail-pb0-f54.google.com with SMTP id ro2so13278088pbb.13 for ; Tue, 25 Jun 2013 15:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=GYJLnqeDSRsDE/X0wxH1DD23NjcJeYpjUnhSH8jIS8I=; b=YSu52QBC7Xt4l92xY9Qu+dETemaFH/LN0/Ay11J2783KaRPK0x0J1tS1qU+RMTHzZC xUviqCeYbXLg+MPDl9kFTV4OHXHPNuEsvvJgnW3mOWUbcWuQ0sO/OU6w1VK/GIj/SqAG abX+kgkFOBqn9Reuc5+5aWLbtqViGElN/txpXi4d0XcPEFg4N84An7NLSKNyMTMaPL7o /Gj8YesyGpdTjU9MURM/nbbJz0br/yVdFCxdjZgIQ/fPS7lxIviw/onJ4J0XbLqrPIAX /8r2Vgbo14ZmEQuWJDBrYrEHhhNJ3on7NXNjqjNhrOkX8OWUfdj2SKMuKONG6UFeJIp8 zZsw== X-Received: by 10.67.3.99 with SMTP id bv3mr1818001pad.140.1372198931137; Tue, 25 Jun 2013 15:22:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.92.132 with HTTP; Tue, 25 Jun 2013 15:21:51 -0700 (PDT) In-Reply-To: <51CA16C2.2000100@sugarcrm.com> References: <51CA16C2.2000100@sugarcrm.com> Date: Wed, 26 Jun 2013 01:21:51 +0300 Message-ID: To: Stas Malyshev Cc: Anthony Ferrara , Laruence , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b15fbc9da0c2904e001f55c Subject: Re: [PHP-DEV] RFC: Protocol Type Hinting From: g.b.yahav@gmail.com (Yahav Gindi Bar) --047d7b15fbc9da0c2904e001f55c Content-Type: text/plain; charset=ISO-8859-1 On Wed, Jun 26, 2013 at 1:16 AM, Stas Malyshev wrote: > 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. > > I, too, believes that it can be very handy. However, how we should "enforce" that the users will have someting like a "gentelmen code" and won't create their own protocol just like they've done with interfaces? There should be a way to distinguish them from interfaces and say "This is the protocol for implementing a Logger" (for instance) " you should not implement your own protocol for Logger because this is the 'official' one.".. > > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7b15fbc9da0c2904e001f55c--