Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92548 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55045 invoked from network); 20 Apr 2016 15:12:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 15:12:36 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.26 out2-smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:46070] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/DC-14036-26C97175 for ; Wed, 20 Apr 2016 11:12:35 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 8BD7E2074D for ; Wed, 20 Apr 2016 11:12:32 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Wed, 20 Apr 2016 11:12:32 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=qNWyIX2ma2q5WK3 gPkRTsUBtxvw=; b=aCyoUmdi/fIUi5YyjySvu2o5kINyTWpqX8V6jlCR/GD/DO/ Ne+rKH7tCr9L7GX8MjprKYXu8CkZ7LVVrt2/FKzS+/5iST+VtMMd3UiIUFz9R+ZP GTs5B4cdYV+XBx9RsCVNNt4xEgy7fz3bVuNz0fB8MhXP2qBTQHtuJwIfCzEs= X-Sasl-enc: FkEbhcplQUmyzFdfdx7sSmeFiVVW3deLTqPFt2uAqePK 1461165152 Received: from Crells-MacBook-Pro.local (unknown [63.250.249.138]) by mail.messagingengine.com (Postfix) with ESMTPA id 49B14C0001A for ; Wed, 20 Apr 2016 11:12:32 -0400 (EDT) To: internals@lists.php.net References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <5716BB89.8030005@gmail.com> <571799B8.1060201@gmail.com> Message-ID: <57179C5F.9090101@garfieldtech.com> Date: Wed, 20 Apr 2016 10:12:31 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <571799B8.1060201@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC:generics] From: larry@garfieldtech.com (Larry Garfield) 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" 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