Inline aggregate types

ag0aep6g via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 1 12:47:27 PST 2016


On 12/01/2016 09:31 PM, Ethan Watson wrote:
> I'm also sure there's plenty of other legit uses for inline aggregate
> types. So while the feature doesn't exist in the language yet, at least
> you can now see that there's quite a legit hacky-as-all-fuck workaround
> for it.

Interestingly, we do have anonymous classes:

     auto c = new class { @attr int foo; float bar; };

No anonymous structs, though. You can put a struct into the anonymous 
class and extract it immediately, but that's hacky again:

     auto t = typeof(
         new class { static struct S { int foo; float bar; } }
     ).S();


More information about the Digitalmars-d mailing list