On Saturday, March 10, 2012 01:22:49 David Nadlinger wrote: > On Saturday, 10 March 2012 at 00:16:14 UTC, Jonathan M Davis > > wrote: > > UFCS will give people more freedom and may help templates in > > some cases, […] > > Note aside: I think people tend to overestimate the amount of > generic code that becomes easier to write/extend with UFCS, as D, > in contrast to C++, doesn't have ADL.
That wouldn't surprise me at all. But then again, aside from using arrays as ranges, I don't recall _ever_ running into a function in D where a user-defined type had a member function with that name, and a free function had that name, and I wanted to call that function in a template and therefore had to use static ifs to separate the two. So, personally, I don't think that it will help me _at all_. I can see there being a few cases where it would though. If C++ had it, then could have implemented begin and end differently and not have to try and get everyone to switch over to using the free function versions for C++11. And in the case of arrays, having that sort of syntax has been _very_ useful for ranges. But I don't buy that that's really the case for other primitive types (certainly not frequently), and unless you don't control the user-defined type that you're trying to operate on, you'd just put the function on the type itself when dealing with a user-defined type. So, it'll probably help _some_, but I think that there's a good chance that you're right and that it won't be as useful as some people are expecting. But for better or worse, it looks like we're getting it. - Jonathan M Davis
