Yep, I agree that's the right way to go about the actual Python side of the 
implementation of custom attributes.  Of course there's also:
        field support w/ custom attributes (which would presumably need a new 
descriptor)
        property support w/ CAs (and properties can't have arbitrary attached 
attributes, so maybe another new descriptor needs to be defined)
        event support?
        Etc...

The restrictions should be fairly minimal and also depend upon what the new 
underlying system type does.  For example for custom attributes it may be the 
case that there are no restrictions.  You can always re-assign the functions 
and have the methods defined which have the custom attributes on them dispatch 
through the PythonType to even allow the implementations to be replaced at 
runtime like you can normally.  For defining a concrete .NET type I would 
expect only that assigning to __class__ would be invalid.

Also, my expectation is that in the future when there's consensus on various 
helpers which use this new feature, and what features they should have, that 
we'll add the most important ones to the clr module as built-ins.

-----Original Message-----
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord
Sent: Tuesday, January 06, 2009 3:07 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Get a string from JavaScript to IronPython

Dino Viehland wrote:
> Strangely I don't see one - this is frequently asked for so I'm a little 
> surprised :)
>
> I have a plan on how to enable this (and some other .NET scenarios) in the 
> next major release.  My current thinking is to support this via meta-classes 
> and providing a new method on type which lets you specify the underlying .NET 
> type used for the Python type.  That will enable this feature to be 
> implemented in Python along with other .NET interop features like:
>         having a Python type which has a default constructor which is 
> available to .NET (important for frameworks which use reflection to create 
> instances).
>         Having concrete .NET members which expose Python members (important 
> for frameworks which use reflection for member access - e.g. data binding).
>
> People can then debate and throw around code for what the best syntax for 
> .NET custom attributes is from Python and implement it themselves.  If anyone 
> has feedback on this I'd love to hear it.
>
If the class is created by type then ordinary decorator syntax could be
used - attaching metadata to the methods which type could use. If a pure
Python class uses attributes then I guess a real .NET type would need to
be created, which may restrict some of the things that can be done to
the class. Definitely a price worth paying if it allows us to use
attributes.

Being able to use Python classes with frameworks that use reflection
would also be great!

Michael


> -----Original Message-----
> From: users-boun...@lists.ironpython.com 
> [mailto:users-boun...@lists.ironpython.com] On Behalf Of Cenovsky, Lukas
> Sent: Tuesday, January 06, 2009 9:13 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] Get a string from JavaScript to IronPython
>
>
>> Unfortunately we can't apply attributes to Python classes. I
>> get round
>> this particular problem by creating stub classes in C# and inheriting
>> from them in Python. See:
>>
>> http://www.voidspace.org.uk/ironpython/silverlight/scriptable.shtml
>>
>
> Is there a CodePlex issue to resolve this?
>
> --
> -- Lukas
>
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


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

Reply via email to