Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ah yes, I love nothing more than functions on the left side of assignment.

Edit: Yes, it is a special form, but its still irregular, and that makes it shitty.



http://www.php.net/manual/en/function.list.php

It's a language construct, not a function.


It's a pretty common feature of a lot of languages (Python, Perl, etc) so it's really not that irregular.


It looks more obviously "language feature" in Perl, Python, and JavaScript, though:

   my ($foo, $bar) = f;
   (foo, bar)      = f()
   var [foo, bar]  = f();


How are any of those examples significantly different from:

   list($foo, $bar) = f();
Given that PHP uses the array() keyword for constructing arrays, it is perfectly symmetrical. My IDE highlights the list() keyword just the same as all the other keywords.


`list` is a special form, not a function.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: