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

earthfront via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 14 09:31:23 PDT 2016


On Saturday, 3 September 2016 at 16:52:50 UTC, Martin Nowak wrote:
> On Tuesday, 30 August 2016 at 22:24:12 UTC, Ali Çehreli wrote:
>> I don't agree with the current solution:
>
> Well let's come up with a better solution then.
> Let's start by finding some proper use-cases that require 
> introspection on private members w/o having access to them.

Use case that I think is pretty durn important: using 
Allocator.make and forwarding a call to the private constructor 
on a class.

This does not work now:
---
class A
{ int b; private this(int a){b=a;} }

   auto ptr = make!A(Mallocator.instance, 42); // Compile Error!
---

Allocators are second class in this respect compared to GC.

Mixins aren't a good solution to this.


More information about the Digitalmars-d mailing list