static foreach considered

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 8 14:51:25 PDT 2015


On Monday, 8 June 2015 at 20:02:11 UTC, Andrei Alexandrescu wrote:
> I'm trying to collect together motivating examples and to 
> figure out the semantics of the feature.
>
>
> Andrei

Hmmm, codegen based on UDA?

struct magic
{
   interface readonly;

   private static struct hidden
   {
     @readonly enum a = 0;
   }
   static foreach(id; __traits(allMembers, hidden))
   {
     // Inspect UDA and generate code accordingly,
     // Ex fields with public ReadOnly and private ReadWrite
   }
}


More information about the Digitalmars-d mailing list