[Issue 24004] UFCS is not uniform/universal (enough)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 21 10:54:41 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24004

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
I can see the principle of this, however, this comes in stark contradiction on
how module visibility works. I can think of a few situations where implementing
such a thing will lead to ambiguities, such as if `mem` is also defined in the
importer module. Of course, this can be solved by adding some extra priority
rules, but this is just one example. There are probably other cases and each of
these require extra logic to treat them. Bottom line, I don't think that the
extra complexity is worth it to add such a feature for which I don't see any
big benefit; simply importing whatever function you want to use is a much
cleaner approach and keeps you on the safe side given that people rarely
encapsulate thinks at the module level in a structured manner. I mean, it would
be really weird if you had a function that is not specifically imported but
used via UFCS because some other functionality is imported in the module;
someone might end up moving the function to another file and then you get
confusing error messages.

--


More information about the Digitalmars-d-bugs mailing list