Live data from Hacker News

PHP Short Syntax for Arrays: developers say no.

wiki.php.net

11–20 of 89 posts

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

#12
post #11
post #4

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

I think "search engines" might be a little misleading, it's not readily grepable locally either.

But that is common to most languages. Arrays are something fundamental enough to warrant a place in language syntax.

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

#13
I'm not sure this is entirely accurate, last time it was voted on the dev list it was narrowly defeated.

The topic was then resurrected about implementing in the 5.4 release and the objections didn't seem to be as strong this time around.

So the rejected status doesn't mean that it won't happen in 5.4 just that that was the previous status of the changes.

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

#14
post #5

I've been wanting this for a long time, seems like a no brainer to me. It'd be nice to add some of the nice syntactic sugar that other languages have. Kinda strange that they have both readable and unreadable listed as both pro and con...

I don't think that a concise method of working with arrays should be thought of as syntactic sugar, not if you mean it in a pejorative way. I found array_map, array_filter, array_key_exists, array_this, array_that painful to write, but never felt that I was gaining any sort of readability for it.

No I meant "syntactic sugar" in a good way, i didnt realise it was a pejorative.

I mean it as per the definition on wikipedia:

  Syntactic sugar is a computer science term that refers to syntax within a programming language that is designed to make things easier to read or to express, while alternative ways of expressing them exist.

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

#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 ones will just continue to use their 1500 lines unmaintainable functions anyway.

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

#17
This does not seem reasonable. I mean that literally -- this feels more like a choice driven by culture than by reason.

The cons seem nowhere near strong enough to counter the fact that the overwhelming majority of users want this syntax, and have been asking for it for years.

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

#19
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…

But why not make it more readable? The patch exists - all it would take is for it to be accepted.

And there are a ton of people who can't justify the switching costs of moving to a different language. And true, a lot of us aren't great programmers. So?

Better tools help. And it's perfectly okay to build and improve tools that regular people will use. Even if they won't be creating the Mona Webapp. ;)

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

#20
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.

Post reply on HN