Re: [PHP-DEV] [RFC] Nullsafe operator

2020-07-14 Thread Björn Larsson
Den 2020-07-14 kl. 10:51, skrev Ilija Tovilo: Hi Markus https://wiki.php.net/rfc/nullsafe_operator Would this still work together with short-circuiting and the null coalesce operator? $country = $session?->user?->getAddress()?->country ?? 'defaultCountry'; Yes, your example will still work,

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-07-14 Thread Markus Fischer
Hi, On 14.07.20 10:51, Ilija Tovilo wrote: Would this still work together with short-circuiting and the null coalesce operator? $country = $session?->user?->getAddress()?->country ?? 'defaultCountry'; Yes, your example will still work, this is solely about references :) Thanks for clarifyin

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-07-14 Thread Ilija Tovilo
Hi Markus > > https://wiki.php.net/rfc/nullsafe_operator > > Would this still work together with short-circuiting and the null > coalesce operator? > > $country = $session?->user?->getAddress()?->country ?? 'defaultCountry'; Yes, your example will still work, this is solely about references :) I

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-07-14 Thread Markus Fischer
Hi Ilija, I'd like to introduce another RFC I've been working on: https://wiki.php.net/rfc/nullsafe_operator It introduces the nullsafe operator ?-> that skips null values when calling functions and fetching properties. In contrast to the last few attempts this RFC includes full short circuiti

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-06-06 Thread Ilija Tovilo
Hi Peter > Wouldn't it make more sense to make `isset` smarter? So that it can > handle these situations just like it would with array access. That > way you could use the null coalescing operator as well. Both of those are valid approaches. I do prefer the ?-> operator for two reasons. 1. ??

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-06-06 Thread Ilija Tovilo
Hi Nikita >> I'd like to introduce another RFC I've been working on: >> https://wiki.php.net/rfc/nullsafe_operator > > The semantics look reasonable to me, but I'd recommend including some > discussion on the rationale behind the short-circuiting behavior in the > RFC. That is, what the options ar

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-06-04 Thread Ryan Jentzsch
BIG THUMBS UP for this feature. As was mentioned that TypeScript uses this and saves developers lots of time by avoiding nested null checking. I suggest in the RFC including a list of other languages that have this feature. On Tue, Jun 2, 2020, 2:53 PM Ilija Tovilo wrote: > Hi internals > > I'd

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-06-04 Thread Peter Stalman
> Hi internals > > I'd like to introduce another RFC I've been working on: > https://wiki.php.net/rfc/nullsafe_operator > > It introduces the nullsafe operator ?-> that skips null values when > calling functions and fetching properties. In contrast to the last few > attempts this RFC includes full

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-06-03 Thread Nikita Popov
On Tue, Jun 2, 2020 at 10:53 PM Ilija Tovilo wrote: > Hi internals > > I'd like to introduce another RFC I've been working on: > https://wiki.php.net/rfc/nullsafe_operator > > It introduces the nullsafe operator ?-> that skips null values when > calling functions and fetching properties. In contr

Re: [PHP-DEV] [RFC] Nullsafe operator

2020-06-02 Thread Jordi Boggiano
On 02/06/2020 22:52, Ilija Tovilo wrote: It introduces the nullsafe operator ?-> that skips null values when calling functions and fetching properties. In contrast to the last few attempts this RFC includes full short circuiting. I like it a lot! Concise and clear RFC. From having used a simi

[PHP-DEV] [RFC] Nullsafe operator

2020-06-02 Thread Ilija Tovilo
Hi internals I'd like to introduce another RFC I've been working on: https://wiki.php.net/rfc/nullsafe_operator It introduces the nullsafe operator ?-> that skips null values when calling functions and fetching properties. In contrast to the last few attempts this RFC includes full short circuiti