Re: Proposal: Array syntax
| From: | Michael Walter | Date: | Wed, 05 Nov 2003 20:26:36 +0000 |
| Subject: | Re: Proposal: Array syntax | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-5269@lists.php.net to get a copy of this message | ||
Marco Tabini wrote:
George Schlossnagle wrote:Not really understandable, though.On Nov 5, 2003, at 1:29 PM, Marco Tabini wrote:I think I've already explained why.$a = [1,2,$b[11]] is semantically inconsistent.How so? Is
Yup, I told you I meant something different (although on the same line of reasoning). I think you misunderstand "semantics", anyway. You should not think of array() as a function, as basically everything else except to the syntax is different to "real" functions, consider call_user_func('array', 1, 2, 3) or array_map('array', array(1, 2, 3), array("Foo", "Bar", "Baz")); How much better would look map('array', [1..3], ["Foo", "Bar", "Baz"]); anyway.. (although we really should not argue about that, as it's simply taste).foo(array(1,2)); semantically inconsistent? On one hand () is used with a language construct (array()), whereas in the other context it indicates arguments to a function. I think that is what he meant by 'grouping' and 'application'.Actually, I think it meant something else. In any case, semantically you can still think of array() as a function (until you throw in key declarations, of course ;) )
That is a statement backed up by good argumentation. :)Similar tokens have different syntactical meaning all over the language. Compare '<<' and '<<<'. To me that is no diffent that <variable>[] and [].Again, that's not a good reason to introduce more.