Gregory Beaver wrote:
Jeff Griffiths wrote:
Antony Dovgal wrote:
...
Well, to me it matters whether the author is going to care of the
thing he's proposing or he's going to disappear right after it's
implemented.
I didn't realize there was a section of the code flagged 'syntactic
sugar' and only a few people maintained that part. it also seems
ridiculous to debate a syntax *addition* such as this in terms of
maintainability. Is it really is hard to maintain this patch to the
parser? How hard is it to maintain this:

$array[] = $foo;

...vs any other part of the codebase?

Whoa, slow down cowboy!

Ok!

Any change to the parser can have unexpected and even bizarre
ramifications in code.  For instance,

$a = $b([0]);

would become perfectly legal syntax, and although it is pretty to those
of us who pine after ASCII art, its action is not as obvious as:

$a = $b(array(0));

That's a matter of perspective, I parse JS code as easily as I do the above, because that's what I'm used to. I do think this type of 'terseness vs readability' debate about this syntax addition is perfectly valid and I think *users* of PHP like myself have a place in that debate.

...
Now, this may sound blunt, but the tone of your message suggests you
haven't worked much with parser generators or lexer generators in C.
They're one of the more quirky and finicky aspects of PHP internals, and
seemingly simple changes can result in ridiculously complex problems.

You would be right about that, but I guess I had assumed the patch was solid seeing as no-one has argued against it based on its technical merits. I did qualify the above: "...vs any other part of the codebase?".

If there is a technical reason why you shouldn't commit this patch ( it's buggy, etc ) then I am happy to concede the point to people who know much more about this than I do. Most of these threads on this proposal seem to be based on the usability / readability / ephemeral qualities it will bring to PHP, and not on whether it works or not.

I am used to arrays, and find them intuitive.  I am a bit concerned
about code like this rearing its head:

if (1) {
    $a = [
        [
            ['a' => 1, 3],
            ($b = 3),
        ]
     ];
} else {
    $a = [
        [
            ['b' => 1, 3]
        ]
     ];
}

I agree, that's a bit nasty. =)

"bracket hell" is not something I've associated with PHP much, and the
new syntax would definitely make it possible, but would also simplify
the amount of spurious stuff on the screen for me in my work if used well.

So, I am +0.5 for [] syntax in principle.  I have not examined the patch.

Assuming the patch is fine ( which I have happily done so far ) it seems this proposal is at best controversial.

JeffG

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to