Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71478 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49799 invoked from network); 24 Jan 2014 06:03:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jan 2014 06:03:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.180 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.128.180 mail-ve0-f180.google.com Received: from [209.85.128.180] ([209.85.128.180:43865] helo=mail-ve0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/05-39789-72202E25 for ; Fri, 24 Jan 2014 01:03:19 -0500 Received: by mail-ve0-f180.google.com with SMTP id db12so1670324veb.25 for ; Thu, 23 Jan 2014 22:03:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5WV7Qa+shjOsDJhfuaLgfXzFFNdpCec/9DhOFJuoWOw=; b=uljxiRZdyFwudOR3u5vJE4VhyW5wSwURwbqjIDLObh4yv90H/vr6xesItKabY/wajB 6GlTIfnuz82wzzt8smZfRRPToSSS9Ue2LXHmQK/MEgeI3EhkHq/WrneZ36oJyZrgHMQ9 +F09UUI3InIiTQvvpTaHC+YLZifgdojykEH+CuOxaqGOG06rZ4aUvb4q5K7rkya1ceXL VozQaJTGTXpajGlUeLEAS6bsq0KvPPd50OAl8BUlzOatPh/vXjHOzD2xguxMwn8YUK9T fDIau8Syrpp5NY1oczX9HFCkKkCFEHsBHw1hHLlCzCZK5HktxEMOqwStX4moDDOIGr0b Ev4w== MIME-Version: 1.0 X-Received: by 10.58.7.1 with SMTP id f1mr6513215vea.15.1390543396390; Thu, 23 Jan 2014 22:03:16 -0800 (PST) Received: by 10.58.133.229 with HTTP; Thu, 23 Jan 2014 22:03:16 -0800 (PST) In-Reply-To: References: Date: Fri, 24 Jan 2014 14:03:16 +0800 Message-ID: To: Philip Sturgeon Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b6dce842fcc1c04f0b11d82 Subject: Re: [PHP-DEV][VOTE] "Array Of" v Generics From: tjerk.meesters@gmail.com (Tjerk Meesters) --047d7b6dce842fcc1c04f0b11d82 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Jan 24, 2014 at 11:20 AM, 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 > Or you could finish up the "array of" proposal and put that to a vote. If accepted, then A) or C) applies. If not accepted, then B) or D) applies :) > > 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 > > -- -- Tjerk --047d7b6dce842fcc1c04f0b11d82--