[IronPython] Decorators on classes

Curt Hagenlocher curt at hagenlocher.org
Tue Feb 5 00:46:39 CET 2008


On Feb 4, 2008 3:29 PM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
>
> It is rather ugly. :-)

Thanks; I thought so myself.

> Would this technique have anything to offer for attributes on methods
> and properties (etc).

It's hard to see how, but it's been a while since I looked at that
part of the source.  I'm pretty sure that the CLR class itself needs
to be emitted entirely by the contents of the one "class" statement --
and well before the first method is defined.  Which means that none of
the properties or methods of the class could influence codegen.

Frankly, I don't think that attributes on methods or properties are
realistic -- at least, not as part of the original class definition.
What I think you'd be looking at is the ability to define a class
wrapper that wraps the initially-defined dynamic class with a new
statically-defined class that allows you to put attributes on methods
and properties.  Hmm... where have I heard that recently... :)

--
Curt Hagenlocher
curt at hagenlocher.org



More information about the Ironpython-users mailing list