Is Anything Holding you back?

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 5 01:44:01 PDT 2015


On Monday, 5 October 2015 at 04:02:58 UTC, Jan Johansson wrote:
> Sure it can, but I want a dynamic behavior, not a static 
> behavior. Attributes are compiler directives. They are not 
> available at runtime according to the specification of D 
> language. Now take the example at: 
> http://ddili.org/ders/d.en/uda.html, and separate the code into 
> one library that defines the attributes and "printAsXML", keep 
> the consumer of the attributes (main function) and get the same 
> slick functionality. It can't be done, because UDA is not 
> runtime available.

printAsXML is templated on the input type and hence can access 
all its attributes at compile time. If you're familiar with WCF, 
you should know that all types going through a data contract are 
known at compile time.


More information about the Digitalmars-d mailing list