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:45:50 PDT 2016


On Saturday, 3 September 2016 at 17:23:53 UTC, Basile B. wrote:
> 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.
>
> In my user library, the serialization is based on the @Set and 
> @Get UDAs. Typically there would be a setter (a public method) 
> and no getter (i.e the data is read directly either from a 
> protected or private variable).

A public setter for private members is weird, but well. As a 
library template can't read private fields, you don't need the 
@Get attribute.

> The introspection is used to create a property descriptor.

What does that mean? You're creating a property in the serialised 
data?

Defining de-/serialize methods in the class/struct, e.g. with a 
mixin template would be the cleaner and more obvious approach IMO.


More information about the Digitalmars-d mailing list