Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92555 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69320 invoked from network); 20 Apr 2016 16:01:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 16:01:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=jesseschalken@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jesseschalken@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.175 as permitted sender) X-PHP-List-Original-Sender: jesseschalken@gmail.com X-Host-Fingerprint: 209.85.223.175 mail-io0-f175.google.com Received: from [209.85.223.175] ([209.85.223.175:35882] helo=mail-io0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/8F-14036-8C7A7175 for ; Wed, 20 Apr 2016 12:01:12 -0400 Received: by mail-io0-f175.google.com with SMTP id u185so56946141iod.3 for ; Wed, 20 Apr 2016 09:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=4yVCnOGC1ckXn4AyYyJ4ILmlYDxtctHT6b08HmeYlDM=; b=xCnGw5AQZIzoz1SL4dpHQPPJrdvbQJhIoaQqBErK5xu1uJlYErkHqOuCgsWHuIXyp/ yUA86kiEQwIMvMO+SzvmFZaB/QhY4MrI5lxoh4vkQDRRRb97JJgtTesQPJqpe8lSeYZX ZS9BfFO55n4C03tlYDl/0gdXRRXrjjh+JduBXBb1lv18nyUkTO1fZ27+pIXynxDZLCq0 IXC4YV5as3LTtlvpmqoTcggb/Ic6CJzXS0nUdv3iJn3P3sYWvKuW4e13cPuTJjFKuzaT 1G4icH0G0RGfjehQhSt4ql3cblwGkSk1/eFlGLCdPGqb4+qoVPiDI0NOPtKUjA38BRsP S02A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=4yVCnOGC1ckXn4AyYyJ4ILmlYDxtctHT6b08HmeYlDM=; b=kafrsZRiiT1Ts9a3suRcWCBHeOhAuwhxtilx4oqgjxEL4AaOY0YubP7tj4XC9dCOsW JSopzwaNc4F5TXXQXuFofHm9FAeZYLLo0MDGnWQvVaUz81goOCKF3YODYtEXdyiy3kPe caQv3bdfuNA3HJUM+IGD6xiyBrP5EDtV8v4D84MUo60VLlPW1OEoO2lQ2L8KZdjY+P7t gipQlJtzWtkWgn4FHfEHt+KN6GXVynulnVHNXDQ0gt8uLFiI4800CgtSoJP8VtOSksRg mi7P9UwNntPkxrk25pS7EGdA51a1fMvb6ZWO9HcYijJzDHVbIh364LkhuwxzCoMdO8Zr IBVg== X-Gm-Message-State: AOPr4FWgzA5oLj2u6PjzjyoYWhvEgUsWPJu2hR6pgV15Ew5B8GYBZ8URE7AsKW2WNtX3IYeWYBzmIWD4vi6Hcg== MIME-Version: 1.0 X-Received: by 10.107.137.101 with SMTP id l98mr10895659iod.31.1461168069495; Wed, 20 Apr 2016 09:01:09 -0700 (PDT) Sender: jesseschalken@gmail.com Received: by 10.79.139.133 with HTTP; Wed, 20 Apr 2016 09:01:09 -0700 (PDT) In-Reply-To: <57179C5F.9090101@garfieldtech.com> References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <5716BB89.8030005@gmail.com> <571799B8.1060201@gmail.com> <57179C5F.9090101@garfieldtech.com> Date: Thu, 21 Apr 2016 02:01:09 +1000 X-Google-Sender-Auth: s5jozjVoDNU0ZwemYrBl7v-Y3Zs Message-ID: To: Larry Garfield Cc: PHP internals Content-Type: multipart/alternative; boundary=001a113ed540bd711d0530ecb389 Subject: Re: [PHP-DEV] [RFC:generics] From: me@jesseschalken.com (Jesse Schalken) --001a113ed540bd711d0530ecb389 Content-Type: text/plain; charset=UTF-8 Yes, if you have "class Box" and T is used for two things, then "they must be of the same type, but they can be any same type and that type must at least be Boxable". It means that Box can use a T as a Boxable (call Boxable methods on it, etc). On Thu, Apr 21, 2016 at 1:12 AM, Larry Garfield wrote: > On 4/20/16 10: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, >> > > I'm not an expert in generics by any means, but how is that different than > just > > public function __construct(Boxable $t) {} > > I thought the point of generics was for cases like "these two variables > must be the same type, but they can be any same type." > > -- > --Larry Garfield > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a113ed540bd711d0530ecb389--