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

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 7 12:29:05 PDT 2016


On 09/03/2016 09:37 AM, Martin Nowak wrote:
 > On Wednesday, 31 August 2016 at 21:12:54 UTC, Ali Çehreli wrote:

 >> The recommended solution of mixing in every template instance is not a
 >> viable solution because that would effectively remove IFTI from D.
 >> What a huge loss that would be. We can't afford that.
 >
 > Exaggeration won't help us to find good solutions. Remember that private
 > fields never were accessible, so only some edge cases will be affected.
 > The need for mixin templates will remain rare.

I don't see how the user of a template library can decide whether to 
mixin or not without knowing the current implementation if of the library.

For that reason, I must mixin. For example, the following program is 
broken because I don't know whether writeln uses allMembers or not:

     // BROKEN CODE:
     MyStruct s;
     writeln(s);

Do you see the problem? I can't leave that code that way. I have to 
figure out mixin writeln's instantiation. As you see, mixins will not be 
rare. Every template use must be mixed in.

Ali



More information about the Digitalmars-d mailing list