Hi,

1) The RFC page says that closures pass by value by default. Although it is not stated, am I correct in saying that due to the way resources and objects (and presumably therefore lambdas) are handled they will still have the effect of passing by reference anyway, just as with a function parameter?

Yes, of course. :)

2) It is unclear from the RFC if static class closures (I am not fond of that syntax, I grant) are the only ones that won't import $this. Is the suggested detection optimization not included, and therefore it's up to the programmer to avoid dangling references that keep stray classes around?

It's up to the programmer for now, static => no $this, no static =>
$this.

3) Can __invoke() accept parameters,

Yes.

4) The ability to reflect and then call a function or method as a closure sounds highly nifty. However, I am unclear on why it is necessary to pass in the $this to use. In that case, wouldn't it make more sense to use ReflectionObject() in the first place so that the $this is implicitly known?

Probably. But if we start picking on every detail of the patch until it
is absolutely perfect, it will never get committed, not even to HEAD. So
I propose that it should be committed to HEAD (as long as there are no
major objections) and then worry about tiny details afterwards.

5) There's a couple spelling and grammar errors. :-)

Feel free to correct them if you have access to the wiki.

Regards,
Christian

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

Reply via email to