[Issue 17910] Can't have UFCS in aggregate types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 20 17:21:57 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=17910
--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to anonymous4 from comment #4)
> (In reply to Steven Schveighoffer from comment #3)
> > make your extension methods global
>
> This destroys encapsulation: what has no business at global scope shouldn't
> be there.
Using clear(b) does not destroy encapsulation.
>
> > D usually frowns upon having the
> > same code mean different things in different contexts.
>
> This is not the case for UFCS.
Correct, it is not because local functions do not supersede global ones for
UFCS.
void foo(int) {}
void main()
{
void foo(int) {}
1.foo; // calls global foo
}
--
More information about the Digitalmars-d-bugs
mailing list