Den søn. 16. jun. 2019 kl. 01.09 skrev Wes <netmo....@gmail.com>: > > Declaring variables or specifying which ones to import. Essentially it's > the same thing, so what gives? It's PHP's syntax, IMHO, that makes the > thing irritating to write :D
The proposed syntax was also that of the proposed syntax when closures arrived in 5.3 (and back then it was using the then keyword 'lexical'), anyway. I believe the current syntax was chosen due to scopes, as values are bound specifically when the closure is created and not when the closure is executed. For example if you have a function that returns a closure and the closure imports a variable local to that and then later call it from a different scope, that means we need to keep that old scope alive until then which can be rather problematic, instead it was decided back then to have the import of parent scope variables as apart of the prototype as it is possible to capture the value in the Engine at this point in time. I agree its odd but I would much rather keep the current implementation. Also in regards to the RFC, if you have massive argument lists like in the RFC then I think you should re-think your design and put such complex computations into separate methods which also encourages better testability. -- regards, Kalle Sommer Nielsen ka...@php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php