Usability of "allMembers and derivedMembers traits now only return visible symbols"
Ali Çehreli via Digitalmars-d
digitalmars-d at puremagic.com
Tue Sep 6 23:12:08 PDT 2016
On 09/04/2016 05:37 AM, David Nadlinger wrote:
> On Sunday, 4 September 2016 at 12:33:07 UTC, Andrei Alexandrescu wrote:
>> Thanks for answering. Yes, we really need introspection of private
>> members. One way or another we need to support that.
>
> Do we, though? It's easy to state a general claim like this, but I find
> it hard to actually justify.
>
> — David
Let me try to reword what I've already said elsewhere in this thread.
As the user of a library I shouldn't need to know whether a template of
that library uses __traits(allMembers) or not. Unfortunately, if
__traits(allMembers) depends on access rights, I am forced to mixin
*every* template in my code because I don't and should not know the
template's implementation. If I don't know their implementation, I have
to prepare myself for the worst and mixin *every* template. That's insanity.
Even if I know that they don't use __traits(allMembers) today, they may
change their implementation in the future. So, I really have to mixin
every template today.
Further, I have to be on my toes and watch every feature of every
library in case they changed e.g. a function to a function template in a
new release. Oh yes, I have to mixin that new template as well! (Again,
because I can't be sure whether they use __traits(allMembers) or not.)
This new behavior and its mixin workaround is so insane to me that I
can't even find ways to spell it out clearly. This behavior kills IFTI
altogether because I don't know who uses __traits(allMembers). I can't
rely on IFTI. I have to mixin every template instantiation myself. Crazy.
Ali
More information about the Digitalmars-d
mailing list