Required Reading: "How Non-Member Functions Improve Encapsulation"

Steven Schveighoffer schveiguy at yahoo.com
Tue Oct 31 02:10:26 UTC 2017


On 10/30/17 9:59 PM, codephantom wrote:
> On Tuesday, 31 October 2017 at 01:47:39 UTC, Steven Schveighoffer wrote:
>> I once thought as you do (though not as the syntax you propose). I now 
>> embrace UFCS fully, it's awesome.
>>
>> -Steve
> 
> Yeah. I do like UFCS ... I was convinved after seeing Ali talk about it:
> 
> https://www.youtube.com/watch?v=vYEKEIpM2zo
> 
> What a great ambassador for D he is!
> 
> But being able to differentiate whether a line of code is calling a 
> method of an object, or a free function... that's the area that concerns 
> me.
> 
> I'm lazy.. I would like such code to be more explicit....and not leave 
> it to me to work out what's going on.
> 

Except... then you can't use generic code with UFCS.

For example, arrays couldn't be ranges, because you can't just do 
arr.front, you'd have to do arr.\front.

-Steve


More information about the Digitalmars-d mailing list