Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67842 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37748 invoked from network); 25 Jun 2013 23:28:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jun 2013 23:28:10 -0000 Authentication-Results: pb1.pair.com header.from=rstoll@tutteli.ch; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rstoll@tutteli.ch; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: rstoll@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:52331] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/C5-11452-5872AC15 for ; Tue, 25 Jun 2013 19:28:06 -0400 Received: (qmail 26539 invoked from network); 26 Jun 2013 01:28:02 +0200 Received: from 99-206.5-85.cust.bluewin.ch (HELO RoLaptop) (85.5.206.99) by ns73.kreativmedia.ch with (AES128-SHA encrypted) SMTP; 26 Jun 2013 01:28:02 +0200 To: "'Stas Malyshev'" , "'Anthony Ferrara'" Cc: References: <51C9FA9C.8050403@sugarcrm.com> <51CA1C93.6080500@sugarcrm.com> <51CA24C5.9090505@sugarcrm.com> In-Reply-To: <51CA24C5.9090505@sugarcrm.com> Date: Wed, 26 Jun 2013 01:28:01 +0200 Message-ID: <004201ce71fb$a2d6a8f0$e883fad0$@tutteli.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQF3b2Sgpi7WETnNUQtx1g4EUX4mfAF72DBlAqekqcoB9RF6fQIoX6hZAT6cKNaZqRql8A== Content-Language: de-ch Subject: AW: [PHP-DEV] RFC: Protocol Type Hinting From: rstoll@tutteli.ch ("Robert Stoll") IMO GO like interfaces become handy in the following situation: Library A wants that you pass a class at some point (let's say a logger) which implements interface ALogger (as defined by lib A)=20 Library B wants that you pass a class at some point which implements interface BLogger Both interfaces are identical (at the moment). There is no need to write = an adaptor for one of those libraries if GO like interfaces are used. That's one use case for GO like interfaces (which of course could also = be misused) @Anthony You also outline that protocols can be used for classes which make = classes somewhat like interfaces. I do not like this idea and I am not familiar = with GO but I doubt they use it like this. That really counteracts the = principle that you should implement against an interface/abstraction. -----Urspr=FCngliche Nachricht----- Von: Stas Malyshev [mailto:smalyshev@sugarcrm.com]=20 Gesendet: Mittwoch, 26. Juni 2013 01:16 An: Anthony Ferrara Cc: internals@lists.php.net Betreff: Re: [PHP-DEV] RFC: Protocol Type Hinting Hi! > So nobody should ever use libraries, because they can't be sure of=20 > that code... So... Libraries have classes and interfaces for exactly this reason - so you = can be reasonably sure what's in them or at least have easy way to check it. > It's checking that fatal method-not-defined erros won't be thrown... But instead a fatal "protocol does not match" error will be thrown. The difference? > It gives the ability for a method to be defensive by preventing=20 > E_FATAL errors. That's not adding something significant? I fail to see the difference between one error and another error. The = whole "catchable" thing is very artificial difference and as far as I'm = concerned, if that's the problem, just make method-not-defined "catchable", = whatever that might mean - there's no difference on the substance that I can see. > I agree the use-cases are slightly weak. This is a draft RFC. It's=20 > supposed to help identify the areas where we can improve it. Help=20 > identify use-cases. Help dig it out. My personal opinion regarding design always was that use cases come = first. If I don't have a use case, there's nothing to design. So I'd like to = see the convincing use case first. Then, once it's convincing, we can talk = about implementation details - so yes, you can discard all the performance, = etc. talk - it's not important right now, the most important thing is the use cases. -- 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