Hello,
On Wed, May 28, 2008 at 12:12 PM, Gregory Beaver <[EMAIL PROTECTED]>
wrote:
> I've thought about allowing [] for a while and personally have come up
> with my own litmus test for new features.
>
> 1) is the syntax missing from the language?
> 2) if so, does the syntax add missing functionality or significant
> maintenance benefit?
> 2) if not, does the new syntax add significant value?
>
> #1 no, array() is the same [-1]
This is not a valid argument, in my opinion.
>
> #2 not applicable [0]
How can you dismiss whether the syntax adds benefit? If a single person
finds it beneficial it has a benefit, maybe not a majority benefit, but a
benefit none the less. Lots of people will find it easier to pick up coming
from other languages.
>
> #3 [-.5]
> * can't google []
If we are going to use google search as a determinative for language
decisions we got some major cleanup to do, lets start by removing curly
braces..
>
> * makes arrays simpler to type and take up less space
> * adds potential for confusion between array access and creation:
>
> $a['hi'];
> $a;['hi'];
>
> both are now suddenly valid PHP
As far as $a;[0]; goes, that is just a problem with useless contexts allowed
in PHP. Same can be done for $a;Array(0), which I doubt would cause
debugging problems (i do get your point). Really their are many places for
syntax errors, and php does allow a lot of useless syntax, like:
$a;;;$b;;;$c;;;;{{;;;{{}}}};;;;;;;;;;;;;;; ... that is perfectly valid
code. At the end of the day the developer needs to have sufficient ability
to debug their code.
>
>
> * syncs with javascript and other languages
> * opens pandoras box - PHP is simpler than Perl because there are not
> 20 ways of doing the same thing with different punctuation shorthands
>
See my previous post, 20 ways of doing one thing is part of the language
already, and what makes programming interesting.
> So I find #1 is -1, #2 is 0, #3 is about -.5
>
> Although the idea is somewhat attractive, I've found no drawbacks to
> array() syntax, and plenty of dangers with adding any new alternate
> syntax, and this ultimately makes my vote -1
Just my opinion.
-Chris