Live data from Hacker News

PHP Short Syntax for Arrays: developers say no.

wiki.php.net

21–30 of 89 posts

Re: PHP Short Syntax for Arrays: developers say no.

#21
post #16

Why try to make PHP more readable? Just use another language. PHP, like C++, is a big industry dinosaur that can't and won't change. In my opinion, the best think you could do is create a new language which compiles to PHP. I.e. A coffeescript for PHP. You don't have to "vote" and get stupid arguments against; you don't have to be backward compatible; and you only have great programmers in that project since crappy o…

> coffeescript for PHP

Make this happen please. I can't think of a more deserving language and it'd make my day job a lot nicer.

Re: PHP Short Syntax for Arrays: developers say no.

#24
post #4

Contra ... Not searchable through search engines That's a ridiculous argument.

> That's a ridiculous argument. Considering how widely taught (and self-taught) PHP is, I think that's pretty important, if only from a business perspective―if people don't learn your language, they don't buy your licensed books, and they don't need your technical support because they never built anything with it.

I've used PHP for ~12 years and never found myself searching for something involving an instance of array syntax.

Re: PHP Short Syntax for Arrays: developers say no.

#25
post #22

I'm of the opinion you should be writing your PHP in a readable fashion similar to this: $foo = array( 'bar' => TRUE, 'baz' => 'socks' ) (pretend you also have proper tabs as well)

Sure but this seems better:

    $foo = [
      'bar': TRUE,
      'baz': 'socks'
    ]

Re: PHP Short Syntax for Arrays: developers say no.

#27
post #7

$a1 = [1, 2, 3]; $b1 = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon']; $b2 = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon']; $a1 = array(1, 2, 3); $b1 = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'); It would be a nice change to have, but the syntax isn't -that- much better. A compromise might be: $b1 = array('foo': 'orange', 'bar': 'apple', 'baz': 'lemon'); But even then, you only save two…

The less visual noise the better.

Re: PHP Short Syntax for Arrays: developers say no.

#28
post #22

I'm of the opinion you should be writing your PHP in a readable fashion similar to this: $foo = array( 'bar' => TRUE, 'baz' => 'socks' ) (pretend you also have proper tabs as well)

Sure but this seems better: $foo = [ 'bar': TRUE, 'baz': 'socks' ]

It's kind of JSON-wish, so this would make more sense:

    $bar = [1, 2, 3];

    $foo = {
      'bar': TRUE,
      'baz': 'socks'
    };

Re: PHP Short Syntax for Arrays: developers say no.

#29
This is why I stopped reading the dev mailing list. It was too frustrating to see (IMO) awesome features and suggestions constantly swatted down for (again, IMO) stupid reasons. Not searchable through search engines? Give me a break! I didn't know I was supposed to be writing code for Google. There are _so many_ higher priorities.

I think PHP is going to remain all but stagnant until there is a sea change in the core developers. I'm not sure what their true motives are... laziness? underlying dislike for the language? Whatever it is, all they seem to do is swat down every request, even when (as is the case here) the users are _begging_ for it.

It's like if they can come up with any reason at all not to do it, then they don't. "We already use square brackets for other stuff." Give me a f--king break.

Re: PHP Short Syntax for Arrays: developers say no.

#30
post #28

Earlier quoted context omitted.

Sure but this seems better: $foo = [ 'bar': TRUE, 'baz': 'socks' ]

It's kind of JSON-wish, so this would make more sense: $bar = [1, 2, 3]; $foo = { 'bar': TRUE, 'baz': 'socks' };

This is more perlish, with the exception of the map delimiter. If you proposed => it would be identical to perl.
Post reply on HN