Usability of "allMembers and derivedMembers traits now only return visible symbols"

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 20:24:56 PDT 2016


On Saturday, 3 September 2016 at 17:57:08 UTC, Jonathan M Davis 
wrote:
> I do get the feeling that too much of what we do with features 
> like this is ad-hoc without really designing things up front, 
> and then we keep having to tweak stuff as we go along in ways 
> that aren't always particularly nice.

That's not true, there was DIP22, and it explicitly mentions how 
traits should work.
The problem that was new and very hard to see, is that allowing 
traits to bypass visibility checks means we either can't replace 
access checks, must allow access of private members (w/ the cost 
tradeoffs mentioned in the announce thread), or come up with a 
different solution.
While it's fairly straightforward to skip visibility checks 
during traits lookups, I couldn't come up with a useful use-case 
while writing tests for that implementation, and after some more 
thought came up with the allMembers change.


More information about the Digitalmars-d mailing list