[OT] Modules dropped out of C++17
Nick Sabalausky via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 9 18:51:19 PDT 2015
On 06/09/2015 04:58 AM, Shachar Shemesh wrote:
>
> I would have a considerably less problem with UFCS had it been limited
> only to explicit declaration.
>
That's how it works in C#. That was actually my first introduction with
extension methods, and then when UFCS was added to D, I used to be
pretty vocally opposed to it being implicit. But I learned to live with
it, and then I eventually I realized it was basically *never* causing me
any real trouble, and now I rather like not having the cognitive load of
"would this be better as an extension method or not?" every time I
define a function. Plus, I don't have to deal with the issue of calling
a func where *my* code could have been much cleaner had the func's
author made it an extension method, but they didn't, so I'm stuck
dealing with it or going to the bother and mess of a wrapper.
I see it as a stylistic issue, now. Let the caller use whatever works
best for their own code.
Sure, it makes it possible for the caller the use UFCS inappropriately
and obfuscate their code in goofy ways, but in practice this is almost
never a real issue. And besides, pretty much *any* feature can be abused
and obfuscate code. Ex: Nothing prevents me from naming a file-loading
function "save" (BTW, I've actually seen that in commercial production
code - wasted half a week figuring that one out), but being able to
choose arbitrary identifier names is still a good thing.
More information about the Digitalmars-d
mailing list