Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Alexandru Pătrănescu
Hi, If at some point we would have multi-statement body arrow function, I would assume that one option would be to have the closure done automatically, as it is done now on the one-line arrow function. If the values will not be implicitly captured, maybe a new syntax to capture can be designed

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread M. W. Moe
Hello, if you are upset; it's not the place here; your argument is efficiently based on problems of indentation and handling commas properly. Moreover, but not least, you have no idea what a lambda is; if we admit it what you propose; that is not feasible in PHP; why? because it would require a

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Kalle Sommer Nielsen
Den søn. 16. jun. 2019 kl. 02.48 skrev Wes : > > Hi Kalle. I hope it's feasible. Unfortunately I don't know much about > internals. Any info on the matter would be very appreciated, though :P > > Anyway, if we can scan the function body to complain about `return null;` > when the function is

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Wes
Hi Kalle. I hope it's feasible. Unfortunately I don't know much about internals. Any info on the matter would be very appreciated, though :P Anyway, if we can scan the function body to complain about `return null;` when the function is `:void`, surely we can scan just the very top of the function

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Wes
Welcome to the first inevitable patronizing message... No, my code is not smelly. If something is smelling for you, check your armpits. Importing 4 variables is not rare. If you think it's rare and should be done differently, maybe you should first actually do something with Closures before

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread M. W. Moe
Hello, mostly, your argument in your rfc, is all about not finding a good syntax; hence your have a terrible coding style and you want to change the language for that. ``` $fn = function ( T1 $arg1_ , T1 $arg2_ , T1 $arg3_ , T1 $arg4_ , T1 $arg5_ , T1 $arg6_ ) use ($var1, &$var2, &$var3,

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Kalle Sommer Nielsen
Hi Den søn. 16. jun. 2019 kl. 01.37 skrev Wes : > > Hi Kalle, I realize it's going to be a bit odd when binding by value. But > it's not that hard to grasp. > > ``` > $a = 123; > $closure = function(){ > use $a; > echo $a; // 123 > }; > $a = 345; > ``` Take this example: function

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Wes
Hi Kalle, I realize it's going to be a bit odd when binding by value. But it's not that hard to grasp. ``` $a = 123; $closure = function(){ use $a; echo $a; // 123 }; $a = 345; ``` For this reason I specified it is mandatory to have `use` only at the very top (otherwise, it would

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Kalle Sommer Nielsen
Den søn. 16. jun. 2019 kl. 01.09 skrev Wes : > > 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

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Marco Pivetta
On Sun, Jun 16, 2019, 00:09 Wes wrote: > 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 > Just more AST to process, if you ask me  >

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Wes
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

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread G. P. B.
On Sat, 15 Jun 2019 at 23:57, Marco Pivetta wrote: > On Sat, Jun 15, 2019, 23:53 Wes wrote: > > > Hello PHP, I just published > > > > https://wiki.php.net/rfc/alternative-closure-use-syntax > > > > I would love your opinion on this > > > > I know it seems overkill and wrong to have two

Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Marco Pivetta
Hey Wes, On Sat, Jun 15, 2019, 23:53 Wes wrote: > Hello PHP, I just published > > https://wiki.php.net/rfc/alternative-closure-use-syntax > > I would love your opinion on this > > I know it seems overkill and wrong to have two different syntaxes for the > same thing, but I really believe that's

[PHP-DEV][RFC] Alternative "use" syntax for Closures

2019-06-15 Thread Wes
Hello PHP, I just published https://wiki.php.net/rfc/alternative-closure-use-syntax I would love your opinion on this I know it seems overkill and wrong to have two different syntaxes for the same thing, but I really believe that's all we need to fix one of the most hated PHP syntax bits.

Re: [PHP-DEV] Re: [RFC][Vote] Covariant Returns and Contravariant Parameters

2019-06-15 Thread Nikita Popov
On Sat, Jun 15, 2019 at 9:02 AM Sebastian Bergmann wrote: > Am 13.06.2019 um 18:48 schrieb Nikita Popov: > > An update on this: The last part of covariance support has landed [1] a > few > > days ago and is part of 7.4 alpha 1. As already described, full variance > is > > only supported in

[PHP-DEV] [PATCH] Raw logging to syslog

2019-06-15 Thread Erik Lundin
Background: In newer versions of PHP the syslog logging is forced to multiline logging and it's not possible to turn this off. This is especially problematic when you have a lot of logging and need to search and find connected lines from a single call to syslog(). For example when debugging

Re: [PHP-DEV] Re: [RFC][Vote] Covariant Returns and Contravariant Parameters

2019-06-15 Thread Sebastian Bergmann
Am 13.06.2019 um 18:48 schrieb Nikita Popov: An update on this: The last part of covariance support has landed [1] a few days ago and is part of 7.4 alpha 1. As already described, full variance is only supported in conjunction with autoloading. When working in a single file or with explicit