Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-05 Thread Ryan McCue
Brian Moon wrote: Is typing really the bottleneck for developers these days? I must suck then. I spend most of my day thinking or waiting on version control, testing and deploy applications, not typing. +1. I don't think reducing key strokes should be a goal at all, the goal should be

[PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Lazare Inepologlou
Hello everyone. I am new to the php-internals list. I have joined because I have implemented a feature that I would like to be included in the php language: a shorter syntax for lambdas. I am going to briefly present it here. Apologies for the long (and yet incomplete) e-mail. I am ready to write

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Rasmus Lerdorf
On 08/04/2011 12:08 AM, Lazare Inepologlou wrote: $add = | $x |= | $y : $x |= $x+$y; This does not seem to match the syntax of any language I know of so people are going to have a hard time figuring out what this does. It's not even clear that |= is a new operator there due to the dangling |,

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread dukeofgaming
Hi, I've always thought that just supressing the function keyword could work as a shorthand, i.e. having ([param1 [, param2 [, ...]]]){...}. Somewhat similar to Ruby's lambda shorthand: http://slideshow.rubyforge.org/ruby19.html#40 Regards, David On Thu, Aug 4, 2011 at 2:23 AM, Rasmus Lerdorf

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Stas Malyshev
Hi! On 8/4/11 12:31 AM, dukeofgaming wrote: I've always thought that just supressing the function keyword could work as a shorthand, i.e. having ([param1 [, param2 [, ...]]]){...}. Somewhat similar to Ruby's lambda shorthand: http://slideshow.rubyforge.org/ruby19.html#40 My opinion is that

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Frédéric Hardy
Hello ! I've always thought that just supressing the function keyword could work as a shorthand, i.e. having ([param1 [, param2 [, ...]]]){...}. Somewhat similar to Ruby's lambda shorthand: http://slideshow.rubyforge.org/ruby19.html#40 Huge +1 for that. Code using closures will be more

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Lazare Inepologlou
Good morning Rasmus, Thank you for your interest. This is just a proposal that I have tested and works. Of course, the final syntax can be different. Syntax is always a matter of taste :-) it is only useful in one limited type of trivial closure usage This trivial usage is actually the most

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Lazare Inepologlou
Hello, $add = | $x |= | $y : $x |= $x+$y; Not sure that it's really readable. This is not the most trivial example. In my blog, there is a small sub-section where I explain why this is more readable than an implementation with the current syntax. See under Readability and A more complicated

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Ivan Enderlin @ Hoa
Hi all :-), On 04/08/11 09:23, Rasmus Lerdorf wrote: On 08/04/2011 12:08 AM, Lazare Inepologlou wrote: $add = | $x |= | $y : $x |= $x+$y; This does not seem to match the syntax of any language I know of so people are going to have a hard time figuring out what this does. It's not even clear

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Ryan McCue
Lazare Inepologlou wrote: Thank you for your interest. This is just a proposal that I have tested and works. Of course, the final syntax can be different. Syntax is always a matter of taste :-) As much as I love the idea, I have to agree that using | doesn't really make sense here and actually

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Johannes Schlüter
On Thu, 2011-08-04 at 21:18 +1000, Ryan McCue wrote: Lazare Inepologlou wrote: Thank you for your interest. This is just a proposal that I have tested and works. Of course, the final syntax can be different. Syntax is always a matter of taste :-) As much as I love the idea, I have to

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Arvids Godjuks
2011/8/4 Lazare Inepologlou linep...@gmail.com: Hello everyone. I am new to the php-internals list. I have joined because I have implemented a feature that I would like to be included in the php language: a shorter syntax for lambdas. I am going to briefly present it here. Apologies for the

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Arvids Godjuks
Oh, and I forgot one more thing: As I read the internals, I noticed many times that PHP lexer is somewhat limited in it's capabilities and sometimes the features are dropped because of this issue. It can be the case that the can be ambiguous and it will be just impossible to add at this stage.

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Lazare Inepologlou
... ( $x ) = $x + 1 for example would be ambiguous if used in an array definition, but is otherwise the best in terms of readability. ... people wanted an easy way to grep for function declarations A new and unique operator (like the |= I have proposed) is a solution that works because: 1.

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Antony Dovgal
On 08/04/2011 04:39 PM, Lazare Inepologlou wrote: ... ( $x ) = $x + 1 for example would be ambiguous if used in an array definition, but is otherwise the best in terms of readability. ... people wanted an easy way to grep for function declarations A new and unique operator (like the |=

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Victor Bolshov
+1 - think everybody'd want their functions to be searchable and searching for complex patterns like (function)|(\|\=\) would really be a headache. Btw, am I the only one to whom the proposed syntax seems kinda hieroglyphic? 2011/8/4 Antony Dovgal t...@daylessday.org On 08/04/2011 04:39 PM,

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Derick Rethans
On Thu, 4 Aug 2011, Victor Bolshov wrote: Btw, am I the only one to whom the proposed syntax seems kinda hieroglyphic? No. I don't see at all why we need this, just like I don't see why we needed an alternative (short) syntax for arrays. This kind of syntax additions that add *no*

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Antony Dovgal
On 08/04/2011 05:04 PM, Derick Rethans wrote: On Thu, 4 Aug 2011, Victor Bolshov wrote: Btw, am I the only one to whom the proposed syntax seems kinda hieroglyphic? No. I don't see at all why we need this, just like I don't see why we needed an alternative (short) syntax for arrays. This

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Brian Moon
From your blog post: All in all, I have tried to eliminate the syntax noise by reducing the key strokes in the the non-significant parts of the expression is typing time really the bottleneck for productivity Is typing really the bottleneck for developers these days? I must suck then. I

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Gwynne Raskind
On Thu, Aug 4, 2011 at 09:12, Antony Dovgal t...@daylessday.org wrote:  Btw, am I the only one to whom the proposed syntax seems kinda hieroglyphic? No. I don't see at all why we need this, just like I don't see why we needed an alternative (short) syntax for arrays. This kind of syntax

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread dukeofgaming
On Thu, Aug 4, 2011 at 1:47 PM, Gwynne Raskind gwy...@darkrainfall.orgwrote: On Thu, Aug 4, 2011 at 09:12, Antony Dovgal t...@daylessday.org wrote: Btw, am I the only one to whom the proposed syntax seems kinda hieroglyphic? No. I don't see at all why we need this, just like I don't see

Re: [PHP-DEV] An implementation of a short syntax for closures

2011-08-04 Thread Paul Dragoonis
On Thu, Aug 4, 2011 at 7:54 PM, dukeofgaming dukeofgam...@gmail.com wrote: On Thu, Aug 4, 2011 at 1:47 PM, Gwynne Raskind gwy...@darkrainfall.orgwrote: On Thu, Aug 4, 2011 at 09:12, Antony Dovgal t...@daylessday.org wrote:  Btw, am I the only one to whom the proposed syntax seems kinda