Is Anything Holding you back?

Jan Johansson via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 5 09:40:05 PDT 2015


On Monday, 5 October 2015 at 08:44:03 UTC, Kagamin wrote:
> 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.

Yes, I know WCF more than well, doing my own bindings, federated 
security bindings, you name it. I also know that WCF works with 
attribute values during runtime, through reflections and extract 
aspect oriented instructions on how to treat types. It would be 
slick to do the same in D.


More information about the Digitalmars-d mailing list