Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67822 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87301 invoked from network); 25 Jun 2013 19:26:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jun 2013 19:26:09 -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.44 as permitted sender) X-PHP-List-Original-Sender: g.b.yahav@gmail.com X-Host-Fingerprint: 209.85.160.44 mail-pb0-f44.google.com Received: from [209.85.160.44] ([209.85.160.44:58350] helo=mail-pb0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/90-18197-ECEE9C15 for ; Tue, 25 Jun 2013 15:26:07 -0400 Received: by mail-pb0-f44.google.com with SMTP id uo1so13080963pbc.31 for ; Tue, 25 Jun 2013 12:26:02 -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=hN/UHQkL9NFjov9Uf8NAgmfEL2a0K9bXLURHON3Yu0U=; b=vpLhxsdfpK39W0hZ8Twa24sQrIRVlhKUhgdvCcY6s60sepZzxWtKF9rkhzb5XoCefT 5BhZaXMsOJ88KgPy+bjm7iUcgH92Ao2lCU13AbUrVxDZp1w3Gp3owRV4F9kYOs0TNRXC UI1BVGqcq14XnfGfG/MQe/xYaDXjV+hLUCRayadJlB8Vg309Quajp2KfvO7Mv9mGD2BW 6cmcCfbqaAS3fRZgFN1eh9351nGrbndWKjHErPSiRv3pJIAHN/1/fnsckiuCfctstbdr ckOQN8AOwuPHGwMdFp1DNHvDvZN6eQz8TbZXMrs9y1Y8fvUXL5l794bEKlyLfqVT9BiP 1xgQ== X-Received: by 10.68.78.37 with SMTP id y5mr578828pbw.28.1372188362559; Tue, 25 Jun 2013 12:26:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.92.132 with HTTP; Tue, 25 Jun 2013 12:25:41 -0700 (PDT) In-Reply-To: <51C9E5DF.9080104@ralphschindler.com> References: <51C9E5DF.9080104@ralphschindler.com> Date: Tue, 25 Jun 2013 22:25:41 +0300 Message-ID: To: Ralph Schindler Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b6d9070ea59f404dfff7f42 Subject: Re: [PHP-DEV] RFC: Protocol Type Hinting From: g.b.yahav@gmail.com (Yahav Gindi Bar) --047d7b6d9070ea59f404dfff7f42 Content-Type: text/plain; charset=ISO-8859-1 On 6/25/13 10:57 AM, Anthony Ferrara wrote: > >> Hey all, >> >> I want to throw out this draft RFC to get the concept floating around and >> get feedback early. >> >> https://wiki.php.net/rfc/**protocol_type_hinting >> >> There are still open questions, and a more complete (and cleaner) >> implementation will be needed before officially proposing it, but I wanted >> to get the concept out as soon as possible. >> >> What do you think? >> >> Thanks! >> >> Anthony >> > I did like the concept, however I'd like to double-check if I didn't missed anything. I don't see the main reason, to create a "protocol" syntax if you're only verify that a specific class implements a specific method. For instance: interface IStoreableObject { function save($key, $value); function fetch($key); function exists($key); function count(); } interface IQueryable { function where($expression); function orderBy($expression); function limit($min, $max); } I can create a class that implements these two interfaces, such as class DbObject implements IStorableObject, IQueryable { } and then in my function test if these interfaces was implemented by using instanceof. This was a quick setup for my question: If you allow in the protocol to specify only ONE class/interface, I don't see any reason to use it. Today we can use type-hinting and the instanceof operator. However, If you allows using the protocol syntax to test against multiple interfaces, for instance function fetchSomeData($identifier, $object) { } It will be a great addition. So can you clarify yourself? --047d7b6d9070ea59f404dfff7f42--