2012/7/24 Gustavo Lopes <glo...@nebm.ist.utl.pt>:
> When you have function foo() { ... yield /* ... */; ... } and
> you call foo(), you get the same thing every time: a Generator object. It so
> happens that the implementation of that object is inside the body of the
> function.

Hmmm. It's not that I didn't understand it. :)

My thoughts are about usage in practice. Ok, my first argument with
the developer, who overtakes an old project was weak.
What about situations, when developers with different knowlegde work together?

Or when you have programming errors, when you write

function blubb()
{
... yields...
...
... return....
}

(you may only see the "return").

And many those situations are thinkable, because this kind of PHP
function works so totally different from current.


> Maybe this helps you reason about the feature.

Please understand me, it's not that I don't like it or that I couldn't
live with it. It's because I have too much experience what could
happen if new programming features are introduced.

For example: Exceptions in PHP are quite old now. And the concept of
exceptions should be known. But I worked together with programmers
wich produced code like

...
try {
     $value = method_which_throws_exceptions();
} catch (...) {
     return $value;
}
return $value;
...

And he has it done, although I wrote some example code for him how to
use exceptions in this context!!11!


THAT'S the reality.

We can ignore that, but I just want to make such simple mistakes not
so easy and the afford is worth the results.

You can argue: "Those mistakes will always happen". I say "Yes, of
course, but if we have the chance to reduce those mistakes we should
do it."

-- 
Alex Aulbach

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

Reply via email to