September 22, 2020 Re: Adding the ?. operator to D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Thursday, 17 September 2020 at 19:38:01 UTC, Andrei Alexandrescu wrote:
> On 9/17/20 3:33 PM, Per Nordlöw wrote:
>> On Thursday, 17 September 2020 at 07:06:24 UTC, FeepingCreature wrote:
>>> It only requires the change that || return the merged truthy type of its parameters rather than bool. For instance, for objects 'a || b' would merge to the most derived superclass of a and b.
>>
>> That is an interesting idea. Which statically typed languages has taken a similar approach? I wonder what Andrei thinks about this.
>
> I recall Perl does something similar with its "or" operator. Changing || that way now would be too much breakage.
Perl5 has `or` *and* `||` and they have different precedence because, well, it's Perl.
|
September 22, 2020 Re: Adding the ?. operator to D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Thursday, 17 September 2020 at 19:33:43 UTC, Per Nordlöw wrote:
> On Thursday, 17 September 2020 at 07:06:24 UTC, FeepingCreature wrote:
>> It only requires the change that || return the merged truthy type of its parameters rather than bool. For instance, for objects 'a || b' would merge to the most derived superclass of a and b.
>
> That is an interesting idea. Which statically typed languages has taken a similar approach? I wonder what Andrei thinks about this.
Languages with Flow-typing.
|
Copyright © 1999-2021 by the D Language Foundation