Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-03-15 Thread Mark
On Mon, Feb 25, 2013 at 1:17 PM, Clint Priest wrote: > > On 2/21/2013 5:17 AM, David Muir wrote: >> >> On 21/02/2013, at 6:12 AM, Lazare Inepologlou wrote: >> >>> >>> Long code is not always equivalent to readable code. A shorter syntax >>> could >>> improve readability in *some* cases. >>> >>> L

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-25 Thread Clint Priest
On 2/21/2013 5:17 AM, David Muir wrote: On 21/02/2013, at 6:12 AM, Lazare Inepologlou wrote: Long code is not always equivalent to readable code. A shorter syntax could improve readability in *some* cases. Long: $users->OrderBy( function( $x ){ return $x->Surname; } ); Short: $users->Order

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-21 Thread Lazare Inepologlou
2013/2/21 Levi Morrison > On Thu, Feb 21, 2013 at 4:17 AM, David Muir wrote: > > > > On 21/02/2013, at 6:12 AM, Lazare Inepologlou > wrote: > > > >> 2013/2/20 Sanford Whiteman < > swhitemanlistens-softw...@cypressintegrated.com> > >> > It still looks like some random characters bashed toge

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-21 Thread Levi Morrison
On Thu, Feb 21, 2013 at 4:17 AM, David Muir wrote: > > On 21/02/2013, at 6:12 AM, Lazare Inepologlou wrote: > >> 2013/2/20 Sanford Whiteman >> It still looks like some random characters bashed together by a monkey with a keyboard. >>> >>> +1, I am a fiend for ternary expressions and cr

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-21 Thread David Muir
On 21/02/2013, at 6:12 AM, Lazare Inepologlou wrote: > 2013/2/20 Sanford Whiteman > >>> It still looks like some random characters bashed together by a monkey >>> with a keyboard. >> >> +1, I am a fiend for ternary expressions and crazy one-liners, but >> this makes me want to go back and unr

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-20 Thread Lazare Inepologlou
2013/2/20 Sanford Whiteman > > It still looks like some random characters bashed together by a monkey > > with a keyboard. > > +1, I am a fiend for ternary expressions and crazy one-liners, but > this makes me want to go back and unroll everything I've ever done > into readable code. :) > > -- S.

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-20 Thread Sanford Whiteman
> It still looks like some random characters bashed together by a monkey > with a keyboard. +1, I am a fiend for ternary expressions and crazy one-liners, but this makes me want to go back and unroll everything I've ever done into readable code. :) -- S. -- PHP Internals - PHP Runtime Develo

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-20 Thread Derick Rethans
On Tue, 19 Feb 2013, Levi Morrison wrote: > > Have you considered how this will work/look in an array? > > > > $a = [$b => ($n) $m => $m * $n]; // wat. > > First off, it should be: > > $a = [$b => ($n) |$m| => $m * $n]; > > The || make a big difference in this situation. It still looks lik

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Christopher Jones
On 02/19/2013 09:45 AM, Marcello Duarte wrote: And "just for you" is also inaccurate. You will find that the technologies I've been referring to are becoming the tools you will use for DevOps, etc... tasks. Do you guys listen to people outside of internals? It would be good to have a feedback

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Marco Pivetta
@Marcello: actually, I am also of the idea that there's no real additional value in such a syntax... Since I'm using ZF2 (yeah, that framework that converts array to applications) I am kinda used to have dozens of `function () {}` closures for service factories: so far no problems with it. As sta

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Marcello Duarte
On 19 Feb 2013, at 17:32, Leigh wrote: > > On 19 February 2013 16:46, Marcello Duarte wrote: > I find that more and more my developers have to learn ruby just to be able to > work in our projects. We are one of the largest PHP shops in Europe and even > the proprietary tools we are writing for

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Leigh
On 19 February 2013 16:46, Marcello Duarte wrote: > I find that more and more my developers have to learn ruby just to be able > to work in our projects. We are one of the largest PHP shops in Europe and > even the proprietary tools we are writing for DevOps stuff we are writing > in Ruby. This s

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Levi Morrison
> Have you considered how this will work/look in an array? > > $a = [$b => ($n) $m => $m * $n]; // wat. First off, it should be: $a = [$b => ($n) |$m| => $m * $n]; The || make a big difference in this situation. Secondly, if you hit a situation where the syntax is confusing, use a less conf

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Yahav Gindi Bar
On Tue, Feb 19, 2013 at 6:40 PM, Levi Morrison wrote: > > Say we agree on the syntax above > >> ($n) |$m| => $m * $n; > > What happens when my one liner function needs to do one more operation > > like checking the value of $n before multiplication? > > As I stated before suggesting the syntax: It

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Marcello Duarte
On 19 Feb 2013, at 14:16, Leigh wrote: >> >> >> I can understand that If you haven't tried to write a tool like >> capistrano, rspec, chef, puppet, etc, etc in PHP you probably won't see >> much value in implementing such things. >> >> > Your RFC doesn't go to great lengths to explain the valu

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Sean Coates
>> Say we agree on the syntax above >>> ($n) |$m| => $m * $n; >> What happens when my one liner function needs to do one more operation >> like checking the value of $n before multiplication? > > As I stated before suggesting the syntax: It's only meant for a single > expression. It's purposefully

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Levi Morrison
> Say we agree on the syntax above >> ($n) |$m| => $m * $n; > What happens when my one liner function needs to do one more operation > like checking the value of $n before multiplication? As I stated before suggesting the syntax: It's only meant for a single expression. It's purposefully NOT inten

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Nikita Nefedov
On Tue, 19 Feb 2013 16:31:39 -, Marcello Duarte wrote: On 19 Feb 2013, at 16:29, Morfi wrote: ($n) => { echo $n; } ($n) use ($m) => { echo $n; } Morfi, the problem pointed out already is when you have no arguments it would be the same as the statement block, which would cause BC iss

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Marcello Duarte
On 19 Feb 2013, at 16:29, Morfi wrote: > ($n) => { echo $n; } > ($n) use ($m) => { echo $n; } Morfi, the problem pointed out already is when you have no arguments it would be the same as the statement block, which would cause BC issues. > On Tue, Feb 19, 2013 at 8:11 PM, Levi Morrison wrote: >

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Morfi
($n) => { echo $n; } ($n) use ($m) => { echo $n; } On Tue, Feb 19, 2013 at 8:11 PM, Levi Morrison wrote: > > IF (and I stress if) we add a a shorter anonymous function syntax I'd > > like it to be geared towards one-liners because that's where the > > current syntax feels really verbose, especial

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Florin Razvan Patan
Hello, On Tue, Feb 19, 2013 at 6:09 PM, Levi Morrison wrote: > There's already been an overwhelming negative reaction to this > particular proposed syntax so I won't belabor the point much. In > short, this is too similar to block statements and does have BC > issues. > > -- > > IF (and I stress

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Levi Morrison
> IF (and I stress if) we add a a shorter anonymous function syntax I'd > like it to be geared towards one-liners because that's where the > current syntax feels really verbose, especially when you close over > other variables: > > function ($n) use ($m) { return $m * $n; } > > Versus one poten

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Levi Morrison
There's already been an overwhelming negative reaction to this particular proposed syntax so I won't belabor the point much. In short, this is too similar to block statements and does have BC issues. -- IF (and I stress if) we add a a shorter anonymous function syntax I'd like it to be geared to

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Arvids Godjuks
I also don't like the RFC proposed syntax. I have to say that I don't really like those short magic-like syntax things in in other languages too. If you work with them on the day-to-day basis and tools are built around those concepts - it's one thing. In PHP syntax is mostly self-explanatory and fo

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Leigh
> > > I can understand that If you haven't tried to write a tool like > capistrano, rspec, chef, puppet, etc, etc in PHP you probably won't see > much value in implementing such things. > > Your RFC doesn't go to great lengths to explain the value either. Pretend the reader has no experience with a

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Lars Strojny
Hi Marcello, Am 19.02.2013 um 14:51 schrieb Marcello Duarte : > Thanks for the feedback. I get most people here don't appreciate the value of > the feature. > > I can understand that If you haven't tried to write a tool like capistrano, > rspec, chef, puppet, etc, etc in PHP you probably won't

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Marcello Duarte
Thanks for the feedback. I get most people here don't appreciate the value of the feature. I can understand that If you haven't tried to write a tool like capistrano, rspec, chef, puppet, etc, etc in PHP you probably won't see much value in implementing such things. On 19 Feb 2013, at 13:19, D

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Florin Razvan Patan
Hello, On Tue, Feb 19, 2013 at 2:57 PM, Marcello Duarte wrote: > Inspired by Sara, here is another RFC, I finally got around to draft: > > https://wiki.php.net/rfc/short-syntax-for-anonymous-function > > Please feedback, > -- > Marcello Duarte > I really don't like syntax for this. It makes it h

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Bob Weinand
Hi, I don't really like to write every time a "long" 'function()', only for passing a little callback like 'function ($v) { var_dump($v); }'...: Nice proposal, but writing the last argument outside of the function call could be confusing... An user-function is not a language construct (like whi

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Patrick ALLAERT
2013/2/19 Marcello Duarte : > Inspired by Sara, here is another RFC, I finally got around to draft: > > https://wiki.php.net/rfc/short-syntax-for-anonymous-function > > Please feedback, > -- > Marcello Duarte BC break detected: The {} would probably be a closure that is not assigned to anything

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Paul Dragoonis
I also am not in favour of the syntax, it's too short and quirky. I'm honestly fine with 'function()' it's very explicit On Tue, Feb 19, 2013 at 1:20 PM, Anthony Ferrara wrote: > Marcello, > > > On Tue, Feb 19, 2013 at 7:57 AM, Marcello Duarte > wrote: > > > Inspired by Sara, here is another RF

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Michael Wallner
On 19 February 2013 13:57, Marcello Duarte wrote: > Inspired by Sara, here is another RFC, I finally got around to draft: > > https://wiki.php.net/rfc/short-syntax-for-anonymous-function > > Please feedback, > > Duh, I don't think function(){} is long. -- Regards, Mike

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Anthony Ferrara
Marcello, On Tue, Feb 19, 2013 at 7:57 AM, Marcello Duarte wrote: > Inspired by Sara, here is another RFC, I finally got around to draft: > > https://wiki.php.net/rfc/short-syntax-for-anonymous-function > > Please feedback, > -- > Marcello Duarte > > I like the concept. I dislike the syntax. It

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Derick Rethans
On Tue, 19 Feb 2013, Marcello Duarte wrote: > Inspired by Sara, here is another RFC, I finally got around to draft: > > https://wiki.php.net/rfc/short-syntax-for-anonymous-function I'd be really reluctant to add this -- it's yet another (superfluous) syntactical sugar, there is no patch, and ho