Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71606 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10011 invoked from network); 26 Jan 2014 22:28:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jan 2014 22:28:23 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.53 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.53 mail-qa0-f53.google.com Received: from [209.85.216.53] ([209.85.216.53:33177] helo=mail-qa0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/26-12631-60C85E25 for ; Sun, 26 Jan 2014 17:28:23 -0500 Received: by mail-qa0-f53.google.com with SMTP id cm18so6298918qab.26 for ; Sun, 26 Jan 2014 14:28:19 -0800 (PST) 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:content-type; bh=MdO6o3+Mkoj8N5ZTC7chQC/M6x3JfxclHQ6AfJWXE6c=; b=Fei/nZM3szYjXMSWNOv/dW5y5DAu+s+07iIBU2NDQYqZaBjezEiNxAzqoj4g3vvCzc O3+guwN1IDI2PvfEEt1OKwbQiVvnn/sjX0qqkoBTPFoaWe+P3U4qAHoVEKhEe0r3iPff akBfmbmSPhz+GybufhagIMRhgOGvaTjoXNQhl9Pc9OlKoCegxsNF3RoyLAQ7Vz5zAJoy 6vSoUvtypUYynsh5btkjYHDaYJ55i/+4ZfJ+DGRJO+VEucvspVakEGQBVLLXQpkKfeUT 2uq/RXdZiBa66acHy2gzPGuC22zi4KcwjbGmiJBwya1Gczkpfgk3d2/uHvEBhQjlQ29w XOhg== MIME-Version: 1.0 X-Received: by 10.224.36.129 with SMTP id t1mr38250354qad.8.1390775299898; Sun, 26 Jan 2014 14:28:19 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.229.240.193 with HTTP; Sun, 26 Jan 2014 14:28:19 -0800 (PST) In-Reply-To: References: Date: Sun, 26 Jan 2014 22:28:19 +0000 X-Google-Sender-Auth: ZF35tAkoYqaJutrR7KrOPPErx10 Message-ID: To: Philip Sturgeon Cc: "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV][VOTE] "Array Of" v Generics From: daverandom@php.net (Chris Wright) I'd also vote C. The general response I've had from everyone I've spoken to about this is along the lines of C, but opinion is extremely divided over whether typed arrays should have a syntax that echoes generics or not. At first I was firmly in the Foo[] camp but I have come to like the idea of array. In the context of PHP, with an absence of "proper" arrays, they really have no semantic difference, and it makes sense to make them syntactically analogous. Thanks, Chris On 24 January 2014 03:20, Philip Sturgeon wrote: > 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. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >