Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71183 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17758 invoked from network); 16 Jan 2014 12:51:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jan 2014 12:51:26 -0000 Authentication-Results: pb1.pair.com header.from=rdlowrey@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rdlowrey@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.176 as permitted sender) X-PHP-List-Original-Sender: rdlowrey@gmail.com X-Host-Fingerprint: 209.85.223.176 mail-ie0-f176.google.com Received: from [209.85.223.176] ([209.85.223.176:41588] helo=mail-ie0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/25-24763-DC5D7D25 for ; Thu, 16 Jan 2014 07:51:26 -0500 Received: by mail-ie0-f176.google.com with SMTP id lx4so3681540iec.21 for ; Thu, 16 Jan 2014 04:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=VEc/5VMAcpfIhb3lddzJ+pK43BaICZn+olGcXWrWEzQ=; b=P5qDCrDVetZN0ofVCxNK/6acv33Sv4bSdgMWkoIfR+1C6xS8WiR8d/K5R41lIgrrCR 9PaTZsLOBUStbhNSDQph+IxFjn9Jq36xF37PbKjYaWnHsx1hJdyEwJX8YDIpKZZh0iXw uYt+QXMPPOJCXpUDWEmkC37e27bvSUF2TMq3W0ZS1lwyTzpupyCEfW4Czh8PL1g56L/6 Mm57ZYB+xWe12MBYXAkvioKsDj4DgMZemlpjyBoHYhtXQXMCBItHNM6bnDT91m0Os7zM Iqq+ykjTz+Ch4NeYX2JOej0nByg9dZhZuE3m4TwkoytqBh9Ewk+Illv7SBwUiYvjdoP8 pirg== MIME-Version: 1.0 X-Received: by 10.42.197.134 with SMTP id ek6mr163237icb.97.1389876682949; Thu, 16 Jan 2014 04:51:22 -0800 (PST) Received: by 10.50.29.140 with HTTP; Thu, 16 Jan 2014 04:51:22 -0800 (PST) Date: Thu, 16 Jan 2014 07:51:22 -0500 Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf303ea61af80abc04f015e1fe Subject: Re: Introducing "Array Of" RFC From: rdlowrey@gmail.com (Daniel Lowrey) --20cf303ea61af80abc04f015e1fe Content-Type: text/plain; charset=ISO-8859-1 > I gave the RFC a few more thoughts and came to the conclusion that it > does not fit to PHP (due to the performance penalties involved). > The syntax merely hide an ugly design. As a fan of generics I hate to say it but I'm leaning in this direction right now as well. > Then it is still bad design compared to a collection which actually > does the check during the addition of elements. Again, I'm agreeing here. This functionality exists right now: interface WidgetCollection { function addWidget(Widget $widget); } interface CollectionAcceptor { function accept(WidgetCollection $wc); } In my opinion the additional complexity burdening the type system for this feature outweighs the potential benefits. Are generics a nice thing? Sure. I'd like to have them. However, I'm very uncomfortable with this RFC. Good design means removing everything you can -- not adding everything you can. That applies to languages just like every other form of design. Just because we can doesn't mean we should. The explanation from Go about why it doesn't have generics sums up my feelings pretty well: Generics are convenient but they come at a cost in complexity in the type system and run-time. We haven't yet found a design that gives value proportionate to the complexity, although we continue to think about it. I would think long and hard before incorporating this kind of additional complexity going forward. I'm just not convinced right now. --20cf303ea61af80abc04f015e1fe--