Re: Re: [RFC][VOTE] Allow specifying keys in list()
| From: | Joe Watkins | Date: | Fri, 12 Feb 2016 11:49:31 +0000 |
| Subject: | Re: Re: [RFC][VOTE] Allow specifying keys in list() | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91216@lists.php.net to get a copy of this message | ||
Morning,
1 - I'm not completely certain what you are referring too ... list() has
always felt a bit strange to me and this doesn't feel any stranger imo.
2 - Perhaps I agree, but perhaps I tend to think that it's because I'm
not used to looking at it yet.
3 - This isn't relevant at the moment.
4 - This is only example illustrative code.
It isn't always about how many characters you have to type ...
public function __construct(array $things) {
$options = $things + $this->defaults;
$this->apples = $options["apples"];
$this->oranges = $options["oranges"];
}
This is a pretty common pattern ... I much prefer this:
public function __construct(array $things) {
list (
"apples" => $this->apples,
"oranges" => $this->oranges
) = ($things + $this->defaults);
}
Not because it's less characters (although it is, by one), but because it's
more expressive.
Anyway +1 from me ... even if it's a bit late ...
Cheers
Joe
On Tue, Feb 9, 2016 at 3:36 PM, guilhermeblanco@gmail.com <
guilhermeblanco@gmail.com> wrote:
> Here is my reasons for no:
>
> 1- Non-intuitive behavior
> 2- Hard to read code, takes more time to understand underlying logic/flow
> 3- YAANPI => Yet Another Alternate Named Parameters Implementation (when I
> look at future scope)
> 4- Most common usage form (first example) still forces you to type almost
> same amount of logic with less readability and little value
>
> Regards,
>
> On Tue, Feb 9, 2016 at 1:50 AM, Joe Watkins <pthreads@pthreads.org> wrote:
>
>> Morning internalz,
>>
>> As mentioned the future scope stuff is scary, but not enough on it's
>> own to vote no.
>>
>> So I want to vote yes, but I'm just waiting to hear objections from no
>> voters, in case they thought of something I didn't ...
>>
>> Cheers
>> Joe
>>
>> On Mon, Feb 8, 2016 at 8:18 PM, Andrea Faulds <ajf@ajf.me> wrote:
>>
>> > Hi again,
>> >
>> > There's been a lot of No votes on this RFC, but I haven't received much
>> > feedback as to why. Would any of you mind sharing your reasons, if
>> > possible? It would be helpful if I knew why people have voted against
>> it,
>> > as then I might be able to modify the RFC to be more palatable, or
>> > understand where I went wrong.
>> >
>> > Thanks!
>> >
>> >
>> > Andrea Faulds wrote:
>> >
>> >> Hi everyone,
>> >>
>> >> It's been more than two weeks since I first proposed this RFC, and
>> >> there's no outstanding issues preventing moving towards a vote. There's
>> >> not yet a language specification patch, but that can be done later.
>> >>
>> >> So, I'm opening the vote on this RFC today, 2016-02-05, and it'll close
>> >> the Sunday after next, 2016-02-14. The vote requires a 2/3 majority as
>> >> it's a language change.
>> >>
>> >> The RFC page is here:
>> >> https://wiki.php.net/rfc/list_keys
>> >>
>> >> Happy voting!
>> >>
>> >
>> >
>> > --
>> > Andrea Faulds
>> > https://ajf.me/
>> >
>> > --
>> > PHP Internals - PHP Runtime Development Mailing List
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>
>
>
> --
> Guilherme Blanco
> MSN: guilhermeblanco@hotmail.com
> GTalk: guilhermeblanco
> Toronto - ON/Canada
>