UFCS doubt

Dennis dkorpel at gmail.com
Thu Jul 8 22:31:49 UTC 2021


On Thursday, 8 July 2021 at 22:24:26 UTC, Antonio wrote:
> I supossed  that ```mfp(c,20)``` and ```c.mfp(20)``` should be 
> equivalent because UFCS in second example, but it is not... why?

UFCS does not work for nested functions.

> Functions declared in a local scope are not found when 
> searching for a matching UFCS function.
> ...
> Rationale: Local function symbols are not considered by UFCS to 
> avoid unexpected name conflicts. See below problematic examples.

https://dlang.org/spec/function.html#pseudo-member




More information about the Digitalmars-d-learn mailing list