[Mono-list] Implementing attribute-based code generation

Dan Maltes dan@astusa.com
Thu, 13 Jan 2005 08:12:29 -0500


This sounds very interesting.  How much runtime control would we have over
attribute values?  Could runtime change of attribute trigger a jit, or would
this become unstable and/or poor performance?

-Dan 

-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Stephen Touset
Sent: Wednesday, January 12, 2005 10:36 PM
To: Rodrigo B. de Oliveira
Cc: mono-list@lists.ximian.com
Subject: Re: [Mono-list] Implementing attribute-based code generation

Rodrigo B. de Oliveira wrote:

>It sounds like you are talking about what we call syntactic attributes.
>  
>

I couldn't tell from the website. Essentially, I am trying to add design by
contract support to the mono C# compiler (as an extension, rather than a
core patch to mcs). The best way to do this would seem to be to have
attributes that can modify methods. In other words:

[Precondition("o != null")]
[Postcondition("size > 0")]
void AddObject(Object o) {
    // ... do stuff ...
    return;
}

Which would then at compile time insert

void AddObject(Object o) {
    Check.Require(o != null);
    // ... do stuf ...
    Check.Ensure(size > 0);
    return;
}

While also obeying design by contract inheritance rules.
_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list