[IronPython] Help.. I need decorators

Dino Viehland dinov at exchange.microsoft.com
Tue Nov 28 21:43:18 CET 2006


The one workaround I am aware of is to write a base class in C# that has the necessary attributes and then implement the rest in Python by deriving from that class.  If you need to have the base class call the derived class you can add some protected abstract methods that the Python class would override.  Certainly not ideal, but it's probably the simplest way to do it for the time being.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ivan Porto Carrero
Sent: Tuesday, November 28, 2006 12:34 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Help.. I need decorators

Yes I agree any temporary workaround would be great...

-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Wednesday, 29 November 2006 8:34 a.m.
To: Discussion of IronPython
Subject: Re: [IronPython] Help.. I need decorators

Dino Viehland wrote:
> There's both the syntax issue and the implementation issue.  The
syntax issue is more obvious and we have candidates for classes and
methods (e.g. something like __attributes__ = ... for classes, and
decorators for methods - harder are attributes on the return type, on
the parameters, on fields, etc...).
>
> At the implementation level the attributes need to be added to the
type created by NewTypeMaker.  Currently we share the underlying types
based upon common base classes & interfaces (and __slots__).  We'd need
to update this sharing to also take into account attributes and we'd
also need to either re-generate methods or wrap the functions we
initially generated with an attributed method.  Finally to make it truly
work the new methods probably need to be declared on the actual type
created by NewTypeMaker (today they are either dynamic methods or static
methods declared in some other class).
>
> So there are both a lot of details to get right along with the syntax
issues.
>

Thanks for the reply Dino.

Any interim workaround would be great...

Fuzzyman
http://www.voidspace.org.uk/index2.shtml

> -----Original Message-----
> From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
> Sent: Tuesday, November 28, 2006 10:54 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] Help.. I need decorators
>
> Dino Viehland wrote:
>> This comes up on a semi-regular basis.  We currently don't have any
support for attributes.  We've considered many ways to do this but
likely won't have support until 2.0 at the earliest.
>>
>
> Can I ask what the difficulty with it is ? It surely isn't just a
syntax
> issue, is it very difficult to implement ?
>
> Fuzzyman
> http://www.voidspace.org.uk/index2.shtml
>
>> From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Ivan Porto
Carrero
>> Sent: Monday, November 20, 2006 12:22 PM
>> To: Discussion of IronPython
>> Subject: [IronPython] Help.. I need decorators
>>
>> Hi
>>
>> I really want to get into ironpython big time. But the environment I
use requires extensive use of decorators, attributes on methods
>>
>> Eg.
>> [Transaction(Required)][Cache("cache.Store")]
>> public void SaveVeryComplexObject(object veryComplex)
>>
>> What should i do ?
>> Do you guys have support planned for it ?
>>
>> Cheers
>> Ivan
>>
>>
>>
>>
>>
>>
------------------------------------------------------------------------
>>
>> _______________________________________________
>> users mailing list
>> users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>
>>
------------------------------------------------------------------------
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.409 / Virus Database: 268.14.19/555 - Release Date:
27/11/2006
>>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.409 / Virus Database: 268.14.19/555 - Release Date:
27/11/2006
>
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.19/555 - Release Date:
27/11/2006

_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list