Hi Reeze,

On 9 November 2015 at 13:35, reeze <re...@php.net> wrote:
> Hi internals!
>
> I'd like to open a discussion on the RFC to allow set default values for
> list() assignment:  https://wiki.php.net/rfc/list_default_value.
>
> What is your idea?

I find the list construct to be quite magic already. Isn't it possible
to get the affect that you want without adding anything to the core by
doing this:

$defaults = ['default', 'default'];
$input = [1];

list($a, $b) = array_replace($defaults, $input);

I'd find that way easier to understand and explain to junior devs,
compared to having more functionality added to the 'list' magicness.

cheers
Dan

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to