Struggling to implement parallel foreach...

Timon Gehr timon.gehr at gmx.ch
Tue Jun 18 13:33:05 UTC 2019


On 18.06.19 14:09, Manu wrote:
> On Tue, Jun 18, 2019 at 7:15 PM Walter Bright via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>>
>> On 6/13/2019 6:55 PM, Timon Gehr wrote:
>>> It's not pretty that the qualifiers have a different meaning for
>>> member functions and nested functions (because the nested function meaning could
>>> be useful for member functions too), but it's what we have.
>>
>> Keep in mind that the address of a nested function and the address of a member
>> function have the same ABI. In fact, closures are implemented as member
>> functions under the hood.
> 
> Right, as it should. But it genuinely is weird that the object is not
> qualified by the qualifier.

It is, the compiler just saves an allocation. I think this optimization 
would be valid in general.

> If that were the case, it would all wring
> out in the wash rather than all these bugs and oddities.
> 

Again, this is untrue. Most bugs around function qualifiers are not 
restricted to nested functions. There might have been a couple fewer 
bugs if closures were type checked after lowering, but this has other 
issues (error message quality).


More information about the Digitalmars-d mailing list