Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71474 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35875 invoked from network); 24 Jan 2014 03:20:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jan 2014 03:20:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=pjsturgeon@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pjsturgeon@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.169 as permitted sender) X-PHP-List-Original-Sender: pjsturgeon@gmail.com X-Host-Fingerprint: 209.85.217.169 mail-lb0-f169.google.com Received: from [209.85.217.169] ([209.85.217.169:44679] helo=mail-lb0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/C2-39789-81CD1E25 for ; Thu, 23 Jan 2014 22:20:57 -0500 Received: by mail-lb0-f169.google.com with SMTP id q8so2162124lbi.0 for ; Thu, 23 Jan 2014 19:20:53 -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=PWs/zBqUcV8De8OlPi0FRsXCYUeP0sVf94JnTUur2hE=; b=ZvYmnVsX9vZ7CIHPXl+sjGEYBIeqYQ2VM54PN6kGTkbbdJGvGkLkv3NWSPJMqsRaJq LZyAtQARy3Wgz8n9+9ZP0dVHmZTK0gWe5SGCqIf8X/vQo5nQRhuo1XdNtjcd65TjQqHO /ahl4C1ACsfs8Tp8SG4ATQH6X10uYRIVpDWpF8Lqd1sj9LDGhoEJcXmEvCP01Tl+ojVh /ZTf3h9aOGFBb8yY337SlDHMk4jAXAHDj2GP8xzjWetv1RHv55hsEM89kCovqGt/VPE1 5nLCWCNqvWqq/JJz76T2hLgorJpwcSy5szY2nQThxDO6NGdCw/jcxt1yFmZM0G8TcjZY oniA== MIME-Version: 1.0 X-Received: by 10.152.170.199 with SMTP id ao7mr73617lac.40.1390533653563; Thu, 23 Jan 2014 19:20:53 -0800 (PST) Received: by 10.114.66.44 with HTTP; Thu, 23 Jan 2014 19:20:53 -0800 (PST) Date: Thu, 23 Jan 2014 22:20:53 -0500 Message-ID: To: "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: [PHP-DEV][VOTE] "Array Of" v Generics From: pjsturgeon@gmail.com (Philip Sturgeon) In recent discussions we were weighing up the options of array of and generics came into conversation, brought forward from the Hack language by Sara G. I was wrong about one thing: Generics CAN have setup outside of the type-hint, much like a collection, but it is not required. I thought it was. This means that array of could easily be considered "weak-generics" and the two features can share the same syntax without confusion to the user. A few of you said that, so sorry that I disagreed. ;) Before we worry too much about that, the logical next question is: Is there any interest in generics? If there is interest, then one syntax would be preferable over the other. With the existing proposed syntax for "array of", it looks like this: function(Spanner[] $spanner) Evolving that same syntax into generics would look something like this: $tool = new Spanner[]; $tool = new int[]; That would be... less than ideal, but its nice and simple for the type hints. Using the generics syntax for... generics: function(array $spanner) $tool = array(); Obviously angle-brackets are a bit new, but that same syntax works for both. These examples are provided to make a point, and the syntax is not definite. The point here really is that If we care about generics, then using generic-like syntax for this feature probably makes sense. If we don't care about generics, then there is probably no point using this more verbose syntax for simple "array of" type-hinting, but the syntax could still easily change. Can you lot vote A, B, C or D to show your interest? A) I want Array Of, but not Generics B) I want Generics, but not Array Of C) I want both D) I want neither Nothing really binding here, its more of a survey than a vote, but it should help with the next steps.