Curt Hagenlocher wrote:
So, we had a brief hallway discussion today about this topic, and the upshot is that I'm interested in hearing your "real world" use cases for
a) attributes, and

At Resolver Systems we've used the DllImport attribute extensively.

In my own projects I've used the Silverlight Scriptable attribute several times.

Michael

b) static type generation in general
By "use case", I mean a scenario that's specifically relevant to you today. By "relevant", I mean that it would be *nice* to be able to write a PowerShell extension in Python, but if you didn't end up writing the extension in another language, then it doesn't really count for what I'm looking for. :)

On Mon, Jul 21, 2008 at 4:16 PM, Keith J. Farmer <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    We are talking about *new* features, but you're limiting yourself
    to existing APIs?

    If, for the sake of working nicely with the DLR, the existing
    reflection API needs to be modified to deal with a more dynamic
    world, that's not outside the realm of possibility in my books.
     After all, there has always been talk of IP being able to expose
    static types for consumption outside of IP.  I don't see that this
    is any less possible now than it was at the start.

    Incidentally, Type is an abstract class.  Also, ParameterInfo
    isn't sealed, and implements ICustomerAttributeProvider, which is
    a public interface:

    public interface ICustomAttributeProvider
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider>
    {
       // Methods
       object
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object>
    [] GetCustomAttributes
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/GetCustomAttributes(Boolean):Object%5b%5d
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/GetCustomAttributes%28Boolean%29:Object%5b%5d>>
    (bool
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean>
     inherit);
       object
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object>
    [] GetCustomAttributes
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/GetCustomAttributes(System.Type,Boolean):Object%5b%5d
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/GetCustomAttributes%28System.Type,Boolean%29:Object%5b%5d>>
    (Type
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Type>
     attributeType, bool
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean>
     inherit);
       bool
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean>
     IsDefined
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/IsDefined(System.Type,Boolean):Boolean
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/IsDefined%28System.Type,Boolean%29:Boolean>>
    (Type
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Type>
     attributeType, bool
    
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean>
     inherit);
    }


    So I think, actually, that this could be done without changing
    much if any external API.  They'd probably need to change some of
    the internals to return dynamic variants of the info types, but I
    think that's doable.

    ________________________________

    From: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]> on behalf of Harry Pierson
    Sent: Mon 7/21/2008 12:59 PM
    To: Discussion of IronPython
    Subject: Re: [IronPython] IronPython Post 2.0 Roadmap



    All of the many overloads of GetCustomAttributes
    
(http://msdn.microsoft.com/en-us/library/system.attribute.getcustomattributes(VS.85).aspx
    
<http://msdn.microsoft.com/en-us/library/system.attribute.getcustomattributes%28VS.85%29.aspx>)
    need some type of static type info (Type, MemberInfo,
    ParameterInfo). So supporting custom attributes would require some
    type of static class as Michael mentions below.



    -----Original Message-----
    From: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    [mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>] On Behalf Of Michael
    Foord
    Sent: Monday, July 21, 2008 12:48 PM
    To: Discussion of IronPython
    Subject: Re: [IronPython] IronPython Post 2.0 Roadmap

    Keith J. Farmer wrote:
    > Attributes can be applied to more than just types -- members,
    > parameters, return values (as I recall), etc.

    But those all presuppose a static type - right?

    IronPython could generate a static class in the compile phase
    where .NET
    attributes are used. Python decorator syntax could be used - class
    decorators are now part of Python 2.6 and no-one would object to you
    sneaking them into Python 2.5...

    Parameter and return type attributes could still use a method
    decorator
    to apply them.

    Michael

    >
    >
    ------------------------------------------------------------------------
    > *From:* [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]> on behalf of Curt
    Hagenlocher
    > *Sent:* Mon 7/21/2008 9:51 AM
    > *To:* Discussion of IronPython
    > *Subject:* Re: [IronPython] IronPython Post 2.0 Roadmap
    >
    > "Availability of a static type" not because IronPython would need to
    > access one but because it would need to expose one.
    >
    >
    > On Mon, Jul 21, 2008 at 9:44 AM, Keith J. Farmer
    <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
    > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
    >
    >     You can create your own attribute classes, for whatever markup.
    >      Particularly since LINQ-to-*, where they often are used to
    >     annotate data classes with strings, etc (not references to
    types).
    >
    >     In any event, why does "availability of a static type" enter
    into
    >     this?  IP can access static types just as well as any other .NET
    >     language (System.Math comes to mind).  The motivation in general
    >     is to make IP a better producer for CLR types, rather than
    just a
    >     consumer, and attributes are an increasingly important thing to
    >     support.
    >
    >     As for expression trees and extension methods, those are to make
    >     IP a better consumer of a very important API (LINQ and the
    >     IQueryable stack from .NET 3.5).
    >
    >     To be honest, once those 3 features are available in IP, I think
    >     it would be on par with the mainstream languages in being very
    >     usable in an exclusive sense.
    >
    >     -----Original Message-----
    >     From: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    >     <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>
    >     [mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    >     <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>] On Behalf Of Harry
    >     Pierson
    >     Sent: Sunday, July 20, 2008 11:14 PM
    >     To: Discussion of IronPython
    >     Subject: Re: [IronPython] IronPython Post 2.0 Roadmap
    >
    >     Can you give me some examples where you would use these? The
    >     problem I see is that many scenarios (WCF contracts, XML
    >     serialization just to name two) where people want to use a
    custom
    >     attribute depends on the availability of a static type.
    >
    >     Harry
    >
    >     -----Original Message-----
    >     From: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    >     <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>
    >     [mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    >     <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>] On Behalf Of Keith J.
    >     Farmer
    >     Sent: Saturday, July 19, 2008 8:13 PM
    >     To: Discussion of IronPython
    >     Subject: Re: [IronPython] IronPython Post 2.0 Roadmap
    >
    >     votes++
    >
    >     -----Original Message-----
    >     From: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    >     <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>
    >     [mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    >     <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>] On Behalf Of Michael
    >     Foord
    >     Sent: Saturday, July 19, 2008 10:38 AM
    >     To: Discussion of IronPython
    >     Subject: Re: [IronPython] IronPython Post 2.0 Roadmap
    >
    >     Sanghyeon Seo wrote:
    >     > 2008/7/20 Harry Pierson <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    >     <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>>:
    >     >
    >     >> Hosting features are all done via the DLR, so that's a
    separate
    >     team. As for
    >     >> "ability to interact with the rest of the .Net
    framework", can
    >     you be more
    >     >> specific about what you're looking for in that space? What
    >     *isn't* IPy doing
    >     >> that you want it to?
    >     >>
    >     >
    >     > .NET attributes?
    >     >
    >     >
    >     +1 :-)
    >
    >     Michael
    >
    >     --
    >     http://www.ironpythoninaction.com/
    >     http://www.voidspace.org.uk/
    >     http://www.trypython.org/
    >     http://www.ironpython.info/
    >     http://www.theotherdelia.co.uk/
    >     http://www.resolverhacks.net/
    >
    >     _______________________________________________
    >     Users mailing list
    >     [email protected]
    <mailto:[email protected]>
    <mailto:[email protected]
    <mailto:[email protected]>>
    >     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
    >     _______________________________________________
    >     Users mailing list
    >     [email protected]
    <mailto:[email protected]>
    <mailto:[email protected]
    <mailto:[email protected]>>
    >     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
    >
    >     _______________________________________________
    >     Users mailing list
    >     [email protected]
    <mailto:[email protected]>
    <mailto:[email protected]
    <mailto:[email protected]>>
    >     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
    >     _______________________________________________
    >     Users mailing list
    >     [email protected]
    <mailto:[email protected]>
    <mailto:[email protected]
    <mailto:[email protected]>>
    >     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
    >
    >
    >
    ------------------------------------------------------------------------
    >
    > _______________________________________________
    > Users mailing list
    > [email protected] <mailto:[email protected]>
    > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
    >


    --
    http://www.ironpythoninaction.com/
    http://www.voidspace.org.uk/
    http://www.trypython.org/
    http://www.ironpython.info/
    http://www.theotherdelia.co.uk/
    http://www.resolverhacks.net/

    _______________________________________________
    Users mailing list
    [email protected] <mailto:[email protected]>
    http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

    _______________________________________________
    Users mailing list
    [email protected] <mailto:[email protected]>
    http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



    _______________________________________________
    Users mailing list
    [email protected] <mailto:[email protected]>
    http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


------------------------------------------------------------------------

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/
http://www.trypython.org/
http://www.ironpython.info/
http://www.theotherdelia.co.uk/
http://www.resolverhacks.net/

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to