Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-08 Thread Côme Chilliet
Le dimanche 16 octobre 2022, 23:11:05 CET Bob Weinand a écrit : > Hey, > > I've written a small RFC about adding coalesce ability to list() > destructuring. > > This should enhance the ability to easily, concisely and readably destructure > arrays with default values. > > https://wiki.php.net/

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-03 Thread Bob Weinand
> Am 03.11.2022 um 20:55 schrieb Tim Düsterhus : > > Hi > > On 10/16/22 23:11, Bob Weinand wrote: >> I've written a small RFC about adding coalesce ability to list() >> destructuring. >> This should enhance the ability to easily, concisely and readably >> destructure arrays with default values.

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-03 Thread Tim Düsterhus
Hi On 10/16/22 23:11, Bob Weinand wrote: I've written a small RFC about adding coalesce ability to list() destructuring. This should enhance the ability to easily, concisely and readably destructure arrays with default values. https://wiki.php.net/rfc/destructuring_coalesce

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-03 Thread Bob Weinand
Hey, > Am 16.10.2022 um 23:56 schrieb David Rodrigues : > > I like it! > > But what should happen if: > > [ $a ?? '123', $b ] = []; $a is assigned 123, $b emits undefined key error. > [ $a ?? '123', $b ] = [ 1 ]; $a is assigned 1, $b emits undefined key error. > [ $a ?? '123', $b ] = [ 1, 2

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-01 Thread Rowan Tommins
On 01/11/2022 00:05, Bob Weinand wrote: Am 16.10.2022 um 23:11 schrieb Bob Weinand : Hey, I've written a small RFC about adding coalesce ability to list() destructuring. This should enhance the ability to easily, concisely and readably destructure arrays with default values. https://wiki.php

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-10-31 Thread Bob Weinand
> Am 16.10.2022 um 23:11 schrieb Bob Weinand : > > Hey, > > I've written a small RFC about adding coalesce ability to list() > destructuring. > > This should enhance the ability to easily, concisely and readably destructure > arrays with default values. > > https://wiki.php.net/rfc/destructur

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-10-16 Thread David Rodrigues
I like it! But what should happen if: [ $a ?? '123', $b ] = []; [ $a ?? '123', $b ] = [ 1 ]; [ $a ?? '123', $b ] = [ 1, 2 ]; It also supports ?: operator? [ $a ?: '123' ] = []; so $a = '123' [ $a ?: '123' ] = [ false ]; so $a = '123' [ $a ?: '123' ] = [ 456 ]; so $a = 456 Atenciosamente, Davi

[PHP-DEV] [RFC] Destructuring Coalesce

2022-10-16 Thread Bob Weinand
Hey, I've written a small RFC about adding coalesce ability to list() destructuring. This should enhance the ability to easily, concisely and readably destructure arrays with default values. https://wiki.php.net/rfc/destructuring_coalesce Bob