I don't really consider myself worthy to preach to the Powers That Be,
but this is an issue about which I happen to feel strongly, and y'all
asked for some user-land opinions, so here goes. To further clarify
(and disclaim), I have never spoken up on this list before, I haven't
until recently (circa 5.3-related discussions) followed it much. I
certainly don't feel that I'm in any way entitled to a voice here, for
the aforementioned reasons, so if you did take a moment out of your
day to read, thanks for a bit of your time and consideration. Even if
you completely disagree, hopefully you get a good laugh out it; I did
my best to make it an entertaining read.
For me, this argument really comes down to two main points, which I'll
summarize below, and then go on to describe in detail:
(1) It will bring happiness to users, and warm the hearts of little
boys and girls all across the land
(2) Almost every single argument that has been brought up against the
implementation of this feature is either bogus or largely irrelevant
Detail:
(1) Happiness:
This fact has been pointed out previously, but it bears repeating: the
divide between users and committers on this issue is stark: only 1/3
of committers are in favor, but almost all users who have voiced
opinions on the issue are in favor. The people actually using the
language want something new, because in this case something new is
better. Come on guys, arrays are our bread and butter. PHP has more
support for working with arrays than it does for doing pretty much
anything else. Arrays have been the basis of most of how we interact
with PHP for years. Even after objects were added, support for them
up until recently has been less-than-completely-ideal. I'm not saying
that as a complaint, just to further emphasize the point that arrays
are embedded into the core of every PHP developer.
To the counter-argument that you're only having to type 5 extra
characters: yeah, sure, for *one* array declaration, but think of how
often arrays are used. Multiply those 5 characters out over all your
data containers, all your loops, all your method-calls-with-options-
arrays. You'll see that those 5 characters start to add up reeeaall
fast. And on nested arrays? Don't even get me started.
This change would help clean up and simplify a lot of code, and make
the daily experience of working with PHP code that much more
pleasant. So please guys, consider putting in the little bit of extra
effort to see this feature through. Arrays are the most basic and
essential language construct we have, and the returns on making them
even just a little bit easier to work with will be huge.
(2) Irrelevant and bogus reasons:
Look, almost all of you are smarter than me, and more experienced
programmers, but I think you guys really missed the boat on this one.
I get that you've been with the language forever and have gotten kind
of set in your ways. You've grown resistant to change to the point
where you're hardened against it. I dig. Believe me, I've been
there. So, you've come up with reasons not to change. I've done my
best to respond to each of them individually, in hopes that you'll
step outside the same old way you've always made decisions, to
consider that maybe this is actually a good idea after all.
(1) Readability: There are roughly an equal number of arguments for
and against this, which I find very telling. Both sides of the
argument are equally true, and therefore cancel each other out. See,
syntax is a tool, and as we know, tools can be used for good or ill,
to equal and opposite extents. People who write unreadable code will
continue to write unreadable code using this syntax because it's more
compact. People who write readable code will continue to write
readable code using this syntax because it's simpler and more concise.
(2) Lack of Googlability: Guys, seriously, it's a language
construct. PHP programmers have never been able to Google curly
braces or double arrows, JavaScript programmers have never been able
to Google the fact that you can't extend a class even though there's
an "extends" keyword, Python programmers have never been able to
Google whitespace, and Perl programmers have never been able to
Google... well, a bunch of crazy shit.
(3) N00b Confusability: To some extent this ties into #2, and also to
some extent #1, because we're dealing with n00b cognition, and as with
#1 there are rougly equal and opposite arguments on both sides. This
is kind of a two part-er, since you can *sort of* argue it on the
basis of recognition, but on the other hand, you really can't argue it
at all, either way. Or at least, no one participating in this
discussion can. You see, the problem is, no one participating in this
discussion can currently or could have recently applied for n00b
status. We are all so far from n00bs, that (at least when it comes to
this issue) it is almost completely impossible to try and speculate
about what will confuse a n00b; you just can't do it. The only way
figure out whether or not n00bs would be confused by this syntax
construct is to find some n00bs, sit them down in front of a code
example or two, and ask them. That's right, a n00b focus group. One
rule: no code examples where it's retardedly obvious that they've been
contrived in order to prove a point. Only things that you would
reasonably and commonly find in the average PHP app (yeah, I know, I'm
not exactly setting the bar very high, but still).
Now, I did say there was one way in which you could possibly try and
speculate about this issue without tracking down any actual n00bs:
recognizability. Okay, ready? Clear your mind, and pretend you know
nothing about PHP, you've never seen it before. Now, someone shows
you a set of comma-separated values enclosed in square brackets. What
does it look like to you? What does the token parser in your brain
tell you that thing might be? If you have even a passing familiarity
with any other modern web language, the answer should be immediately
obvious. Heck, even if you've never written a line of code in your
life, but you know a little bit of math, you should still be able to
get the gist. Now, if you don't know math, and all you've ever done
on a computer is peck out emails to your grandkids, or you're from
Zimbabwe and you've never even seen a computer before, then why the
heck are you trying to figure out how to program without a manual?
(3) Maintenance: I've never maintained a programming language before,
so I can't really speak to this one beyond speculation and what's
already been said. To me, it doesn't seem like much -- just a new way
to define an existing language construct. To me, it seems like the
kind of thing you could just set and forget. But what do I know? So
here's my offer: if two core committers, or even just one, were
willing to champion this feature, I will take full responsibility for
coming up with funding to see it implemented... and maintained --
$100US per hour of development time.
Finally, as Andi and Rasmus have both pointed out, the language needs
to grow. It needs to grow, because things that don't grow begin to
die. Please don't let my language of happiness die! Please? Won't
you please think of the children?
Again, thank you all for your time and consideration.
- Nate
Lead Developer, CakePHP
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php