2012/7/26 Rasmus Lerdorf <ras...@lerdorf.com>:
> A generator is enough like a function that we
> don't need a new keyword for it. We typically don't get too pedantic in
> PHP concepts and try to keep things simple. What we call an array isn't
> technically an array either.  It's an ordered map, but it looks enough
> like an array that it is simpler to just call it that.

Hm. I thought a long time about this. Has a technical component and
opens up a philosophical questions.

The technical part: There're many not so well made concepts in PHP.
I'm here with your opinion, we shouldn't rename arrays to ordered maps
and so on. Should be only changed if really needed.
Generators here are different. Reasons:

A) They are new. They're not ready yet. We can change them.

B) You say "They are functions enough to be used like a function."
Won't this lead to a point when we say "Ok, lets use function for
nearly anything"? Is an array of functions not also a function? :)

What I mean: Is it good to soften a weak concept more than really needed?
It doesn't matter how we name new things, but they should be
distinguishable, self-explaining, *not only* because of the new
feature, but also because of the old one!

C) I deleted this point and was too lazy to rename the others. :)

D) If we have options in development, which all are more or less right
and it can't be decided between them, then it's in general always
right to choose the option, which offers more opportunities. In this
case to choose a new keyword, because it gives us the option, that if
we find out, that it was a bad idea, we can go back to the current
implementation or choose another. This isn't possible, if we choose
the current implementation. Ok, it's possible, but the reasons must be
really, really hard in this case.

E) Generators are a relatively new concept. There may be more such
ideas, better ideas, changes, and what then? See D)



My (more or less) philosophical arguments are (maybe this part will
become a little bit off-topic):

1) The bigger the language grows, the more we need to think about how
to implement new features.
I think it's a bad argument to say "we made this and that not so
ideal, so we can make this also. Don't be so idealistic." :)
I think it's a duty to make new things more logical and more
self-explaining and more fitting into the rest. Always, and the bigger
it is, the more it must be done.

2) We should do things better, if we can.
This opens two questions. First: Is a new keyword better than none,
second: can we?

The first is really difficult to answer. Of course democracy will decide.

The second is already answered, it's currently just a question of
naming. If we want we'll find a name.

3) When implementing new things, my opinion is, that conservatism is a
luxury good, because once implemented, it will only be changed, if
really needed. See D). And from 2): We should do things better. This
means if possible and not if really needed.

4) We're no parliament, where we are voted into to deliver wishes.
We're free. These means two things: We don't need to look at the
"mass" of PHP-programmers, which never heard about this new feature
before they first will see it. But we can. And maybe we should,
because they are the users of what we do.
And we don't need to look at all the others. There is just no need to.
They didn't even use PHP. :)

-- 
Alex Aulbach

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

Reply via email to