> On Oct 24, 2019, at 6:49 PM, Ken Stanley <[email protected]> wrote: > I would be keen to see the more expressive techniques that retain the > succinctness of having a not-null coalescing operator.
When I read your first example, I immediately thought I would handle your example in this way: $user->setFName( $_SERVER[ 'fname' ] ?? null ); $user->setLName( $_SERVER[ 'lname' ] ?? null ); $user->setMName( $_SERVER[ 'mname' ] ?? null ); $user->setPhone( $_SERVER[ 'phone' ] ?? null ); $user->setEmail( $_SERVER[ 'email' ] ?? null ); Admittedly it does not require the functionality of your proposed operator, and it delegates the null handling to the set*() methods, but it is more succinct and does not require duplicating `$_SERVER[ '*' ]`, so it would be a winner for me. I also do not mind putting more effort into writing functions if it means less effort required to call the functions. But maybe that is just me? Your 2nd example was more compelling for me, but Sara's nullsafe calls RFC uses a syntax that is more clear and obvious to me. Is there a 3rd or 4th use-case you have that are unlike the first two? -Mike
