Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92549 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56590 invoked from network); 20 Apr 2016 15:17:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 15:17:30 -0000 Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.178 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.213.178 mail-ig0-f178.google.com Received: from [209.85.213.178] ([209.85.213.178:38174] helo=mail-ig0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/2D-14036-98D97175 for ; Wed, 20 Apr 2016 11:17:29 -0400 Received: by mail-ig0-f178.google.com with SMTP id m9so39837371ige.1 for ; Wed, 20 Apr 2016 08:17:29 -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; bh=Ntm4ipQ03chd5J84u6x0btFv8W7FSqQaoBvN0toWIX4=; b=SJaWX3UuhLeaxwFrhuSpk6NSSTTfhMJRHTsWGi+ZYVUZrqPpLjXmlR0GNV8i7Hnk24 sDk+KeIxSx7ZnWPCpK0x+EA22N3/hsF6hCs+9HgrwCqPYEq5BxqPcGHezqRaXSmFMa4g igL7wPptpAvLB9hzx4/NHduYBhyYZyxdohmJGk00fMFbDGdDYcJUPEoPsGQHvAs91P7+ 8k1YCDXAAcervIfdtskLsMBl90sjT5Knxx8A0auXBNnTssyCGAbwbA+hbZX6a+IYnCK3 +e1lzLtF7JwhaHWXyR6PKPK6DGxggXLHeaxuFvwxsbtdLZOn6N3dL7Cssdy0wwo2mUPy OlZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Ntm4ipQ03chd5J84u6x0btFv8W7FSqQaoBvN0toWIX4=; b=W4w5cdAbWZJEvibQCCaZ6dD3IEvPK4xeHmtUB/43xbsRxUMlocB51yzN7DGdJUff12 g9ofClZP4WVCl5rX+wLfo1XYS7AEsrbwO8Br+BjvOiHkMXfKuUbQElhKGoABzV88vl8W cfE2oHFqivjTkCyRGGeLvS9rX8nQxJ6nbuW3rFc4YCnLCnL8BryC5gaiVFqc0/7UYqTb uZV3+kUFS5Qz9975O8SQRR3nUddrG23vn+CcT6+Cs+EbbCwUf7QttCGlEwv0xuz4OucP OOEjSMfr4DRaMbPZrJ9i9hsij/YSC4Y9qYanr31N2dR/VYNBPT6Eb4wG3M2ls8aruoar OEuQ== X-Gm-Message-State: AOPr4FXTJhI6zUvh0Rl0K5i43Oc+3WgZNhGyTPHkChHyUi22vD/KHsibmmPik1Ws+qMs+3AWk/7QMmSlimhCLw== X-Received: by 10.50.155.6 with SMTP id vs6mr4247154igb.79.1461165446319; Wed, 20 Apr 2016 08:17:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.85.10 with HTTP; Wed, 20 Apr 2016 08:17:06 -0700 (PDT) In-Reply-To: <571799B8.1060201@gmail.com> References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <5716BB89.8030005@gmail.com> <571799B8.1060201@gmail.com> Date: Wed, 20 Apr 2016 11:17:06 -0400 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1133bd7862d3bd0530ec1706 Subject: Re: [PHP-DEV] [RFC:generics] From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") --001a1133bd7862d3bd0530ec1706 Content-Type: text/plain; charset=UTF-8 Sure, the usage of "instanceof" is an alternative to prevent declaring a new keyword. PHP doesn't have the same problem as Java does to enforce the first generic type information to be a class and others interfaces. So in this: class A {} interface B {} interface C {} class Foo {} Java required A to be the first due to its compilation process, which PHP does not have. PHP would accept any order of A, B and C there, like "C & B &A". PS: I like to use Java as a base for Generics because I feel it more well thought than other language implementations (like .NET and Swift). Regards, On Wed, Apr 20, 2016 at 11:01 AM, Rowan Collins wrote: > guilhermeblanco@gmail.com wrote on 20/04/2016 03:54: > >> 1- Even though mentioned, I'd still use "extends" or "implements" instead >> of "is" (which would be a new pseudo-reserved keyword) to enforce data >> type >> consistency and prevent developers to potentially referring to one thing >> while consider another. >> > > Perhaps "instanceof" would make more sense here? "class FileProcessor extends FileHandle>" seems to exclude instantiating > FileProcessor, because "FileHandle extends FileHandle" doesn't > make any sense. > > You could read "class Box" as an assertion that the > class passes the constraint, as in "public function __construct(T $t) { > assert($t instanceof Boxable); }" > > Regards, > -- > Rowan Collins > [IMSoP] > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Guilherme Blanco Lead Architect at E-Block --001a1133bd7862d3bd0530ec1706--