UFCS with implicit "this" ?

cy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 9 02:59:19 PDT 2016


On Tuesday, 9 August 2016 at 05:33:09 UTC, Jonathan M Davis wrote:
> Personally, I think that you should just make it a member 
> function if it's not a generic function, but to each their own,

Well, I use generics for when I have like, optional functionality 
that isn't inherent to the class itself. Since I avoid using 
wildcard imports, I won't import any generics I don't specify by 
name, when I import the class itself.

It's good for extending or adding informal things on the side, 
bells and whistles basically. Sometimes it can be useful for 
third party structures. Or combinations of existing member 
functions, in ways that only have limited applicability (like a 
calculation for graphics, that the database backend won't care 
about).

>     with(object)
>         return a && b || c && !d;

And... the feature already exists, I just didn't know about it. 
Thanks!


More information about the Digitalmars-d-learn mailing list