<div dir="ltr"><div>So, we had a brief hallway discussion today about this topic, and the upshot is that&nbsp;I&#39;m interested in hearing your &quot;real world&quot; use cases for </div>
<div>a) attributes, and</div>
<div>b) static type generation in general</div>
<div>&nbsp;</div>
<div>By &quot;use case&quot;, I mean a scenario that&#39;s specifically relevant to you today.&nbsp; By &quot;relevant&quot;, I mean that it would be *nice* to be able to write a PowerShell extension in Python, but if you didn&#39;t end up writing the extension in another language, then it doesn&#39;t really count for what I&#39;m looking for. :)<br>
<br></div>
<div class="gmail_quote">On Mon, Jul 21, 2008 at 4:16 PM, Keith J. Farmer &lt;<a href="mailto:kfarmer@thuban.org">kfarmer@thuban.org</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">We are talking about *new* features, but you&#39;re limiting yourself to existing APIs?<br><br>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&#39;s not outside the realm of possibility in my books. &nbsp;After all, there has always been talk of IP being able to expose static types for consumption outside of IP. &nbsp;I don&#39;t see that this is any less possible now than it was at the start.<br>
<br>Incidentally, Type is an abstract class. &nbsp;Also, ParameterInfo isn&#39;t sealed, and implements ICustomerAttributeProvider, which is a public interface:<br><br>public interface ICustomAttributeProvider &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider</a>&gt;<br>
{<br>&nbsp; &nbsp;// Methods<br>&nbsp; &nbsp;object &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object</a>&gt; [] GetCustomAttributes &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/GetCustomAttributes(Boolean):Object%5b%5d" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/GetCustomAttributes(Boolean):Object%5b%5d</a>&gt; (bool &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean</a>&gt; &nbsp;inherit);<br>
&nbsp; &nbsp;object &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object</a>&gt; [] GetCustomAttributes &lt;<a href="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" target="_blank">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</a>&gt; (Type &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Type" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Type</a>&gt; &nbsp;attributeType, bool &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean</a>&gt; &nbsp;inherit);<br>
&nbsp; &nbsp;bool &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean</a>&gt; &nbsp;IsDefined &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/IsDefined(System.Type,Boolean):Boolean" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Reflection.ICustomAttributeProvider/IsDefined(System.Type,Boolean):Boolean</a>&gt; (Type &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Type" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Type</a>&gt; &nbsp;attributeType, bool &lt;<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean" target="_blank">http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean</a>&gt; &nbsp;inherit);<br>
}<br><br><br>So I think, actually, that this could be done without changing much if any external API. &nbsp;They&#39;d probably need to change some of the internals to return dynamic variants of the info types, but I think that&#39;s doable.<br>
<br>________________________________<br><br>From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a> on behalf of Harry Pierson<br>Sent: Mon 7/21/2008 12:59 PM<br>
<div>
<div></div>
<div class="Wj3C7c">To: Discussion of IronPython<br>Subject: Re: [IronPython] IronPython Post 2.0 Roadmap<br><br><br><br>All of the many overloads of GetCustomAttributes (<a href="http://msdn.microsoft.com/en-us/library/system.attribute.getcustomattributes(VS.85).aspx" target="_blank">http://msdn.microsoft.com/en-us/library/system.attribute.getcustomattributes(VS.85).aspx</a>) 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.<br>
<br><br><br>-----Original Message-----<br>From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>] On Behalf Of Michael Foord<br>
Sent: Monday, July 21, 2008 12:48 PM<br>To: Discussion of IronPython<br>Subject: Re: [IronPython] IronPython Post 2.0 Roadmap<br><br>Keith J. Farmer wrote:<br>&gt; Attributes can be applied to more than just types -- members,<br>
&gt; parameters, return values (as I recall), etc.<br><br>But those all presuppose a static type - right?<br><br>IronPython could generate a static class in the compile phase where .NET<br>attributes are used. Python decorator syntax could be used - class<br>
decorators are now part of Python 2.6 and no-one would object to you<br>sneaking them into Python 2.5...<br><br>Parameter and return type attributes could still use a method decorator<br>to apply them.<br><br>Michael<br><br>
&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt; *From:* <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a> on behalf of Curt Hagenlocher<br>
&gt; *Sent:* Mon 7/21/2008 9:51 AM<br>&gt; *To:* Discussion of IronPython<br>&gt; *Subject:* Re: [IronPython] IronPython Post 2.0 Roadmap<br>&gt;<br>&gt; &quot;Availability of a static type&quot; not because IronPython would need to<br>
&gt; access one but because it would need to expose one.<br>&gt;<br>&gt;<br>&gt; On Mon, Jul 21, 2008 at 9:44 AM, Keith J. Farmer &lt;<a href="mailto:kfarmer@thuban.org">kfarmer@thuban.org</a><br>&gt; &lt;mailto:<a href="mailto:kfarmer@thuban.org">kfarmer@thuban.org</a>&gt;&gt; wrote:<br>
&gt;<br>&gt; &nbsp; &nbsp; You can create your own attribute classes, for whatever markup.<br>&gt; &nbsp; &nbsp; &nbsp;Particularly since LINQ-to-*, where they often are used to<br>&gt; &nbsp; &nbsp; annotate data classes with strings, etc (not references to types).<br>
&gt;<br>&gt; &nbsp; &nbsp; In any event, why does &quot;availability of a static type&quot; enter into<br>&gt; &nbsp; &nbsp; this? &nbsp;IP can access static types just as well as any other .NET<br>&gt; &nbsp; &nbsp; language (System.Math comes to mind). &nbsp;The motivation in general<br>
&gt; &nbsp; &nbsp; is to make IP a better producer for CLR types, rather than just a<br>&gt; &nbsp; &nbsp; consumer, and attributes are an increasingly important thing to<br>&gt; &nbsp; &nbsp; support.<br>&gt;<br>&gt; &nbsp; &nbsp; As for expression trees and extension methods, those are to make<br>
&gt; &nbsp; &nbsp; IP a better consumer of a very important API (LINQ and the<br>&gt; &nbsp; &nbsp; IQueryable stack from .NET 3.5).<br>&gt;<br>&gt; &nbsp; &nbsp; To be honest, once those 3 features are available in IP, I think<br>&gt; &nbsp; &nbsp; it would be on par with the mainstream languages in being very<br>
&gt; &nbsp; &nbsp; usable in an exclusive sense.<br>&gt;<br>&gt; &nbsp; &nbsp; -----Original Message-----<br>&gt; &nbsp; &nbsp; From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a><br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>&gt;<br>
&gt; &nbsp; &nbsp; [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a><br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>&gt;] On Behalf Of Harry<br>
&gt; &nbsp; &nbsp; Pierson<br>&gt; &nbsp; &nbsp; Sent: Sunday, July 20, 2008 11:14 PM<br>&gt; &nbsp; &nbsp; To: Discussion of IronPython<br>&gt; &nbsp; &nbsp; Subject: Re: [IronPython] IronPython Post 2.0 Roadmap<br>&gt;<br>&gt; &nbsp; &nbsp; Can you give me some examples where you would use these? The<br>
&gt; &nbsp; &nbsp; problem I see is that many scenarios (WCF contracts, XML<br>&gt; &nbsp; &nbsp; serialization just to name two) where people want to use a custom<br>&gt; &nbsp; &nbsp; attribute depends on the availability of a static type.<br>&gt;<br>
&gt; &nbsp; &nbsp; Harry<br>&gt;<br>&gt; &nbsp; &nbsp; -----Original Message-----<br>&gt; &nbsp; &nbsp; From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a><br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>&gt;<br>
&gt; &nbsp; &nbsp; [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a><br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>&gt;] On Behalf Of Keith J.<br>
&gt; &nbsp; &nbsp; Farmer<br>&gt; &nbsp; &nbsp; Sent: Saturday, July 19, 2008 8:13 PM<br>&gt; &nbsp; &nbsp; To: Discussion of IronPython<br>&gt; &nbsp; &nbsp; Subject: Re: [IronPython] IronPython Post 2.0 Roadmap<br>&gt;<br>&gt; &nbsp; &nbsp; votes++<br>&gt;<br>&gt; &nbsp; &nbsp; -----Original Message-----<br>
&gt; &nbsp; &nbsp; From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a><br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>&gt;<br>
&gt; &nbsp; &nbsp; [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a><br>&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>&gt;] On Behalf Of Michael<br>
&gt; &nbsp; &nbsp; Foord<br>&gt; &nbsp; &nbsp; Sent: Saturday, July 19, 2008 10:38 AM<br>&gt; &nbsp; &nbsp; To: Discussion of IronPython<br>&gt; &nbsp; &nbsp; Subject: Re: [IronPython] IronPython Post 2.0 Roadmap<br>&gt;<br>&gt; &nbsp; &nbsp; Sanghyeon Seo wrote:<br>&gt; &nbsp; &nbsp; &gt; 2008/7/20 Harry Pierson &lt;<a href="mailto:Harry.Pierson@microsoft.com">Harry.Pierson@microsoft.com</a><br>
&gt; &nbsp; &nbsp; &lt;mailto:<a href="mailto:Harry.Pierson@microsoft.com">Harry.Pierson@microsoft.com</a>&gt;&gt;:<br>&gt; &nbsp; &nbsp; &gt;<br>&gt; &nbsp; &nbsp; &gt;&gt; Hosting features are all done via the DLR, so that&#39;s a separate<br>&gt; &nbsp; &nbsp; team. As for<br>
&gt; &nbsp; &nbsp; &gt;&gt; &quot;ability to interact with the rest of the .Net framework&quot;, can<br>&gt; &nbsp; &nbsp; you be more<br>&gt; &nbsp; &nbsp; &gt;&gt; specific about what you&#39;re looking for in that space? What<br>&gt; &nbsp; &nbsp; *isn&#39;t* IPy doing<br>
&gt; &nbsp; &nbsp; &gt;&gt; that you want it to?<br>&gt; &nbsp; &nbsp; &gt;&gt;<br>&gt; &nbsp; &nbsp; &gt;<br>&gt; &nbsp; &nbsp; &gt; .NET attributes?<br>&gt; &nbsp; &nbsp; &gt;<br>&gt; &nbsp; &nbsp; &gt;<br>&gt; &nbsp; &nbsp; +1 :-)<br>&gt;<br>&gt; &nbsp; &nbsp; Michael<br>&gt;<br>&gt; &nbsp; &nbsp; --<br>&gt; &nbsp; &nbsp; <a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a><br>
&gt; &nbsp; &nbsp; <a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a><br>&gt; &nbsp; &nbsp; <a href="http://www.trypython.org/" target="_blank">http://www.trypython.org/</a><br>&gt; &nbsp; &nbsp; <a href="http://www.ironpython.info/" target="_blank">http://www.ironpython.info/</a><br>
&gt; &nbsp; &nbsp; <a href="http://www.theotherdelia.co.uk/" target="_blank">http://www.theotherdelia.co.uk/</a><br>&gt; &nbsp; &nbsp; <a href="http://www.resolverhacks.net/" target="_blank">http://www.resolverhacks.net/</a><br>&gt;<br>&gt; &nbsp; &nbsp; _______________________________________________<br>
&gt; &nbsp; &nbsp; Users mailing list<br>&gt; &nbsp; &nbsp; <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a> &lt;mailto:<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a>&gt;<br>&gt; &nbsp; &nbsp; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
&gt; &nbsp; &nbsp; _______________________________________________<br>&gt; &nbsp; &nbsp; Users mailing list<br>&gt; &nbsp; &nbsp; <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a> &lt;mailto:<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a>&gt;<br>
&gt; &nbsp; &nbsp; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>&gt;<br>&gt; &nbsp; &nbsp; _______________________________________________<br>
&gt; &nbsp; &nbsp; Users mailing list<br>&gt; &nbsp; &nbsp; <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a> &lt;mailto:<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a>&gt;<br>&gt; &nbsp; &nbsp; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
&gt; &nbsp; &nbsp; _______________________________________________<br>&gt; &nbsp; &nbsp; Users mailing list<br>&gt; &nbsp; &nbsp; <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a> &lt;mailto:<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a>&gt;<br>
&gt; &nbsp; &nbsp; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>&gt;<br>&gt;<br>&gt; ------------------------------------------------------------------------<br>
&gt;<br>&gt; _______________________________________________<br>&gt; Users mailing list<br>&gt; <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>&gt; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
&gt;<br><br><br>--<br><a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a><br><a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a><br><a href="http://www.trypython.org/" target="_blank">http://www.trypython.org/</a><br>
<a href="http://www.ironpython.info/" target="_blank">http://www.ironpython.info/</a><br><a href="http://www.theotherdelia.co.uk/" target="_blank">http://www.theotherdelia.co.uk/</a><br><a href="http://www.resolverhacks.net/" target="_blank">http://www.resolverhacks.net/</a><br>
<br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br><br></div></div><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br></div>