Re: [PHP-DEV] RFC: lazy statements

2016-07-24 Thread David Rodrigues
Dan Ackroyd wrote: > Yes, but the difference is in the surprise factor. > > Two functions having a circular dependency ==> not too astonishing, > and easy to think about. > > Reading the value of a variable having a circular dependency ==> give > up programming to become a farmer. Okay, so we can

Re: [PHP-DEV] RFC: lazy statements

2016-07-24 Thread Dan Ackroyd
On 24 July 2016 at 06:14, David Rodrigues wrote: > Now back to topic, this circular dependency too occur with functions. Yes, but the difference is in the surprise factor. Two functions having a circular dependency ==> not too astonishing, and easy to think about. Reading the value of a variabl

Re: [PHP-DEV] RFC: lazy statements

2016-07-23 Thread David Rodrigues
Dan Ackroyd wrote: > This looks to solve a problem very similar to the one solved by the > 'Memoize' annotation in HHVM - > https://docs.hhvm.com/hack/attributes/special#__memoize > However the memoize functionality seems a lot clearer to me, as it's > less 'magic'; it doesn't make accessing a var

Re: [PHP-DEV] RFC: lazy statements

2016-07-23 Thread Stanislav Malyshev
Hi! > This Feature Request is about the implementation of lazy statements. > > Basically it should implements a 'lazy' keyword (or similar) and > structured like an anonymous function, except that it doesn't accepts > arguments, but accept the use() feature. > > $var = lazy { return 1; } Is

Re: [PHP-DEV] RFC: lazy statements

2016-07-23 Thread Dan Ackroyd
Hi David, On 21 July 2016 at 16:51, David Rodrigues wrote: > This Feature Request is about the implementation of lazy statements. This looks to solve a problem very similar to the one solved by the 'Memoize' annotation in HHVM - https://docs.hhvm.com/hack/attributes/special#__memoize However th

Re: [PHP-DEV] RFC: lazy statements

2016-07-22 Thread David Rodrigues
> 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 valu

Re: [PHP-DEV] RFC: lazy statements

2016-07-22 Thread Larry Garfield
On Thu, Jul 21, 2016, at 10:51 AM, David Rodrigues wrote: > This Feature Request is about the implementation of lazy statements. > > Basically it should implements a 'lazy' keyword (or similar) and > structured like an anonymous function, except that it doesn't accepts > arguments, but accept the