Re: RFC: lazy statements
| From: | David Rodrigues | Date: | Fri, 22 Jul 2016 19:00:20 +0000 |
| Subject: | Re: RFC: lazy statements | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94639@lists.php.net to get a copy of this message | ||
> However, that also means there's an enormous potential for race
> conditions. Technically no more than closures now, but the use cases
> seem like they'd make it more prevalent. If you "use" by reference, or
> use a mutable object, or a service that depends on IO, etc. then the
> resulting value of the lazy variable is not technically
> non-deterministic, but will certainly feel like it to the developer.
I think that lazy statements should not be used when you can have
possibilities like that. It should not be a substitute to methods.
So, for instance, if I have a mutable dependency, is better I create
a method to do that, that could work better with that.
I can think about how we can handle this, but I need a real case
where this problem can exists. Can you help with this?
Thanks!