<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>DevHawk</title><link>http://devhawk.net/</link><description>Passion * Technology * Ruthless Competence</description><language>en-us</language><copyright>Harry Pierson</copyright><managingEditor>harry@devhawk.net</managingEditor><lastBuildDate>Thu, 09 Jul 2009 15:18:38 PDT</lastBuildDate><generator>newtelligence dasBlog 2.0.7226.0</generator><geo:lat>47.640972</geo:lat><geo:long>-122.033189</geo:long><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Devhawk" type="application/rss+xml" /><feedburner:browserFriendly>(Enter a personal message you would like to have appear at the top of your feed.)</feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Syntax Highlighting TextBoxes in WPF &amp;ndash; A Sad Story</title><link>http://feedproxy.google.com/~r/Devhawk/~3/bP6xutCLc30/Syntax+Highlighting+TextBoxes+In+WPF+Ndash+A+Sad+Story.aspx</link><category>WPF</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Thu, 09 Jul 2009 15:18:38 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,d1f69023-194b-4721-9293-855f6143b6de.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the big new features in <a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx">VS
2010</a> is the <a href="http://msdn.microsoft.com/en-us/library/dd885242(VS.100).aspx">WPF
based editor</a>. With it, you can build all sorts of cool stuff like <a href="http://blogs.msdn.com/vseditor/archive/2009/05/13/visualizing-xml-doc-comments.aspx">control
the visualization of XML doc comments</a>, <a href="http://editorsamples.codeplex.com/Wiki/View.aspx?title=IntelliSense%20Presenter">change
how intellisense looks</a>, even <a href="http://code.msdn.microsoft.com/caretfisheye">scale
the size of text based on the location of the caret</a>. Huzzah for the WPF Visual
Studio editor!
</p>
        <p>
However, as wicked awesome as the new editor is, AFAIK it’s not going to be released
as a separate component. So while the <a href="http://blogs.msdn.com/powershell/archive/2008/10/31/powershell-ise-and-visual-studio.aspx">PowerShell</a>, <a href="http://blogs.msdn.com/intellipad/archive/2009/03/25/font-sizes-in-intellipad.aspx">Intellipad</a> and
other teams inside Microsoft can reuse the VS editor bits, nobody else can. So if
you want to do something like <a href="http://www.iunknown.com/2009/05/dynamic-languages-at-teched-2009.html">embed
a colorizing REPL in your WPF app</a>, you’ll have to use something else. 
</p>
        <p>
I’ve <a href="http://devhawk.net/2009/02/27/Writing+An+IronPython+Debugger+MDbg+101.aspx">thought
about</a> putting a WPF based UI on top of ipydbg (though now I’d probably use the
new <a href="http://devhawk.net/2009/07/08/MicrosoftScriptingDebugging.aspx">lightweight
debugger</a> instead). So I downloaded <a href="http://github.com/jflam/repl-lib/tree/master">John’s
repl-lib code</a> to see how he was doing it. Turns out his <a href="http://github.com/jflam/repl-lib/blob/5b597ab4b92a6d85f3e7f22d3ae9af271444b1d4/Core/Repl.xaml">REPL
control</a> is essentially a wrapper around WPF’s <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.aspx">RichTextBox
control</a>. It works, but it seems kinda kludgy. For example, the RichTextBox supports
bold, italics and underline hotkeys, so John’s REPL does too. Though it is possible
to <a href="http://blogs.msdn.com/prajakta/archive/2006/10/12/customize-richtextbox-to-allow-only-plain-text-input.aspx">turn
off these formatting commands</a>, I decided to take a look at modifying how the plain-old
TextBox renders. After all, WPF controls are supposed to be <a href="http://www.drwpf.com/blog/Home/tabid/36/EntryID/53/Default.aspx">lookless</a>,
right? 
</p>
        <p>
Well, apparently not all the WPF controls are lookless. In particular to this post,
the TextBox is definitely NOT lookless. It looks like the text editing capabilities
of TextBox are provided by the Sys.Win.Documents.TextEditor class while the text rendering
is provided by the Sys.Win.Controls.TextBoxView class. Both of those classes are internal,
so don’t even think about trying to customize or reuse them.
</p>
        <p>
The best (and I use that term loosely) way I found for customizing the TextBox rendering
was a <a href="http://www.codeproject.com/KB/WPF/CodeBox.aspx">couple</a> of <a href="http://www.codeproject.com/KB/WPF/CodeBox2.aspx">articles</a> on
CodeProject by <a href="http://www.codeproject.com/Members/KenJohnson">Ken Johnson</a>.
Ken’s CodeBox control inherits from TextBox and sets the Foreground and Background
to transparent (to hide the result of TextBoxView) and then overloads OnRender to
render the text with colorization. Rendering the text twice – once transparently and
once correctly – seems like a better solution than using the RichTextBox, but it’s
still pretty kludgy. (Note, I’m calling the TextBox design kludgy – Ken’s code is
a pretty good work around).
</p>
        <p>
So if you want a colorized text box in WPF, your choices are:
</p>
        <ul>
          <li>
Build your own class that inherits from RichTextBox, disabling all the formatting
commands and handling the TextChanged event to do colorization</li>
          <li>
Build your own class that inherits from TextBox, but set Foreground an Background
colors to transparent and overload OnRender to do the visible text rendering.</li>
          <li>
Use a 3rd party control. The only one I found was the <a href="http://www.aqistar.com">AqiStar
TextBox</a>. No idea how good it is, but <a href="http://www.aqistar.com/FeaturesVisualization.aspx">they
claim</a> to be a true lookless control. Any other syntax highlighting WPF controls
around that I don’t know about?</li>
        </ul>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=d1f69023-194b-4721-9293-855f6143b6de"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=bP6xutCLc30:CKJN3UiKF6s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=bP6xutCLc30:CKJN3UiKF6s:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=bP6xutCLc30:CKJN3UiKF6s:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=bP6xutCLc30:CKJN3UiKF6s:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=bP6xutCLc30:CKJN3UiKF6s:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=bP6xutCLc30:CKJN3UiKF6s:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/bP6xutCLc30" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
One of the big new features in &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;VS
2010&lt;/a&gt; is the &lt;a href="http://msdn.microsoft.com/en-us/library/dd885242(VS.100).aspx"&gt;WPF
based editor&lt;/a&gt;. With it, you can build all sorts of cool stuff like &lt;a href="http://blogs.msdn.com/vseditor/archive/2009/05/13/visualizing-xml-doc-comments.aspx"&gt;control
the visualization of XML doc comments&lt;/a&gt;, &lt;a href="http://editorsamples.codeplex.com/Wiki/View.aspx?title=IntelliSense%20Presenter"&gt;change
how intellisense looks&lt;/a&gt;, even &lt;a href="http://code.msdn.microsoft.com/caretfisheye"&gt;scale
the size of text based on the location of the caret&lt;/a&gt;. Huzzah for the WPF Visual
Studio editor!
&lt;/p&gt;
&lt;p&gt;
However, as wicked awesome as the new editor is, AFAIK it’s not going to be released
as a separate component. So while the &lt;a href="http://blogs.msdn.com/powershell/archive/2008/10/31/powershell-ise-and-visual-studio.aspx"&gt;PowerShell&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/intellipad/archive/2009/03/25/font-sizes-in-intellipad.aspx"&gt;Intellipad&lt;/a&gt; and
other teams inside Microsoft can reuse the VS editor bits, nobody else can. So if
you want to do something like &lt;a href="http://www.iunknown.com/2009/05/dynamic-languages-at-teched-2009.html"&gt;embed
a colorizing REPL in your WPF app&lt;/a&gt;, you’ll have to use something else. 
&lt;/p&gt;
&lt;p&gt;
I’ve &lt;a href="http://devhawk.net/2009/02/27/Writing+An+IronPython+Debugger+MDbg+101.aspx"&gt;thought
about&lt;/a&gt; putting a WPF based UI on top of ipydbg (though now I’d probably use the
new &lt;a href="http://devhawk.net/2009/07/08/MicrosoftScriptingDebugging.aspx"&gt;lightweight
debugger&lt;/a&gt; instead). So I downloaded &lt;a href="http://github.com/jflam/repl-lib/tree/master"&gt;John’s
repl-lib code&lt;/a&gt; to see how he was doing it. Turns out his &lt;a href="http://github.com/jflam/repl-lib/blob/5b597ab4b92a6d85f3e7f22d3ae9af271444b1d4/Core/Repl.xaml"&gt;REPL
control&lt;/a&gt; is essentially a wrapper around WPF’s &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.aspx"&gt;RichTextBox
control&lt;/a&gt;. It works, but it seems kinda kludgy. For example, the RichTextBox supports
bold, italics and underline hotkeys, so John’s REPL does too. Though it is possible
to &lt;a href="http://blogs.msdn.com/prajakta/archive/2006/10/12/customize-richtextbox-to-allow-only-plain-text-input.aspx"&gt;turn
off these formatting commands&lt;/a&gt;, I decided to take a look at modifying how the plain-old
TextBox renders. After all, WPF controls are supposed to be &lt;a href="http://www.drwpf.com/blog/Home/tabid/36/EntryID/53/Default.aspx"&gt;lookless&lt;/a&gt;,
right? 
&lt;/p&gt;
&lt;p&gt;
Well, apparently not all the WPF controls are lookless. In particular to this post,
the TextBox is definitely NOT lookless. It looks like the text editing capabilities
of TextBox are provided by the Sys.Win.Documents.TextEditor class while the text rendering
is provided by the Sys.Win.Controls.TextBoxView class. Both of those classes are internal,
so don’t even think about trying to customize or reuse them.
&lt;/p&gt;
&lt;p&gt;
The best (and I use that term loosely) way I found for customizing the TextBox rendering
was a &lt;a href="http://www.codeproject.com/KB/WPF/CodeBox.aspx"&gt;couple&lt;/a&gt; of &lt;a href="http://www.codeproject.com/KB/WPF/CodeBox2.aspx"&gt;articles&lt;/a&gt; on
CodeProject by &lt;a href="http://www.codeproject.com/Members/KenJohnson"&gt;Ken Johnson&lt;/a&gt;.
Ken’s CodeBox control inherits from TextBox and sets the Foreground and Background
to transparent (to hide the result of TextBoxView) and then overloads OnRender to
render the text with colorization. Rendering the text twice – once transparently and
once correctly – seems like a better solution than using the RichTextBox, but it’s
still pretty kludgy. (Note, I’m calling the TextBox design kludgy – Ken’s code is
a pretty good work around).
&lt;/p&gt;
&lt;p&gt;
So if you want a colorized text box in WPF, your choices are:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Build your own class that inherits from RichTextBox, disabling all the formatting
commands and handling the TextChanged event to do colorization&lt;/li&gt;
&lt;li&gt;
Build your own class that inherits from TextBox, but set Foreground an Background
colors to transparent and overload OnRender to do the visible text rendering.&lt;/li&gt;
&lt;li&gt;
Use a 3rd party control. The only one I found was the &lt;a href="http://www.aqistar.com"&gt;AqiStar
TextBox&lt;/a&gt;. No idea how good it is, but &lt;a href="http://www.aqistar.com/FeaturesVisualization.aspx"&gt;they
claim&lt;/a&gt; to be a true lookless control. Any other syntax highlighting WPF controls
around that I don’t know about?&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=d1f69023-194b-4721-9293-855f6143b6de" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=d1f69023-194b-4721-9293-855f6143b6de</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,d1f69023-194b-4721-9293-855f6143b6de.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,d1f69023-194b-4721-9293-855f6143b6de.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=d1f69023-194b-4721-9293-855f6143b6de</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://devhawk.net/2009/07/09/Syntax+Highlighting+TextBoxes+In+WPF+Ndash+A+Sad+Story.aspx</feedburner:origLink></item><item><title>Microsoft.Scripting.Debugging</title><link>http://feedproxy.google.com/~r/Devhawk/~3/ovF-DSBayEo/MicrosoftScriptingDebugging.aspx</link><category>Debugger</category><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 08 Jul 2009 14:42:36 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,d6791f97-1e11-4a64-959e-0fa0cb1bbb31.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you’ve compiled IronPython from source recently, you may have noticed a new DLL: <a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908451">Microsoft.Scripting.Debugging</a>.
This DLL contains a lightweight, non-blocking debugger for DLR based languages that
is going to enable both new scenarios as well as better compatibility with CPython.
Needless to say, we’re very excited about it.
</p>
        <p>
When I was actively working on my <a href="http://devhawk.net/CategoryView,category,Debugger.aspx">ipydbg
series</a>, I got several emails asking about using it in an embedded scripting scenario.
Unfortunately, the ipydbg approach doesn’t work very well in the embedded scripting
scenario. ipydbg uses <a href="http://msdn.microsoft.com/en-us/library/ms230588.aspx">ICorDebug</a> and
friends, which completely blocks the application being debugged. This means, your
debugger <em>has</em> to run in a separate process. So either you run your debugger
in your host app process and your scripts in a separate process or you run your debugger
in a separate process debugging both the scripts and the host app. Neither option
is very appealing. 
</p>
        <p>
Now with the DLR Debugger, you can run all three components in the same process. I
think of the DLR debugger as a “cooperative” debugger in much the same way that Windows
3.x supported <a href="http://en.wikipedia.org/wiki/Cooperative_multitasking#Cooperative_multitasking.2Ftime-sharing">cooperative
multitasking</a>. It’s also known as trace or traceback debugging. Code being debugged
yields to the debugger at set points during its execution. The debugger then does
whatever it wants, including showing UI and/or letting the developer inspect or modify
program state. When the debugger returns, execution of the original code continues
until the next set point wherein the process repeats itself.
</p>
        <p>
The primary point of entry for the DLR Debugger is the <a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908446">DebugContext
class</a>. Notable there is the TransformLambda method, which takes a normal DLR LambdaExpression
and transforms it into a cooperatively debugged LambdaExpression. LambdaExpressions
can contain DebugInfoExpressions – typically we insert them at the start of every
Python code line as well as one at the end of the function. When we run IronPython
in debug mode (i.e. –D), those get turned into sequence points <a href="http://devhawk.net/2009/03/02/Writing+An+IronPython+Debugger+Setting+A+Breakpoint.aspx">as
we saw</a> back when I was working on ipydbg. When using the DLR Debugger, those DebugInfoExpressions
are transformed into calls out to <a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908429">IDebugCallback</a>.OnDebugEvent.
The DLR Debugger implements the IDebugCallback interface on the <a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908413">TracePipeline</a> class
which also implements <a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908414">ITracePipeline</a>.
In OnDebugEvent, TracePipeline calls out to an <a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908415">ITraceCallback</a> instance
you provide. The extra layer of indirection means you can change your traceback handler
without having to regenerate the debuggable version of your functions. 
</p>
        <p>
Of course, we hide all this DLR Debugger goo from you in IronPython. Python already
has a mechanism for doing traceback debugging – <a href="http://docs.python.org/library/sys.html#sys.settrace">sys.settrace</a>.
Our ITraceCallback, <a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#922366">PythonTracebackListener</a>,
wrapps the DLR Debugger API to expose the sys.settrace API. That makes this feature
a twofer – new capability for IronPython + better compatibility with CPython. Instead
of needing a custom tool (i.e. ipydbg) you can now use <a href="http://docs.python.org/library/pdb.html">PDB</a> from
the standard Python library (modulo bugs in our implementation). I haven’t been working
on ipydbg recently since you’ll be able to use PDB soon enough.
</p>
        <p>
For those hosting IronPython, we also have a couple of static extension methods in
our hosting API (look for the SetTrace functions in <a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#490056">IronPython\Hosting\Python.cs</a>).
These are simply wrappers around sys.settrace, so it has the same API regardless if
you access it from inside IronPython or from the hosting API. But if you’re hosting
IronPython in a C# application, those extension methods are very convenient to use.
</p>
        <p>
This debugger will be in our regular releases of IronPython as of 2.6 beta 2 which
is <a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=2.6%20Release%20Plan">scheduled</a> to
drop at the end of this month. For those who just can’t wait, it’s available as source
code starting with <a href="This code is in our daily source drops as of yesterday. ">yesterday’s
changeset</a>. Please let us know what you think!
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=d6791f97-1e11-4a64-959e-0fa0cb1bbb31"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=ovF-DSBayEo:0CuK-yqdD4A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=ovF-DSBayEo:0CuK-yqdD4A:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=ovF-DSBayEo:0CuK-yqdD4A:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=ovF-DSBayEo:0CuK-yqdD4A:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=ovF-DSBayEo:0CuK-yqdD4A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=ovF-DSBayEo:0CuK-yqdD4A:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/ovF-DSBayEo" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
If you’ve compiled IronPython from source recently, you may have noticed a new DLL: &lt;a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908451"&gt;Microsoft.Scripting.Debugging&lt;/a&gt;.
This DLL contains a lightweight, non-blocking debugger for DLR based languages that
is going to enable both new scenarios as well as better compatibility with CPython.
Needless to say, we’re very excited about it.
&lt;/p&gt;
&lt;p&gt;
When I was actively working on my &lt;a href="http://devhawk.net/CategoryView,category,Debugger.aspx"&gt;ipydbg
series&lt;/a&gt;, I got several emails asking about using it in an embedded scripting scenario.
Unfortunately, the ipydbg approach doesn’t work very well in the embedded scripting
scenario. ipydbg uses &lt;a href="http://msdn.microsoft.com/en-us/library/ms230588.aspx"&gt;ICorDebug&lt;/a&gt; and
friends, which completely blocks the application being debugged. This means, your
debugger &lt;em&gt;has&lt;/em&gt; to run in a separate process. So either you run your debugger
in your host app process and your scripts in a separate process or you run your debugger
in a separate process debugging both the scripts and the host app. Neither option
is very appealing. 
&lt;/p&gt;
&lt;p&gt;
Now with the DLR Debugger, you can run all three components in the same process. I
think of the DLR debugger as a “cooperative” debugger in much the same way that Windows
3.x supported &lt;a href="http://en.wikipedia.org/wiki/Cooperative_multitasking#Cooperative_multitasking.2Ftime-sharing"&gt;cooperative
multitasking&lt;/a&gt;. It’s also known as trace or traceback debugging. Code being debugged
yields to the debugger at set points during its execution. The debugger then does
whatever it wants, including showing UI and/or letting the developer inspect or modify
program state. When the debugger returns, execution of the original code continues
until the next set point wherein the process repeats itself.
&lt;/p&gt;
&lt;p&gt;
The primary point of entry for the DLR Debugger is the &lt;a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908446"&gt;DebugContext
class&lt;/a&gt;. Notable there is the TransformLambda method, which takes a normal DLR LambdaExpression
and transforms it into a cooperatively debugged LambdaExpression. LambdaExpressions
can contain DebugInfoExpressions – typically we insert them at the start of every
Python code line as well as one at the end of the function. When we run IronPython
in debug mode (i.e. –D), those get turned into sequence points &lt;a href="http://devhawk.net/2009/03/02/Writing+An+IronPython+Debugger+Setting+A+Breakpoint.aspx"&gt;as
we saw&lt;/a&gt; back when I was working on ipydbg. When using the DLR Debugger, those DebugInfoExpressions
are transformed into calls out to &lt;a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908429"&gt;IDebugCallback&lt;/a&gt;.OnDebugEvent.
The DLR Debugger implements the IDebugCallback interface on the &lt;a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908413"&gt;TracePipeline&lt;/a&gt; class
which also implements &lt;a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908414"&gt;ITracePipeline&lt;/a&gt;.
In OnDebugEvent, TracePipeline calls out to an &lt;a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#908415"&gt;ITraceCallback&lt;/a&gt; instance
you provide. The extra layer of indirection means you can change your traceback handler
without having to regenerate the debuggable version of your functions. 
&lt;/p&gt;
&lt;p&gt;
Of course, we hide all this DLR Debugger goo from you in IronPython. Python already
has a mechanism for doing traceback debugging – &lt;a href="http://docs.python.org/library/sys.html#sys.settrace"&gt;sys.settrace&lt;/a&gt;.
Our ITraceCallback, &lt;a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#922366"&gt;PythonTracebackListener&lt;/a&gt;,
wrapps the DLR Debugger API to expose the sys.settrace API. That makes this feature
a twofer – new capability for IronPython + better compatibility with CPython. Instead
of needing a custom tool (i.e. ipydbg) you can now use &lt;a href="http://docs.python.org/library/pdb.html"&gt;PDB&lt;/a&gt; from
the standard Python library (modulo bugs in our implementation). I haven’t been working
on ipydbg recently since you’ll be able to use PDB soon enough.
&lt;/p&gt;
&lt;p&gt;
For those hosting IronPython, we also have a couple of static extension methods in
our hosting API (look for the SetTrace functions in &lt;a href="http://ironpython.codeplex.com/SourceControl/changeset/view/56115#490056"&gt;IronPython\Hosting\Python.cs&lt;/a&gt;).
These are simply wrappers around sys.settrace, so it has the same API regardless if
you access it from inside IronPython or from the hosting API. But if you’re hosting
IronPython in a C# application, those extension methods are very convenient to use.
&lt;/p&gt;
&lt;p&gt;
This debugger will be in our regular releases of IronPython as of 2.6 beta 2 which
is &lt;a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=2.6%20Release%20Plan"&gt;scheduled&lt;/a&gt; to
drop at the end of this month. For those who just can’t wait, it’s available as source
code starting with &lt;a href="This code is in our daily source drops as of yesterday. "&gt;yesterday’s
changeset&lt;/a&gt;. Please let us know what you think!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=d6791f97-1e11-4a64-959e-0fa0cb1bbb31" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=d6791f97-1e11-4a64-959e-0fa0cb1bbb31</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,d6791f97-1e11-4a64-959e-0fa0cb1bbb31.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,d6791f97-1e11-4a64-959e-0fa0cb1bbb31.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=d6791f97-1e11-4a64-959e-0fa0cb1bbb31</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments><feedburner:origLink>http://devhawk.net/2009/07/08/MicrosoftScriptingDebugging.aspx</feedburner:origLink></item><item><title>Add-Bcd-Vhd.ps1</title><link>http://feedproxy.google.com/~r/Devhawk/~3/upWlOx34PYk/AddBcdVhdps1.aspx</link><category>PowerShell</category><category>Windows</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Thu, 18 Jun 2009 13:39:57 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,17cd359b-7a77-47ad-a06d-9ba7d2621021.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I *LOVE* the new boot from VHD feature in Win7. I am primarily using it for doing
some <a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx">VS
2010</a> dogfooding without messing up my primary drive partition. But man, the process
for setting up a VHD for booting is brutal. Scott Hanselman did a great job <a href="http://www.hanselman.com/blog/LessVirtualMoreMachineWindows7AndTheMagicOfBootToVHD.aspx">laying
out the steps</a>, but I wanted something a bit more productive.
</p>
        <p>
First, I created a clean Win7 RC VHD and zipped it up for easy storage. The basic
Win7 RC VHD is just under 5GB, but compresses down to about 1.5GB with <a href="http://www.7-zip.org/">7-zip</a>.
I used the <a href="http://blogs.technet.com/aviraj/archive/2009/01/18/windows-7-boot-from-vhd-first-impression-part-2.aspx">ImageX
process</a> Aviraj described though in the future I’ll use the <a href="http://code.msdn.microsoft.com/InstallWindowsImage">Install-WindowsImage</a> script.
Install-WindowsImage is more convenient to use because it will list the indexes within
a given .wim file instead of making you grovel thru an XML file like ImageX does.
Also Install-WindowsImage is 27k download while ImageX is part of the 1.4 <em>gigabyte </em><a href="http://www.microsoft.com/downloads/details.aspx?familyid=60A07E71-0ACB-453A-8035-D30EAD27EF72&amp;displaylang=en">Windows
Automated Installation Kit</a>. Look, I’m not hurting for bandwidth, but I don’t see
the point of downloading 54442 times more data for a utility that isn’t as useful.
</p>
        <p>
Once you’ve created the VHD, you need to update your Boot Configuration Data, or BCD
for short, using the appropriately named <a href="http://technet.microsoft.com/en-us/library/cc709667.aspx">BCDEdit
utility</a>. The process is fairly straight forward, if tedious. You have to run BCDEdit
four times, copy the configuration GUID to the clipboard and type out the path to
the VHD in a slightly funky syntax. Blech. So I built a PowerShell script to automate
updating the BCD, called <a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/Powershell/add-bcd-vhd.ps1">add-bcd-vhd</a>.
You can get it from <a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/Powershell/add-bcd-vhd.ps1">my
skydrive</a>. Pass in the name of the BCD entry and the path to the VHD and add-bcd-vhd
will do the rest.
</p>
        <p>
I was <a href="http://twitter.com/DevHawk/status/2202944230">whining on Twitter</a> yesterday
that there’s no PowerShell specific tools for managing the BCD data. Add-bcd-vhd just
runs bcdedit behind the scenes and processes the text output with regular expressions.
Ugly, but effective. I decided to spend some time trying accessing the BCD data from
its <a href="http://msdn.microsoft.com/en-us/library/bb986746.aspx">WMI provider</a>,
but that turned out to be way too much of a hassle to be effective. If someone else
out there knows how to use the BCD WMI provider from PowerShell, I’d appreciate some
sample code.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=17cd359b-7a77-47ad-a06d-9ba7d2621021"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=upWlOx34PYk:-R5ke7MUpII:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=upWlOx34PYk:-R5ke7MUpII:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=upWlOx34PYk:-R5ke7MUpII:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=upWlOx34PYk:-R5ke7MUpII:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=upWlOx34PYk:-R5ke7MUpII:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=upWlOx34PYk:-R5ke7MUpII:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/upWlOx34PYk" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
I *LOVE* the new boot from VHD feature in Win7. I am primarily using it for doing
some &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;VS
2010&lt;/a&gt; dogfooding without messing up my primary drive partition. But man, the process
for setting up a VHD for booting is brutal. Scott Hanselman did a great job &lt;a href="http://www.hanselman.com/blog/LessVirtualMoreMachineWindows7AndTheMagicOfBootToVHD.aspx"&gt;laying
out the steps&lt;/a&gt;, but I wanted something a bit more productive.
&lt;/p&gt;
&lt;p&gt;
First, I created a clean Win7 RC VHD and zipped it up for easy storage. The basic
Win7 RC VHD is just under 5GB, but compresses down to about 1.5GB with &lt;a href="http://www.7-zip.org/"&gt;7-zip&lt;/a&gt;.
I used the &lt;a href="http://blogs.technet.com/aviraj/archive/2009/01/18/windows-7-boot-from-vhd-first-impression-part-2.aspx"&gt;ImageX
process&lt;/a&gt; Aviraj described though in the future I’ll use the &lt;a href="http://code.msdn.microsoft.com/InstallWindowsImage"&gt;Install-WindowsImage&lt;/a&gt; script.
Install-WindowsImage is more convenient to use because it will list the indexes within
a given .wim file instead of making you grovel thru an XML file like ImageX does.
Also Install-WindowsImage is 27k download while ImageX is part of the 1.4 &lt;em&gt;gigabyte &lt;/em&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=60A07E71-0ACB-453A-8035-D30EAD27EF72&amp;amp;displaylang=en"&gt;Windows
Automated Installation Kit&lt;/a&gt;. Look, I’m not hurting for bandwidth, but I don’t see
the point of downloading 54442 times more data for a utility that isn’t as useful.
&lt;/p&gt;
&lt;p&gt;
Once you’ve created the VHD, you need to update your Boot Configuration Data, or BCD
for short, using the appropriately named &lt;a href="http://technet.microsoft.com/en-us/library/cc709667.aspx"&gt;BCDEdit
utility&lt;/a&gt;. The process is fairly straight forward, if tedious. You have to run BCDEdit
four times, copy the configuration GUID to the clipboard and type out the path to
the VHD in a slightly funky syntax. Blech. So I built a PowerShell script to automate
updating the BCD, called &lt;a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/Powershell/add-bcd-vhd.ps1"&gt;add-bcd-vhd&lt;/a&gt;.
You can get it from &lt;a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/Powershell/add-bcd-vhd.ps1"&gt;my
skydrive&lt;/a&gt;. Pass in the name of the BCD entry and the path to the VHD and add-bcd-vhd
will do the rest.
&lt;/p&gt;
&lt;p&gt;
I was &lt;a href="http://twitter.com/DevHawk/status/2202944230"&gt;whining on Twitter&lt;/a&gt; yesterday
that there’s no PowerShell specific tools for managing the BCD data. Add-bcd-vhd just
runs bcdedit behind the scenes and processes the text output with regular expressions.
Ugly, but effective. I decided to spend some time trying accessing the BCD data from
its &lt;a href="http://msdn.microsoft.com/en-us/library/bb986746.aspx"&gt;WMI provider&lt;/a&gt;,
but that turned out to be way too much of a hassle to be effective. If someone else
out there knows how to use the BCD WMI provider from PowerShell, I’d appreciate some
sample code.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=17cd359b-7a77-47ad-a06d-9ba7d2621021" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=17cd359b-7a77-47ad-a06d-9ba7d2621021</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,17cd359b-7a77-47ad-a06d-9ba7d2621021.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,17cd359b-7a77-47ad-a06d-9ba7d2621021.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=17cd359b-7a77-47ad-a06d-9ba7d2621021</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://devhawk.net/2009/06/18/AddBcdVhdps1.aspx</feedburner:origLink></item><item><title>__clrtype__ Metaclasses: Named Attribute Parameters</title><link>http://feedproxy.google.com/~r/Devhawk/~3/uaO_-dRgMrQ/clrtype+Metaclasses+Named+Attribute+Parameters.aspx</link><category>__clrtype__</category><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Thu, 18 Jun 2009 10:09:02 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,6a3ede80-2a01-4f51-b49f-c90b262d71e5.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In <a href="http://devhawk.net/2009/06/17/clrtype+Metaclasses+Positional+Attribute+Parameters.aspx">my
last post</a>, I added support for custom attribute positional parameters . To finish
things off, I need to add support for named parameters as well. Custom attributes
support named parameters for public fields and settable properties. It works kind
of like C# 3.0’s <a href="http://msdn.microsoft.com/en-us/library/bb384062.aspx">object
initalizers</a>. However, unlike object initalizers, the specific fields and properties
to be set on a custom attribute as well as their values are passed to the <a href="http://msdn.microsoft.com/en-us/library/ex9y2dsf.aspx">CustomAttributeBuilder
constructor</a>. With six arguments – five of which are arrays – it’s kind of an ugly
constructor. But luckily, we can hide it away in the make_cab function by using Python’s <a href="http://docs.python.org/tutorial/controlflow.html#keyword-arguments">keyword
arguments feature</a>.
</p>
        <p>
        </p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:c7291e38-01ec-4273-a925-47d8145b87db" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>def</b>
            </span> <span style="color:#0000FF">make_cab</span>(attrib_type, <span style="color:#666666">*</span>args, <span style="color:#666666">**</span>kwds):<br>
  clrtype <span style="color:#666666">=</span> clr<span style="color:#666666">.</span>GetClrType(attrib_type)<br>
  argtypes <span style="color:#666666">=</span> <span style="color:#008000">tuple</span>(<span style="color:#008000">map</span>(<span style="color:#008000"><b>lambda</b></span> x:clr<span style="color:#666666">.</span>GetClrType(<span style="color:#008000">type</span>(x)), args))<br>
  ci <span style="color:#666666">=</span> clrtype<span style="color:#666666">.</span>GetConstructor(argtypes)<br><br>
  props <span style="color:#666666">=</span> ([],[])<br>
  fields <span style="color:#666666">=</span> ([],[])<br>
  <br>
  <span style="color:#008000"><b>for</b></span> kwd <span style="color:#AA22FF"><b>in</b></span> kwds:<br>
    pi <span style="color:#666666">=</span> clrtype<span style="color:#666666">.</span>GetProperty(kwd)<br>
    <span style="color:#008000"><b>if</b></span> pi <span style="color:#AA22FF"><b>is</b></span> <span style="color:#AA22FF"><b>not</b></span> <span style="color:#008000">None</span>:<br>
      props[<span style="color:#666666">0</span>]<span style="color:#666666">.</span>append(pi)<br>
      props[<span style="color:#666666">1</span>]<span style="color:#666666">.</span>append(kwds[kwd])<br>
    <span style="color:#008000"><b>else</b></span>:<br>
      fi <span style="color:#666666">=</span> clrtype<span style="color:#666666">.</span>GetField(kwd)<br>
      <span style="color:#008000"><b>if</b></span> fi <span style="color:#AA22FF"><b>is</b></span> <span style="color:#AA22FF"><b>not</b></span> <span style="color:#008000">None</span>:<br>
        fields[<span style="color:#666666">0</span>]<span style="color:#666666">.</span>append(fi)<br>
        fields[<span style="color:#666666">1</span>]<span style="color:#666666">.</span>append(kwds[kwd])<br>
      <span style="color:#008000"><b>else</b></span>:<br>
        <span style="color:#008000"><b>raise</b></span> <span style="color:#D2413A"><b>Exception</b></span>, <span style="color:#BA2121">"No </span><span style="color:#BB6688"><b>%s</b></span><span style="color:#BA2121"> Member found on </span><span style="color:#BB6688"><b>%s</b></span><span style="color:#BA2121">"</span> <span style="color:#666666">%</span> (kwd, clrtype<span style="color:#666666">.</span>Name)<br>
  <br>
  <span style="color:#008000"><b>return</b></span> CustomAttributeBuilder(ci, args, <br>
    <span style="color:#008000">tuple</span>(props[<span style="color:#666666">0</span>]), <span style="color:#008000">tuple</span>(props[<span style="color:#666666">1</span>]), <br>
    <span style="color:#008000">tuple</span>(fields[<span style="color:#666666">0</span>]), <span style="color:#008000">tuple</span>(fields[<span style="color:#666666">1</span>]))<br><br><span style="color:#008000"><b>def</b></span> <span style="color:#0000FF">cab_builder</span>(attrib_type):<br>
  <span style="color:#008000"><b>return</b></span> <span style="color:#008000"><b>lambda</b></span> <span style="color:#666666">*</span>args, <span style="color:#666666">**</span>kwds:make_cab(attrib_type, <span style="color:#666666">*</span>args, <span style="color:#666666">**</span>kwds)<br></div>
        </div>
        <p>
You’ll notice that make_cab now takes a third parameter: the attribute type and the
tuple of positional arguments we saw last post. This third parameter “**kwds” is a
dictionary of named parameters. Python supports both positional and named parameter
passing, like VB has for a while and C# will in 4.0. However, this **kwds parameter
contains all the extra or leftover named parameters that were passed in but didn’t
match any existing function arguments. Think of it like the <a href="http://msdn.microsoft.com/en-us/library/w5zay9db.aspx">params</a> of
named parameters.
</p>
        <p>
As I wrote earlier, custom attributes support setting named values of both fields
and properties. We don’t want the developer to have to know if given named parameter
is a field or property, so make_cab iterates over all the named parameters, checking
first to see if it’s a property then if it’s a field. It keeps a list of all the field
/ property infos as well as their associated values. Assuming all the named parameters
are found, those lists are converted to tuples and passed into the <a href="http://msdn.microsoft.com/en-us/library/ex9y2dsf.aspx">CustomAttributeBuilder
constructor</a>.
</p>
        <p>
In addition to the change to make_cab, I also updated cab_builder slightly in order
to pass the **kwds parameter on thru to the make_cab function. No big deal. So now,
I can add an attribute with named parameters to my IronPython class and it still looks
a lot like a C# attribute specification.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:4497adc0-476d-40c5-a417-0f8c26e9c54a" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
clr<span style="color:#666666">.</span>AddReference(<span style="color:#BA2121">"System.Xml"</span>)<br><span style="color:#008000"><b>from</b></span> <span style="color:#0000FF"><b>System.Xml.Serialization</b></span> <span style="color:#008000"><b>import</b></span> XmlRootAttribute <br><span style="color:#008000"><b>from</b></span> <span style="color:#0000FF"><b>System</b></span> <span style="color:#008000"><b>import</b></span> ObsoleteAttribute, CLSCompliantAttribute<br>
Obsolete <span style="color:#666666">=</span> cab_builder(ObsoleteAttribute)<br>
CLSCompliant <span style="color:#666666">=</span> cab_builder(CLSCompliantAttribute)<br>
XmlRoot <span style="color:#666666">=</span> cab_builder(XmlRootAttribute)<br><br><span style="color:#008000"><b>class</b></span> <span style="color:#0000FF"><b>Product</b></span>(<span style="color:#008000">object</span>):<br>
  __metaclass__ <span style="color:#666666">=</span> ClrTypeMetaclass<br>
  _clrnamespace <span style="color:#666666">=</span> <span style="color:#BA2121">"DevHawk.IronPython.ClrTypeSeries"</span> <br>
  _clrclassattribs <span style="color:#666666">=</span> [<br>
    Obsolete(<span style="color:#BA2121">"Warning Lark's Vomit"</span>), <br>
    CLSCompliant(<span style="color:#008000">False</span>),<br>
    XmlRoot(<span style="color:#BA2121">"product"</span>, Namespace<span style="color:#666666">=</span><span style="color:#BA2121">"http://samples.devhawk.net"</span>)]<br><br>
  <span style="color:#408080"><i># remainder of Product class omitted for clarity</i></span><br></div>
        </div>
        <p>
As usual, sample code is <a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/IronPython%20Stuff/%7C_%7C_clrtype%7C_%7C_/custom%7C_attrib%7C_with%7C_named%7C_args.py">up
on my skydrive</a>.
</p>
        <p>
Now that I can support custom attributes on classes, it would be fairly straightforward
to add them to methods, properties, etc as well. The hardest part at this point is
coming up with a well designed API that works within the Python syntax. If you’ve
got any opinions on that, feel free to share them in the comments, via <a href="mailto:harry@devhawk.net">email</a>,
or on the <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">IronPython
mailing list</a>.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=6a3ede80-2a01-4f51-b49f-c90b262d71e5"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=uaO_-dRgMrQ:QjmI3cm-Xgg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=uaO_-dRgMrQ:QjmI3cm-Xgg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=uaO_-dRgMrQ:QjmI3cm-Xgg:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=uaO_-dRgMrQ:QjmI3cm-Xgg:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=uaO_-dRgMrQ:QjmI3cm-Xgg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=uaO_-dRgMrQ:QjmI3cm-Xgg:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/uaO_-dRgMrQ" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
In &lt;a href="http://devhawk.net/2009/06/17/clrtype+Metaclasses+Positional+Attribute+Parameters.aspx"&gt;my
last post&lt;/a&gt;, I added support for custom attribute positional parameters . To finish
things off, I need to add support for named parameters as well. Custom attributes
support named parameters for public fields and settable properties. It works kind
of like C# 3.0’s &lt;a href="http://msdn.microsoft.com/en-us/library/bb384062.aspx"&gt;object
initalizers&lt;/a&gt;. However, unlike object initalizers, the specific fields and properties
to be set on a custom attribute as well as their values are passed to the &lt;a href="http://msdn.microsoft.com/en-us/library/ex9y2dsf.aspx"&gt;CustomAttributeBuilder
constructor&lt;/a&gt;. With six arguments – five of which are arrays – it’s kind of an ugly
constructor. But luckily, we can hide it away in the make_cab function by using Python’s &lt;a href="http://docs.python.org/tutorial/controlflow.html#keyword-arguments"&gt;keyword
arguments feature&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:c7291e38-01ec-4273-a925-47d8145b87db" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;make_cab&lt;/span&gt;(attrib_type,&amp;#160;&lt;span style="color:#666666"&gt;*&lt;/span&gt;args,&amp;#160;&lt;span style="color:#666666"&gt;**&lt;/span&gt;kwds):&lt;br /&gt;
&amp;#160;&amp;#160;clrtype&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;clr&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetClrType(attrib_type)&lt;br /&gt;
&amp;#160;&amp;#160;argtypes&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;tuple&lt;/span&gt;(&lt;span style="color:#008000"&gt;map&lt;/span&gt;(&lt;span style="color:#008000"&gt;&lt;b&gt;lambda&lt;/b&gt;&lt;/span&gt;&amp;#160;x:clr&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetClrType(&lt;span style="color:#008000"&gt;type&lt;/span&gt;(x)),&amp;#160;args))&lt;br /&gt;
&amp;#160;&amp;#160;ci&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;clrtype&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetConstructor(argtypes)&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;props&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;([],[])&lt;br /&gt;
&amp;#160;&amp;#160;fields&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;([],[])&lt;br /&gt;
&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt;&amp;#160;kwd&amp;#160;&lt;span style="color:#AA22FF"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/span&gt;&amp;#160;kwds:&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;pi&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;clrtype&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetProperty(kwd)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&amp;#160;pi&amp;#160;&lt;span style="color:#AA22FF"&gt;&lt;b&gt;is&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#AA22FF"&gt;&lt;b&gt;not&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;None&lt;/span&gt;:&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;props[&lt;span style="color:#666666"&gt;0&lt;/span&gt;]&lt;span style="color:#666666"&gt;.&lt;/span&gt;append(pi)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;props[&lt;span style="color:#666666"&gt;1&lt;/span&gt;]&lt;span style="color:#666666"&gt;.&lt;/span&gt;append(kwds[kwd])&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;else&lt;/b&gt;&lt;/span&gt;:&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;fi&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;clrtype&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetField(kwd)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&amp;#160;fi&amp;#160;&lt;span style="color:#AA22FF"&gt;&lt;b&gt;is&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#AA22FF"&gt;&lt;b&gt;not&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;None&lt;/span&gt;:&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;fields[&lt;span style="color:#666666"&gt;0&lt;/span&gt;]&lt;span style="color:#666666"&gt;.&lt;/span&gt;append(fi)&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;fields[&lt;span style="color:#666666"&gt;1&lt;/span&gt;]&lt;span style="color:#666666"&gt;.&lt;/span&gt;append(kwds[kwd])&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;else&lt;/b&gt;&lt;/span&gt;:&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;raise&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#D2413A"&gt;&lt;b&gt;Exception&lt;/b&gt;&lt;/span&gt;,&amp;#160;&lt;span style="color:#BA2121"&gt;"No&amp;#160;&lt;/span&gt;&lt;span style="color:#BB6688"&gt;&lt;b&gt;%s&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#BA2121"&gt;&amp;#160;Member&amp;#160;found&amp;#160;on&amp;#160;&lt;/span&gt;&lt;span style="color:#BB6688"&gt;&lt;b&gt;%s&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#BA2121"&gt;"&lt;/span&gt;&amp;#160;&lt;span style="color:#666666"&gt;%&lt;/span&gt;&amp;#160;(kwd,&amp;#160;clrtype&lt;span style="color:#666666"&gt;.&lt;/span&gt;Name)&lt;br /&gt;
&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;CustomAttributeBuilder(ci,&amp;#160;args,&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;tuple&lt;/span&gt;(props[&lt;span style="color:#666666"&gt;0&lt;/span&gt;]),&amp;#160;&lt;span style="color:#008000"&gt;tuple&lt;/span&gt;(props[&lt;span style="color:#666666"&gt;1&lt;/span&gt;]),&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;tuple&lt;/span&gt;(fields[&lt;span style="color:#666666"&gt;0&lt;/span&gt;]),&amp;#160;&lt;span style="color:#008000"&gt;tuple&lt;/span&gt;(fields[&lt;span style="color:#666666"&gt;1&lt;/span&gt;]))&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;cab_builder&lt;/span&gt;(attrib_type):&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;lambda&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#666666"&gt;*&lt;/span&gt;args,&amp;#160;&lt;span style="color:#666666"&gt;**&lt;/span&gt;kwds:make_cab(attrib_type,&amp;#160;&lt;span style="color:#666666"&gt;*&lt;/span&gt;args,&amp;#160;&lt;span style="color:#666666"&gt;**&lt;/span&gt;kwds)&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&gt;
&lt;p&gt;
You’ll notice that make_cab now takes a third parameter: the attribute type and the
tuple of positional arguments we saw last post. This third parameter “**kwds” is a
dictionary of named parameters. Python supports both positional and named parameter
passing, like VB has for a while and C# will in 4.0. However, this **kwds parameter
contains all the extra or leftover named parameters that were passed in but didn’t
match any existing function arguments. Think of it like the &lt;a href="http://msdn.microsoft.com/en-us/library/w5zay9db.aspx"&gt;params&lt;/a&gt; of
named parameters.
&lt;/p&gt;
&lt;p&gt;
As I wrote earlier, custom attributes support setting named values of both fields
and properties. We don’t want the developer to have to know if given named parameter
is a field or property, so make_cab iterates over all the named parameters, checking
first to see if it’s a property then if it’s a field. It keeps a list of all the field
/ property infos as well as their associated values. Assuming all the named parameters
are found, those lists are converted to tuples and passed into the &lt;a href="http://msdn.microsoft.com/en-us/library/ex9y2dsf.aspx"&gt;CustomAttributeBuilder
constructor&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
In addition to the change to make_cab, I also updated cab_builder slightly in order
to pass the **kwds parameter on thru to the make_cab function. No big deal. So now,
I can add an attribute with named parameters to my IronPython class and it still looks
a lot like a C# attribute specification.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:4497adc0-476d-40c5-a417-0f8c26e9c54a" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
clr&lt;span style="color:#666666"&gt;.&lt;/span&gt;AddReference(&lt;span style="color:#BA2121"&gt;"System.Xml"&lt;/span&gt;)&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;from&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;System.Xml.Serialization&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt;&amp;#160;XmlRootAttribute&amp;#160;&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;from&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;System&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt;&amp;#160;ObsoleteAttribute,&amp;#160;CLSCompliantAttribute&lt;br /&gt;
Obsolete&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;cab_builder(ObsoleteAttribute)&lt;br /&gt;
CLSCompliant&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;cab_builder(CLSCompliantAttribute)&lt;br /&gt;
XmlRoot&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;cab_builder(XmlRootAttribute)&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;class&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;Product&lt;/b&gt;&lt;/span&gt;(&lt;span style="color:#008000"&gt;object&lt;/span&gt;):&lt;br /&gt;
&amp;#160;&amp;#160;__metaclass__&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;ClrTypeMetaclass&lt;br /&gt;
&amp;#160;&amp;#160;_clrnamespace&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;&lt;span style="color:#BA2121"&gt;"DevHawk.IronPython.ClrTypeSeries"&lt;/span&gt;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;_clrclassattribs&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;[&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;Obsolete(&lt;span style="color:#BA2121"&gt;"Warning&amp;#160;Lark's&amp;#160;Vomit"&lt;/span&gt;),&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;CLSCompliant(&lt;span style="color:#008000"&gt;False&lt;/span&gt;),&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;XmlRoot(&lt;span style="color:#BA2121"&gt;"product"&lt;/span&gt;,&amp;#160;Namespace&lt;span style="color:#666666"&gt;=&lt;/span&gt;&lt;span style="color:#BA2121"&gt;"http://samples.devhawk.net"&lt;/span&gt;)]&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#408080"&gt;&lt;i&gt;#&amp;#160;remainder&amp;#160;of&amp;#160;Product&amp;#160;class&amp;#160;omitted&amp;#160;for&amp;#160;clarity&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
As usual, sample code is &lt;a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/IronPython%20Stuff/%7C_%7C_clrtype%7C_%7C_/custom%7C_attrib%7C_with%7C_named%7C_args.py"&gt;up
on my skydrive&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Now that I can support custom attributes on classes, it would be fairly straightforward
to add them to methods, properties, etc as well. The hardest part at this point is
coming up with a well designed API that works within the Python syntax. If you’ve
got any opinions on that, feel free to share them in the comments, via &lt;a href="mailto:harry@devhawk.net"&gt;email&lt;/a&gt;,
or on the &lt;a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com"&gt;IronPython
mailing list&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=6a3ede80-2a01-4f51-b49f-c90b262d71e5" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=6a3ede80-2a01-4f51-b49f-c90b262d71e5</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,6a3ede80-2a01-4f51-b49f-c90b262d71e5.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,6a3ede80-2a01-4f51-b49f-c90b262d71e5.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=6a3ede80-2a01-4f51-b49f-c90b262d71e5</wfw:commentRss><feedburner:origLink>http://devhawk.net/2009/06/18/clrtype+Metaclasses+Named+Attribute+Parameters.aspx</feedburner:origLink></item><item><title>__clrtype__ Metaclasses: Positional Attribute Parameters</title><link>http://feedproxy.google.com/~r/Devhawk/~3/l7k_wguICcM/clrtype+Metaclasses+Positional+Attribute+Parameters.aspx</link><category>__clrtype__</category><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 17 Jun 2009 11:02:38 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,2687c504-afe1-44a9-a261-fc36de5ac8d8.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The <a href="http://devhawk.net/2009/06/15/clrtype+Metaclasses+Simple+Custom+Attributes.aspx">basic
infrastructure</a> for custom attributes in IronPython is in place, but it’s woefully
limited. Specifically, it only works for custom attributes that don’t have parameters.
Of course, most of the custom attributes that you’d really want to use require additional
parameters, both the positional or named variety. Since positional parameters are
easier, let’s start with them.
</p>
        <p>
Positional parameters get passed to the custom attribute’s constructor. As we saw
in the previous post, you need a <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.customattributebuilder.aspx">CustomAttributeBuilder</a> to
attach a custom attribute to an attribute target (like a class). Previously, I just
needed to know the attribute type since I was hard coding the positional parameters.
But now, I need to know both the attribute type as well as the desired positional
parameters. I could have built a custom Python class to track this information, but
it made much more sense just to use CustomAttributeBuilder instances. I built a utility
function make_cab to construct the CustomAttributeBuilder instances.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:14f687a4-ae13-43a0-a253-b960814892a6" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>def</b>
            </span> <span style="color:#0000FF">make_cab</span>(attrib_type, <span style="color:#666666">*</span>args):<br>
  argtypes <span style="color:#666666">=</span> <span style="color:#008000">tuple</span>(<span style="color:#008000">map</span>(<span style="color:#008000"><b>lambda</b></span> x:clr<span style="color:#666666">.</span>GetClrType(<span style="color:#008000">type</span>(x)), args))<br>
  ci <span style="color:#666666">=</span> clr<span style="color:#666666">.</span>GetClrType(attrib_type)<span style="color:#666666">.</span>GetConstructor(argtypes)<br>
  <span style="color:#008000"><b>return</b></span> CustomAttributeBuilder(ci, args)<br><br><span style="color:#008000"><b>from</b></span> <span style="color:#0000FF"><b>System</b></span> <span style="color:#008000"><b>import</b></span> ObsoleteAttribute <br><br><span style="color:#008000"><b>class</b></span> <span style="color:#0000FF"><b>Product</b></span>(<span style="color:#008000">object</span>):<br>
  __metaclass__ <span style="color:#666666">=</span> ClrTypeMetaclass<br>
  _clrnamespace <span style="color:#666666">=</span> <span style="color:#BA2121">"DevHawk.IronPython.ClrTypeSeries"</span>   <br>
  _clrclassattribs <span style="color:#666666">=</span> [make_cab(ObsoleteAttribute , <span style="color:#BA2121">"Warning Lark's Vomit"</span>)]<br><br>
  <span style="color:#408080"><i># remaining Product class definition omited for clarity</i></span><br></div>
        </div>
        <p>
In make_cab, I build a tuple of CLR types from the list of positional arguments that
was passed in. If you haven’t seed the *args syntax before, it works like C#’s params
keyword – any extra arguments are passed into the function as a tuple names args.
I use Python’s built in map function (FP FTW!) to build a tuple of CLR types of the
provided arguments, which I then pass to GetConstructor. Previously, I passed an empty
tuple to GetConstructor because I wanted the default constructor. If you don’t pass
any positional arguments, you still get the default constructor. Once I’ve found the
right constructor, I pass it and the original tuple of arguments to the CustomAttributeBuilder
constructor.
</p>
        <p>
One major benefit of this approach is that it simplifies the metaclass code. Since
_clrclassattribs is now a list of CustomAttributeBuilders, now I just need to iterate
over that list and call SetCustomAttribute for each.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:0c27755e-020c-4c2c-99e3-eabe1367334b" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
    <span style="color:#008000"><b>if</b></span> <span style="color:#008000">hasattr</span>(cls, <span style="color:#BA2121">'_clrclassattribs'</span>):<br>
      <span style="color:#008000"><b>for</b></span> cab <span style="color:#AA22FF"><b>in</b></span> cls<span style="color:#666666">.</span>_clrclassattribs:<br>
        typebld<span style="color:#666666">.</span>SetCustomAttribute(cab)<br></div>
        </div>
        <p>
The only problem with this approach is that specifying the list of custom attributes
is now extremely verbose. Not only am I specifying the full attribute class name as
well as the positional arguments, I’m also having to insert a call to make_cab. Previously,
it kinda looked like a C# custom attribute, albeit in the wrong place. Not anymore.
So I decided to write a function called cab_builder to generates less verbose calls
to make_cab:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:e22f2d7f-c482-40c9-95d3-de1a572ffb4e" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>def</b>
            </span> <span style="color:#0000FF">cab_builder</span>(attrib_type):<br>
  <span style="color:#008000"><b>return</b></span> <span style="color:#008000"><b>lambda</b></span> <span style="color:#666666">*</span>args:make_cab(attrib_type, <span style="color:#666666">*</span>args)<br><br><span style="color:#008000"><b>from</b></span> <span style="color:#0000FF"><b>System</b></span> <span style="color:#008000"><b>import</b></span> ObsoleteAttribute <br>
Obsolete <span style="color:#666666">=</span> cab_builder(ObsoleteAttribute)<br><br><span style="color:#008000"><b>class</b></span> <span style="color:#0000FF"><b>Product</b></span>(<span style="color:#008000">object</span>):<br>
  __metaclass__ <span style="color:#666666">=</span> ClrTypeMetaclass<br>
  _clrnamespace <span style="color:#666666">=</span> <span style="color:#BA2121">"DevHawk.IronPython.ClrTypeSeries"</span>   <br>
  _clrclassattribs <span style="color:#666666">=</span> [Obsolete(<span style="color:#BA2121">"Warning Lark's Vomit"</span>)]<br><br>
  <span style="color:#408080"><i># remaining Product class definition omited for clarity</i></span><br></div>
        </div>
        <p>
The cab_builder function returns an anonymous lambda function that closes over the
attrib_type variable. Python lambdas are just like C# lambdas, except that they only
support expressions [1]. The results of calling the lambda returned from cab_builder
is exactly the same as calling make_cab directly, but less verbose. And since I named
the function returned from cab_builder Obsolete, now my list of class custom attributes
looks <em>exactly </em>like it does in C# (though still in a different place). As
usual, the code is <a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/IronPython%20Stuff/%7C_%7C_clrtype%7C_%7C_/custom%7C_attrib%7C_with%7C_positional%7C_args.py">up
on my skydrive</a>.
</p>
        <p>
If you’re only using the attribute once like this, it is kind of annoying to first
declare the cab_builder function. If you wanted to you could iterate over the types
in a given assembly, looking for ones that inherit from Attribute and generate the
cab_builder call dynamically. However, I’m not sure how performant that would be.
Another possibility would be to iterate over the types in a given assembly and generate
a Python module on disk with the calls to cab_builder. Then, you’d just have to import
this module of common attributes but still be able to include additional calls to
cab_builder as needed.
</p>
        <p>
        </p>
        <p>
[1] The lack of statement lambdas in Python is one of my few issues with the language. 
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=2687c504-afe1-44a9-a261-fc36de5ac8d8"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=l7k_wguICcM:uPoonNfKL3M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=l7k_wguICcM:uPoonNfKL3M:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=l7k_wguICcM:uPoonNfKL3M:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=l7k_wguICcM:uPoonNfKL3M:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=l7k_wguICcM:uPoonNfKL3M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=l7k_wguICcM:uPoonNfKL3M:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/l7k_wguICcM" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
The &lt;a href="http://devhawk.net/2009/06/15/clrtype+Metaclasses+Simple+Custom+Attributes.aspx"&gt;basic
infrastructure&lt;/a&gt; for custom attributes in IronPython is in place, but it’s woefully
limited. Specifically, it only works for custom attributes that don’t have parameters.
Of course, most of the custom attributes that you’d really want to use require additional
parameters, both the positional or named variety. Since positional parameters are
easier, let’s start with them.
&lt;/p&gt;
&lt;p&gt;
Positional parameters get passed to the custom attribute’s constructor. As we saw
in the previous post, you need a &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.customattributebuilder.aspx"&gt;CustomAttributeBuilder&lt;/a&gt; to
attach a custom attribute to an attribute target (like a class). Previously, I just
needed to know the attribute type since I was hard coding the positional parameters.
But now, I need to know both the attribute type as well as the desired positional
parameters. I could have built a custom Python class to track this information, but
it made much more sense just to use CustomAttributeBuilder instances. I built a utility
function make_cab to construct the CustomAttributeBuilder instances.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:14f687a4-ae13-43a0-a253-b960814892a6" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;make_cab&lt;/span&gt;(attrib_type,&amp;#160;&lt;span style="color:#666666"&gt;*&lt;/span&gt;args):&lt;br /&gt;
&amp;#160;&amp;#160;argtypes&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;tuple&lt;/span&gt;(&lt;span style="color:#008000"&gt;map&lt;/span&gt;(&lt;span style="color:#008000"&gt;&lt;b&gt;lambda&lt;/b&gt;&lt;/span&gt;&amp;#160;x:clr&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetClrType(&lt;span style="color:#008000"&gt;type&lt;/span&gt;(x)),&amp;#160;args))&lt;br /&gt;
&amp;#160;&amp;#160;ci&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;clr&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetClrType(attrib_type)&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetConstructor(argtypes)&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;CustomAttributeBuilder(ci,&amp;#160;args)&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;from&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;System&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt;&amp;#160;ObsoleteAttribute&amp;#160;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;class&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;Product&lt;/b&gt;&lt;/span&gt;(&lt;span style="color:#008000"&gt;object&lt;/span&gt;):&lt;br /&gt;
&amp;#160;&amp;#160;__metaclass__&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;ClrTypeMetaclass&lt;br /&gt;
&amp;#160;&amp;#160;_clrnamespace&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;&lt;span style="color:#BA2121"&gt;"DevHawk.IronPython.ClrTypeSeries"&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;_clrclassattribs&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;[make_cab(ObsoleteAttribute&amp;#160;,&amp;#160;&lt;span style="color:#BA2121"&gt;"Warning&amp;#160;Lark's&amp;#160;Vomit"&lt;/span&gt;)]&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#408080"&gt;&lt;i&gt;#&amp;#160;remaining&amp;#160;Product&amp;#160;class&amp;#160;definition&amp;#160;omited&amp;#160;for&amp;#160;clarity&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
In make_cab, I build a tuple of CLR types from the list of positional arguments that
was passed in. If you haven’t seed the *args syntax before, it works like C#’s params
keyword – any extra arguments are passed into the function as a tuple names args.
I use Python’s built in map function (FP FTW!) to build a tuple of CLR types of the
provided arguments, which I then pass to GetConstructor. Previously, I passed an empty
tuple to GetConstructor because I wanted the default constructor. If you don’t pass
any positional arguments, you still get the default constructor. Once I’ve found the
right constructor, I pass it and the original tuple of arguments to the CustomAttributeBuilder
constructor.
&lt;/p&gt;
&lt;p&gt;
One major benefit of this approach is that it simplifies the metaclass code. Since
_clrclassattribs is now a list of CustomAttributeBuilders, now I just need to iterate
over that list and call SetCustomAttribute for each.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:0c27755e-020c-4c2c-99e3-eabe1367334b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;hasattr&lt;/span&gt;(cls,&amp;#160;&lt;span style="color:#BA2121"&gt;'_clrclassattribs'&lt;/span&gt;):&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt;&amp;#160;cab&amp;#160;&lt;span style="color:#AA22FF"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/span&gt;&amp;#160;cls&lt;span style="color:#666666"&gt;.&lt;/span&gt;_clrclassattribs:&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;typebld&lt;span style="color:#666666"&gt;.&lt;/span&gt;SetCustomAttribute(cab)&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The only problem with this approach is that specifying the list of custom attributes
is now extremely verbose. Not only am I specifying the full attribute class name as
well as the positional arguments, I’m also having to insert a call to make_cab. Previously,
it kinda looked like a C# custom attribute, albeit in the wrong place. Not anymore.
So I decided to write a function called cab_builder to generates less verbose calls
to make_cab:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:e22f2d7f-c482-40c9-95d3-de1a572ffb4e" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;cab_builder&lt;/span&gt;(attrib_type):&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;lambda&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#666666"&gt;*&lt;/span&gt;args:make_cab(attrib_type,&amp;#160;&lt;span style="color:#666666"&gt;*&lt;/span&gt;args)&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;from&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;System&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt;&amp;#160;ObsoleteAttribute&amp;#160;&lt;br /&gt;
Obsolete&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;cab_builder(ObsoleteAttribute)&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;class&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;Product&lt;/b&gt;&lt;/span&gt;(&lt;span style="color:#008000"&gt;object&lt;/span&gt;):&lt;br /&gt;
&amp;#160;&amp;#160;__metaclass__&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;ClrTypeMetaclass&lt;br /&gt;
&amp;#160;&amp;#160;_clrnamespace&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;&lt;span style="color:#BA2121"&gt;"DevHawk.IronPython.ClrTypeSeries"&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;_clrclassattribs&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;[Obsolete(&lt;span style="color:#BA2121"&gt;"Warning&amp;#160;Lark's&amp;#160;Vomit"&lt;/span&gt;)]&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#408080"&gt;&lt;i&gt;#&amp;#160;remaining&amp;#160;Product&amp;#160;class&amp;#160;definition&amp;#160;omited&amp;#160;for&amp;#160;clarity&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The cab_builder function returns an anonymous lambda function that closes over the
attrib_type variable. Python lambdas are just like C# lambdas, except that they only
support expressions [1]. The results of calling the lambda returned from cab_builder
is exactly the same as calling make_cab directly, but less verbose. And since I named
the function returned from cab_builder Obsolete, now my list of class custom attributes
looks &lt;em&gt;exactly &lt;/em&gt;like it does in C# (though still in a different place). As
usual, the code is &lt;a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/IronPython%20Stuff/%7C_%7C_clrtype%7C_%7C_/custom%7C_attrib%7C_with%7C_positional%7C_args.py"&gt;up
on my skydrive&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
If you’re only using the attribute once like this, it is kind of annoying to first
declare the cab_builder function. If you wanted to you could iterate over the types
in a given assembly, looking for ones that inherit from Attribute and generate the
cab_builder call dynamically. However, I’m not sure how performant that would be.
Another possibility would be to iterate over the types in a given assembly and generate
a Python module on disk with the calls to cab_builder. Then, you’d just have to import
this module of common attributes but still be able to include additional calls to
cab_builder as needed.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
[1] The lack of statement lambdas in Python is one of my few issues with the language. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=2687c504-afe1-44a9-a261-fc36de5ac8d8" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=2687c504-afe1-44a9-a261-fc36de5ac8d8</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,2687c504-afe1-44a9-a261-fc36de5ac8d8.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,2687c504-afe1-44a9-a261-fc36de5ac8d8.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=2687c504-afe1-44a9-a261-fc36de5ac8d8</wfw:commentRss><feedburner:origLink>http://devhawk.net/2009/06/17/clrtype+Metaclasses+Positional+Attribute+Parameters.aspx</feedburner:origLink></item><item><title>__clrtype__ Metaclasses: Simple Custom Attributes</title><link>http://feedproxy.google.com/~r/Devhawk/~3/ADGVcAYZ6OQ/clrtype+Metaclasses+Simple+Custom+Attributes.aspx</link><category>__clrtype__</category><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Mon, 15 Jun 2009 10:34:18 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,6cf6cd60-25ce-4704-8a55-305e1f0a2544.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I know it’s been a while since my <a href="http://devhawk.net/2009/04/24/clrtype+Metaclasses+Demo+Silverlight+Databinding.aspx">last
__clrtype__ post</a>, but I was blocked on some bug fixes that shipped as part of <a href="http://devhawk.net/2009/05/21/IronPython+26+Beta+1.aspx">IronPython
2.6 Beta 1</a>. So now let’s start looking at one of the <a href="http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=20489">most
requested IronPython features</a> – custom attributes!
</p>
        <p>
Over the course of the next three blog posts, I’m going to build out a mechanism for
specifying custom attributes on the CLR type we’re generating via __clrtype__. All
the various Builder classes in <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.aspx">System.Reflection.Emit</a> support
a <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.typebuilder.setcustomattribute.aspx">SetCustomAttribute</a> method
that works basically the same way. There are two overloads – the <a href="http://msdn.microsoft.com/en-us/library/sd003w15.aspx">one
I’m going to use</a> takes a single <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.customattributebuilder.aspx">CustomAttributeBuilder</a> as
a parameter.
</p>
        <p>
For this first post, I’m going to focus on the basic custom attribute infrastructure,
so we’re going to use the extremely simple <a href="http://msdn.microsoft.com/en-us/library/system.obsoleteattribute.aspx">ObsoleteAttribute</a>.
While you can pass some arguments to the constructor, for this first post I’m going
to use the <a href="http://msdn.microsoft.com/en-us/library/0xwcsd3h.aspx">parameterless
constructor</a>. To keep things less confusing, I’m going back to the <a href="http://devhawk.net/2009/04/22/clrtype+Metaclasses+Customizing+The+Type+Name.aspx">original
version</a> of the Product class, before I introduced CLR <a href="http://devhawk.net/2009/04/23/clrtype+Metaclasses+Adding+CLR+Fields.aspx">fields</a> and <a href="http://devhawk.net/2009/04/24/clrtype+Metaclasses+Adding+CLR+Properties.aspx">properties</a>.
The one change I’m making is that I’m adding a list of attributes I want to add to
the class.
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:9288c8c6-67c7-4585-959c-935e104f52ef" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#008000">
              <b>from</b>
            </span> <span style="color:#0000FF"><b>System</b></span> <span style="color:#008000"><b>import</b></span> ObsoleteAttribute <br><br><span style="color:#008000"><b>class</b></span> <span style="color:#0000FF"><b>Product</b></span>(<span style="color:#008000">object</span>):<br>
  __metaclass__ <span style="color:#666666">=</span> ClrTypeMetaclass<br>
  _clrnamespace <span style="color:#666666">=</span> <span style="color:#BA2121">"DevHawk.IronPython.ClrTypeSeries"</span>   <br>
  _clrclassattribs <span style="color:#666666">=</span> [ObsoleteAttribute]<br>
  <br>
  <span style="color:#408080"><i># remainder of class omitted for clarity</i></span><br></div>
        </div>
        <p>
Python <a href="http://docs.python.org/reference/expressions.html#list-displays">list
comprehensions</a> use the same square bracket syntax as C# properties, so it kinda
looks right to someone with a C# eye – though having the attribute specifications
inside the class, rather than above it, is totally different. I wish I could use Python’s <a href="http://docs.python.org/whatsnew/2.6.html#pep-3129-class-decorators">class
decorators</a> for custom class attributes, but class decorators run after metaclasses
so unfortunately that doesn’t work. Also, I can’t leave off the “Attribute” suffix
like you can in C#. If I really wanted to, I could provide a new type name in the
import statement (“from System import ObsoleteAttribute as Obsolete”) but I thought
spelling it out was clearer for this post.
</p>
        <p>
Now that I have specified the class attributes, I can update the metaclass __clrtype__
method to set the attribute on the generated CLR class:
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:f9802e29-f903-4d98-812a-1325c97d423d" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
    <span style="color:#008000"><b>if</b></span> <span style="color:#008000">hasattr</span>(cls, <span style="color:#BA2121">'_clrclassattribs'</span>):<br>
      <span style="color:#008000"><b>for</b></span> attribtype <span style="color:#AA22FF"><b>in</b></span> cls<span style="color:#666666">.</span>_clrclassattribs:<br>
        ci <span style="color:#666666">=</span> clr<span style="color:#666666">.</span>GetClrType(attribtype)<span style="color:#666666">.</span>GetConstructor(())<br>
        cab <span style="color:#666666">=</span> CustomAttributeBuilder(ci, ())<br>
        typebld<span style="color:#666666">.</span>SetCustomAttribute(cab)<br></div>
        </div>
        <p>
I’m simply iterating over the list of _clrclassattribs (if it exists), getting the
default parameterless constructor for each attribute type, creating a CustomAttributeBuilder
instance from that constructor and then calling SetCustomAttribute. Of course, this
is very simple because we’re not supporting any custom arguments or setting of named
properties. We’ll get to that in the next post. In the mean time, you can get the
full code for this post <a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/IronPython%20Stuff/%7C_%7C_clrtype%7C_%7C_/simple%7C_custom%7C_attributes.py">from
my skydrive</a>.
</p>
        <p>
There is one significant issue with this custom attribute code. Attributes are typically
marked with the <a href="http://msdn.microsoft.com/en-us/library/system.attributeusageattribute.aspx">AttributeUsage
attribute</a> that specifies a set of constraints, such as the kind of targets a given
attribute can be attached to and if it can be specified multiple times. For example,
the <a href="http://msdn.microsoft.com/en-us/library/system.mtathreadattribute.aspx">MTAThread
attribute</a> can’t be specified multiple times and it can only be attached to methods.
However, those attribute constraints are validated by the compiler, not the runtime.
I haven’t written any code yet to validate those constraints, so you can specify invalid
combinations like multiple MTAThread attributes on a class. For now, I’m just going
to leave it to the developer <em>not</em> to specify invalid attribute combinations.
Custom attributes are passive anyway so I’m figure no one will come looking for a
MTAThread attribute on a class or other such scenarios. 
</p>
        <p>
However, I’m interested in your opinion: When we get to actually productizing a higher-level
API for __clrtype__, what kinds of attribute validation should we do, if any? 
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=6cf6cd60-25ce-4704-8a55-305e1f0a2544"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=ADGVcAYZ6OQ:U992aVC2Lu0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=ADGVcAYZ6OQ:U992aVC2Lu0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=ADGVcAYZ6OQ:U992aVC2Lu0:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=ADGVcAYZ6OQ:U992aVC2Lu0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=ADGVcAYZ6OQ:U992aVC2Lu0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=ADGVcAYZ6OQ:U992aVC2Lu0:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/ADGVcAYZ6OQ" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
I know it’s been a while since my &lt;a href="http://devhawk.net/2009/04/24/clrtype+Metaclasses+Demo+Silverlight+Databinding.aspx"&gt;last
__clrtype__ post&lt;/a&gt;, but I was blocked on some bug fixes that shipped as part of &lt;a href="http://devhawk.net/2009/05/21/IronPython+26+Beta+1.aspx"&gt;IronPython
2.6 Beta 1&lt;/a&gt;. So now let’s start looking at one of the &lt;a href="http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=20489"&gt;most
requested IronPython features&lt;/a&gt; – custom attributes!
&lt;/p&gt;
&lt;p&gt;
Over the course of the next three blog posts, I’m going to build out a mechanism for
specifying custom attributes on the CLR type we’re generating via __clrtype__. All
the various Builder classes in &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.aspx"&gt;System.Reflection.Emit&lt;/a&gt; support
a &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.typebuilder.setcustomattribute.aspx"&gt;SetCustomAttribute&lt;/a&gt; method
that works basically the same way. There are two overloads – the &lt;a href="http://msdn.microsoft.com/en-us/library/sd003w15.aspx"&gt;one
I’m going to use&lt;/a&gt; takes a single &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.customattributebuilder.aspx"&gt;CustomAttributeBuilder&lt;/a&gt; as
a parameter.
&lt;/p&gt;
&lt;p&gt;
For this first post, I’m going to focus on the basic custom attribute infrastructure,
so we’re going to use the extremely simple &lt;a href="http://msdn.microsoft.com/en-us/library/system.obsoleteattribute.aspx"&gt;ObsoleteAttribute&lt;/a&gt;.
While you can pass some arguments to the constructor, for this first post I’m going
to use the &lt;a href="http://msdn.microsoft.com/en-us/library/0xwcsd3h.aspx"&gt;parameterless
constructor&lt;/a&gt;. To keep things less confusing, I’m going back to the &lt;a href="http://devhawk.net/2009/04/22/clrtype+Metaclasses+Customizing+The+Type+Name.aspx"&gt;original
version&lt;/a&gt; of the Product class, before I introduced CLR &lt;a href="http://devhawk.net/2009/04/23/clrtype+Metaclasses+Adding+CLR+Fields.aspx"&gt;fields&lt;/a&gt; and &lt;a href="http://devhawk.net/2009/04/24/clrtype+Metaclasses+Adding+CLR+Properties.aspx"&gt;properties&lt;/a&gt;.
The one change I’m making is that I’m adding a list of attributes I want to add to
the class.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:9288c8c6-67c7-4585-959c-935e104f52ef" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;from&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;System&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt;&amp;#160;ObsoleteAttribute&amp;#160;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#008000"&gt;&lt;b&gt;class&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;Product&lt;/b&gt;&lt;/span&gt;(&lt;span style="color:#008000"&gt;object&lt;/span&gt;):&lt;br /&gt;
&amp;#160;&amp;#160;__metaclass__&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;ClrTypeMetaclass&lt;br /&gt;
&amp;#160;&amp;#160;_clrnamespace&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;&lt;span style="color:#BA2121"&gt;"DevHawk.IronPython.ClrTypeSeries"&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;_clrclassattribs&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;[ObsoleteAttribute]&lt;br /&gt;
&amp;#160;&amp;#160;&lt;br /&gt;
&amp;#160;&amp;#160;&lt;span style="color:#408080"&gt;&lt;i&gt;#&amp;#160;remainder&amp;#160;of&amp;#160;class&amp;#160;omitted&amp;#160;for&amp;#160;clarity&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Python &lt;a href="http://docs.python.org/reference/expressions.html#list-displays"&gt;list
comprehensions&lt;/a&gt; use the same square bracket syntax as C# properties, so it kinda
looks right to someone with a C# eye – though having the attribute specifications
inside the class, rather than above it, is totally different. I wish I could use Python’s &lt;a href="http://docs.python.org/whatsnew/2.6.html#pep-3129-class-decorators"&gt;class
decorators&lt;/a&gt; for custom class attributes, but class decorators run after metaclasses
so unfortunately that doesn’t work. Also, I can’t leave off the “Attribute” suffix
like you can in C#. If I really wanted to, I could provide a new type name in the
import statement (“from System import ObsoleteAttribute as Obsolete”) but I thought
spelling it out was clearer for this post.
&lt;/p&gt;
&lt;p&gt;
Now that I have specified the class attributes, I can update the metaclass __clrtype__
method to set the attribute on the generated CLR class:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:f9802e29-f903-4d98-812a-1325c97d423d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#008000"&gt;hasattr&lt;/span&gt;(cls,&amp;#160;&lt;span style="color:#BA2121"&gt;'_clrclassattribs'&lt;/span&gt;):&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt;&amp;#160;attribtype&amp;#160;&lt;span style="color:#AA22FF"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/span&gt;&amp;#160;cls&lt;span style="color:#666666"&gt;.&lt;/span&gt;_clrclassattribs:&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;ci&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;clr&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetClrType(attribtype)&lt;span style="color:#666666"&gt;.&lt;/span&gt;GetConstructor(())&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;cab&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;CustomAttributeBuilder(ci,&amp;#160;())&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;typebld&lt;span style="color:#666666"&gt;.&lt;/span&gt;SetCustomAttribute(cab)&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
I’m simply iterating over the list of _clrclassattribs (if it exists), getting the
default parameterless constructor for each attribute type, creating a CustomAttributeBuilder
instance from that constructor and then calling SetCustomAttribute. Of course, this
is very simple because we’re not supporting any custom arguments or setting of named
properties. We’ll get to that in the next post. In the mean time, you can get the
full code for this post &lt;a href="http://cid-0d9bc809858885a4.skydrive.live.com/self.aspx/DevHawk%20Content/IronPython%20Stuff/%7C_%7C_clrtype%7C_%7C_/simple%7C_custom%7C_attributes.py"&gt;from
my skydrive&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
There is one significant issue with this custom attribute code. Attributes are typically
marked with the &lt;a href="http://msdn.microsoft.com/en-us/library/system.attributeusageattribute.aspx"&gt;AttributeUsage
attribute&lt;/a&gt; that specifies a set of constraints, such as the kind of targets a given
attribute can be attached to and if it can be specified multiple times. For example,
the &lt;a href="http://msdn.microsoft.com/en-us/library/system.mtathreadattribute.aspx"&gt;MTAThread
attribute&lt;/a&gt; can’t be specified multiple times and it can only be attached to methods.
However, those attribute constraints are validated by the compiler, not the runtime.
I haven’t written any code yet to validate those constraints, so you can specify invalid
combinations like multiple MTAThread attributes on a class. For now, I’m just going
to leave it to the developer &lt;em&gt;not&lt;/em&gt; to specify invalid attribute combinations.
Custom attributes are passive anyway so I’m figure no one will come looking for a
MTAThread attribute on a class or other such scenarios. 
&lt;/p&gt;
&lt;p&gt;
However, I’m interested in your opinion: When we get to actually productizing a higher-level
API for __clrtype__, what kinds of attribute validation should we do, if any? 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=6cf6cd60-25ce-4704-8a55-305e1f0a2544" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=6cf6cd60-25ce-4704-8a55-305e1f0a2544</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,6cf6cd60-25ce-4704-8a55-305e1f0a2544.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,6cf6cd60-25ce-4704-8a55-305e1f0a2544.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=6cf6cd60-25ce-4704-8a55-305e1f0a2544</wfw:commentRss><feedburner:origLink>http://devhawk.net/2009/06/15/clrtype+Metaclasses+Simple+Custom+Attributes.aspx</feedburner:origLink></item><item><title>Links for 2009-06-10 [del.icio.us]</title><link>http://feedproxy.google.com/~r/Devhawk/~3/VATCw2jRq2M/harrypierson</link><pubDate>Thu, 11 Jun 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/harrypierson#2009-06-10</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://deoxy.org/pkd_how2build.htm"&gt;How to Build a Universe That Doesn't Fall Apart Two Days Later&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/Devhawk/~4/VATCw2jRq2M" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/harrypierson#2009-06-10</feedburner:origLink></item><item><title>Strengthening the Microsoft Ecosystem with Source Code</title><link>http://feedproxy.google.com/~r/Devhawk/~3/Iy_6jNSdHBU/Strengthening+The+Microsoft+Ecosystem+With+Source+Code.aspx</link><category>Open Source</category><category>Other/Working at MSFT</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 03 Jun 2009 16:17:31 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,7e78d36c-d176-40b2-bdee-da2a49630948.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="display: inline; margin-left: 0px; margin-right: 0px" alt="clip_image001" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/af4c4ff204c4_C655/clip_image001_thumb.jpg"></img>Today
was the Presentation Idol competition <a href="http://devhawk.net/2009/05/18/Microsoft+And+Open+Source.aspx">I
blogged about</a> a couple of weeks ago. Unfortunately, I didn’t win - but believe
me when I say I was up against some <em>serious</em> competition. I think I was about
in the middle of the pack – better than some but clearly not as good as others.
</p>
        <p>
Since I made a big deal about asking for people ideas on how to present my topic of
choice – external contributions to Microsoft Open Source projects – I decided I’d
post my deck and my script. Yes, I said script. Usually, I don’t script what I’m going
to say word for word like this. But with only three and a half minutes to present,
I thought I’d be as precise as possible. You’ll notice some lines near the end are
in italics – those are ones I planned on cutting if I was in danger of going over
the time limit.
</p>
        <p>
Feedback, as usual, is most welcome.
</p>
        <p>
        </p>
        <hr></hr>
        <p>
        </p>
        <p>
        </p>
        <p>
          <a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide1.png">
            <img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Slide1" border="0" alt="Slide1" align="left" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide1_thumb.png" width="244" height="139"></img>
          </a> Hello,
my name is Harry Pierson. I’m a program manager in the Visual Studio Languages group
and I’m here to talk about what I would most like to do to improve Microsoft.
</p>
        <p>
At Microsoft, we care an awful lot about the software ecosystem. Searching for the
word “ecosystem” on Microsoft.com returns nearly eight thousand results. We talk about
the ecosystem in our marketing and in our press releases. 
</p>
        <p>
          <a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Slide2" border="0" alt="Slide2" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide2_thumb.png" width="244" height="139"></img>
          </a> In
2007, we commissioned a <a href="http://www.microsoft.com/about/corporatecitizenship/citizenship/economicimpact">study
of the global economic impact</a> of the Microsoft ecosystem. In a word, it’s massive.
It’s responsible for nearly 15 million jobs and drives over half a trillion dollars
a year in tax revenue worldwide. 
</p>
        <p>
No wonder we care about the ecosystem so much. 
</p>
        <p>
          <a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide3.png">
            <img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Slide3" border="0" alt="Slide3" align="left" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide3_thumb.png" width="244" height="139"></img>
          </a> But
clearly, we’re not the only ones who care. Microsoft represents a fairly small percentage
of the overall ecosystem. We earn just over 11% of the total revenue and account for
half of one percent of the total employment within the ecosystem. 
</p>
        <p>
That means there are an awfully large number of people with a vested interest in the
continuing success of the Microsoft platform. 
</p>
        <p>
          <a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide4.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Slide4" border="0" alt="Slide4" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide4_thumb.png" width="244" height="139"></img>
          </a> With
this vast ecosystem in mind, I want to talk about Open Source. Microsoft and Open
Source are often portrayed as enemies. But in DevDiv, we have several high profile
Open Source projects. I work on IronPython, which has been Open Source for over four
years. More recently, the ASP.NET and Extensibility Framework teams have decided to
release some projects as Open Source. 
</p>
        <p>
I believe we should have more Open Source projects at Microsoft. But more importantly,
I feel that we need to go beyond the textbook definition of Open Source. Our Open
Source projects are typically closed to external contributions. But for the ecosystem
at large, Open Source isn’t just about the availability <i>and distribution terms</i> of
the source code. It also implies a collaborative development model <i>- parties working
together across organizational boundaries, contributing directly to projects in question. </i></p>
        <p>
The thing I would most like to change about Microsoft would be to let members of our
ecosystem contribute code to our Open Source projects.
</p>
        <p>
          <a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide5.png">
            <img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Slide5" border="0" alt="Slide5" align="left" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide5_thumb.png" width="244" height="139"></img>
          </a> I
can tell you from personal experience, there are members of the IronPython community
who would leap at the opportunity to contribute code. And their engineering prowess
and real world would benefit the IronPython project tremendously. But the legal process
for getting permission to take contributions is onerous. Worse, the legal stigma attached
to code that isn’t 100% pure Microsoft intellectual property makes it nearly impossible
for any other group inside Microsoft to build on it.
</p>
        <p>
I realize the onerous legal process is there for a reason: to protect Microsoft’s
interests. But improving IronPython and Open Source projects like it isn’t just in
Microsoft’s best interest; it’s in the best interest of our ecosystem as well. We
need a legal framework that protects Microsoft while allowing for code contributions. <i>Developing
such a framework will be a challenge. But competitors like Sun, Google and IBM have
already demonstrated that it’s not insurmountable.</i></p>
        <p>
          <a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide6.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Slide6" border="0" alt="Slide6" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide6_thumb.png" width="244" height="139"></img>
          </a> Half
a trillion dollars annually. 15 Million jobs. 42% of the IT workforce. The Microsoft
ecosystem is the envy of the industry. And Microsoft is in a unique position to harness
the collective experience and engineering prowess of that ecosystem while simultaneously
dispelling the myth that we are an enemy of Open Source.
</p>
        <p>
          <i>It’s time we make this change.</i>
        </p>
        <p>
Thank you very much.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=7e78d36c-d176-40b2-bdee-da2a49630948"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=Iy_6jNSdHBU:jrIgO8QI_r4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=Iy_6jNSdHBU:jrIgO8QI_r4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=Iy_6jNSdHBU:jrIgO8QI_r4:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=Iy_6jNSdHBU:jrIgO8QI_r4:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=Iy_6jNSdHBU:jrIgO8QI_r4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=Iy_6jNSdHBU:jrIgO8QI_r4:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/Iy_6jNSdHBU" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
&lt;img style="display: inline; margin-left: 0px; margin-right: 0px" alt="clip_image001" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/af4c4ff204c4_C655/clip_image001_thumb.jpg" /&gt;Today
was the Presentation Idol competition &lt;a href="http://devhawk.net/2009/05/18/Microsoft+And+Open+Source.aspx"&gt;I
blogged about&lt;/a&gt; a couple of weeks ago. Unfortunately, I didn’t win - but believe
me when I say I was up against some &lt;em&gt;serious&lt;/em&gt; competition. I think I was about
in the middle of the pack – better than some but clearly not as good as others.
&lt;/p&gt;
&lt;p&gt;
Since I made a big deal about asking for people ideas on how to present my topic of
choice – external contributions to Microsoft Open Source projects – I decided I’d
post my deck and my script. Yes, I said script. Usually, I don’t script what I’m going
to say word for word like this. But with only three and a half minutes to present,
I thought I’d be as precise as possible. You’ll notice some lines near the end are
in italics – those are ones I planned on cutting if I was in danger of going over
the time limit.
&lt;/p&gt;
&lt;p&gt;
Feedback, as usual, is most welcome.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide1.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Slide1" border="0" alt="Slide1" align="left" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide1_thumb.png" width="244" height="139" /&gt;&lt;/a&gt; Hello,
my name is Harry Pierson. I’m a program manager in the Visual Studio Languages group
and I’m here to talk about what I would most like to do to improve Microsoft.
&lt;/p&gt;
&lt;p&gt;
At Microsoft, we care an awful lot about the software ecosystem. Searching for the
word “ecosystem” on Microsoft.com returns nearly eight thousand results. We talk about
the ecosystem in our marketing and in our press releases. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Slide2" border="0" alt="Slide2" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide2_thumb.png" width="244" height="139" /&gt;&lt;/a&gt; In
2007, we commissioned a &lt;a href="http://www.microsoft.com/about/corporatecitizenship/citizenship/economicimpact"&gt;study
of the global economic impact&lt;/a&gt; of the Microsoft ecosystem. In a word, it’s massive.
It’s responsible for nearly 15 million jobs and drives over half a trillion dollars
a year in tax revenue worldwide. 
&lt;/p&gt;
&lt;p&gt;
No wonder we care about the ecosystem so much. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide3.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Slide3" border="0" alt="Slide3" align="left" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide3_thumb.png" width="244" height="139" /&gt;&lt;/a&gt; But
clearly, we’re not the only ones who care. Microsoft represents a fairly small percentage
of the overall ecosystem. We earn just over 11% of the total revenue and account for
half of one percent of the total employment within the ecosystem. 
&lt;/p&gt;
&lt;p&gt;
That means there are an awfully large number of people with a vested interest in the
continuing success of the Microsoft platform. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Slide4" border="0" alt="Slide4" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide4_thumb.png" width="244" height="139" /&gt;&lt;/a&gt; With
this vast ecosystem in mind, I want to talk about Open Source. Microsoft and Open
Source are often portrayed as enemies. But in DevDiv, we have several high profile
Open Source projects. I work on IronPython, which has been Open Source for over four
years. More recently, the ASP.NET and Extensibility Framework teams have decided to
release some projects as Open Source. 
&lt;/p&gt;
&lt;p&gt;
I believe we should have more Open Source projects at Microsoft. But more importantly,
I feel that we need to go beyond the textbook definition of Open Source. Our Open
Source projects are typically closed to external contributions. But for the ecosystem
at large, Open Source isn’t just about the availability &lt;i&gt;and distribution terms&lt;/i&gt; of
the source code. It also implies a collaborative development model &lt;i&gt;- parties working
together across organizational boundaries, contributing directly to projects in question. &lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
The thing I would most like to change about Microsoft would be to let members of our
ecosystem contribute code to our Open Source projects.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide5.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Slide5" border="0" alt="Slide5" align="left" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide5_thumb.png" width="244" height="139" /&gt;&lt;/a&gt; I
can tell you from personal experience, there are members of the IronPython community
who would leap at the opportunity to contribute code. And their engineering prowess
and real world would benefit the IronPython project tremendously. But the legal process
for getting permission to take contributions is onerous. Worse, the legal stigma attached
to code that isn’t 100% pure Microsoft intellectual property makes it nearly impossible
for any other group inside Microsoft to build on it.
&lt;/p&gt;
&lt;p&gt;
I realize the onerous legal process is there for a reason: to protect Microsoft’s
interests. But improving IronPython and Open Source projects like it isn’t just in
Microsoft’s best interest; it’s in the best interest of our ecosystem as well. We
need a legal framework that protects Microsoft while allowing for code contributions. &lt;i&gt;Developing
such a framework will be a challenge. But competitors like Sun, Google and IBM have
already demonstrated that it’s not insurmountable.&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Slide6" border="0" alt="Slide6" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/StrengtheningourSoftwareEcosystemwithSou_E1A2/Slide6_thumb.png" width="244" height="139" /&gt;&lt;/a&gt; Half
a trillion dollars annually. 15 Million jobs. 42% of the IT workforce. The Microsoft
ecosystem is the envy of the industry. And Microsoft is in a unique position to harness
the collective experience and engineering prowess of that ecosystem while simultaneously
dispelling the myth that we are an enemy of Open Source.
&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;It’s time we make this change.&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
Thank you very much.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=7e78d36c-d176-40b2-bdee-da2a49630948" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=7e78d36c-d176-40b2-bdee-da2a49630948</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,7e78d36c-d176-40b2-bdee-da2a49630948.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,7e78d36c-d176-40b2-bdee-da2a49630948.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=7e78d36c-d176-40b2-bdee-da2a49630948</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">4</slash:comments><feedburner:origLink>http://devhawk.net/2009/06/03/Strengthening+The+Microsoft+Ecosystem+With+Source+Code.aspx</feedburner:origLink></item><item><title>A Somewhat Scary Birthday</title><link>http://feedproxy.google.com/~r/Devhawk/~3/TtmYrpUENrs/A+Somewhat+Scary+Birthday.aspx</link><category>Health</category><category>Other/Family</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Fri, 22 May 2009 13:23:07 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,9720afea-0387-4ee7-85b6-914d26a40ec7.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Yesterday was my 39th birthday. Among other things I got a <a href="http://www.mayoclinic.com/health/vasovagal-syncope/DS00806">vasovagal
syncope</a> (aka I fainted), a trip to the hospital and an MRI. 
</p>
        <p>
Yeah, I’ve had better birthdays. But I’m feeling much better now.
</p>
        <p>
Since Monday, I’ve been having weird numbness and tingling in my hands, feet and midsection.
Ever have your foot fall asleep? You know how it feels when your foot wakes up again?
It’s kinda like that. After three days of that, I decided it was time to go see the
doctor. My doctor is right by my daughter’s school, so I try and schedule my appointments
so I can drop her off and save my wife the trip. But the only appointment they had
yesterday was thirty minutes before my daughter’s school starts, so I ended up going
alone. That turned out to be a very good thing.
</p>
        <p>
Diabetes is one of the things that can cause this numbness and tingling, so my wife
and I figured that I shouldn’t eat anything in case the doctor wanted to check my
blood sugar. Sure enough, they wanted to run a few blood tests. My wife called as
they were drawing my blood – she had dropped off our daughter and wanted to know if
I wanted her to stop by.  I told her to stop by if she wanted, hung up, and promptly
fainted. Luckily, Jules had decided she wanted to stop by so she was there when I
came to.
</p>
        <p>
Apparently, vasovagal syncope is the most common cause of fainting and having your
blood drawn is a common trigger. I’ve never had that reaction to having my blood drawn,
though I can’t remember ever having my blood drawn while fasting. But I tell you what,
I don’t ever want to go thru that again. All I really remember was trying to get my
brain to focus, and it wouldn’t. Pretty scary.
</p>
        <p>
Playing it better safe than sorry, I was sent off to the hospital to spend two hours
crammed in the MRI machine to get an scan of my brain and spine done. Also not a pleasant
experience, but much better than fainting. There was much more ominous talk like “admitting
for observation” and “lumbar puncture”, but apparently the MRI didn’t show anything
requiring all that so I was sent home. 
</p>
        <p>
I still have the numbness and tingling, though it’s somewhat better today than yesterday.
The good news is that it’s not diabetes or my thyroid or anything like that and they
don’t think the fainting was related at all. Since the tingling and numbness is a
little better today, I’m thinking it’s something like a pinched nerve. My doctor wants
me to go see a specialist, so I’ve got an appointment with a neurologist in a couple
of weeks. We’ll see how it feels by then - in the meantime, I’m taking it easy. I
even skipped work again today – five day weekend FTW! 
</p>
        <p>
As for my birthday, we did decide to postpone my “<a href="http://twitter.com/JuliannePierson/status/1851811876">FANTASTIC
surprise</a>”. Jules had arranged for us to go camping on Orcas island over the weekend.
I’m really excited for the trip – it’ll be our first real camping trip outside of
the back yard - but I’m not sure if I’ll be up for it this weekend. My parents sent
me a bunch of Capitals gear as well as some money for new hockey equipment – I really
need a new helmet and elbow pads. My kids both made me awesome cards – Patrick’s new
thing is to make pop-up cards. He also made me a paper “cake” crown.
</p>
        <p>
So even though that whole tingling/vasovagal/hospital/MRI thing was a less than fun
way to spend the day, I still ended up having a pretty decent birthday. I’m especially
thankful for my awesome wife, who does an amazing job taking care of me when I’m sick
– much better than I am able to do for her when she’s sick I’m afraid. 
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=9720afea-0387-4ee7-85b6-914d26a40ec7"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=TtmYrpUENrs:eyRG_bmMLWs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=TtmYrpUENrs:eyRG_bmMLWs:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=TtmYrpUENrs:eyRG_bmMLWs:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=TtmYrpUENrs:eyRG_bmMLWs:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=TtmYrpUENrs:eyRG_bmMLWs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=TtmYrpUENrs:eyRG_bmMLWs:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/TtmYrpUENrs" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
Yesterday was my 39th birthday. Among other things I got a &lt;a href="http://www.mayoclinic.com/health/vasovagal-syncope/DS00806"&gt;vasovagal
syncope&lt;/a&gt; (aka I fainted), a trip to the hospital and an MRI. 
&lt;/p&gt;
&lt;p&gt;
Yeah, I’ve had better birthdays. But I’m feeling much better now.
&lt;/p&gt;
&lt;p&gt;
Since Monday, I’ve been having weird numbness and tingling in my hands, feet and midsection.
Ever have your foot fall asleep? You know how it feels when your foot wakes up again?
It’s kinda like that. After three days of that, I decided it was time to go see the
doctor. My doctor is right by my daughter’s school, so I try and schedule my appointments
so I can drop her off and save my wife the trip. But the only appointment they had
yesterday was thirty minutes before my daughter’s school starts, so I ended up going
alone. That turned out to be a very good thing.
&lt;/p&gt;
&lt;p&gt;
Diabetes is one of the things that can cause this numbness and tingling, so my wife
and I figured that I shouldn’t eat anything in case the doctor wanted to check my
blood sugar. Sure enough, they wanted to run a few blood tests. My wife called as
they were drawing my blood – she had dropped off our daughter and wanted to know if
I wanted her to stop by.&amp;#160; I told her to stop by if she wanted, hung up, and promptly
fainted. Luckily, Jules had decided she wanted to stop by so she was there when I
came to.
&lt;/p&gt;
&lt;p&gt;
Apparently, vasovagal syncope is the most common cause of fainting and having your
blood drawn is a common trigger. I’ve never had that reaction to having my blood drawn,
though I can’t remember ever having my blood drawn while fasting. But I tell you what,
I don’t ever want to go thru that again. All I really remember was trying to get my
brain to focus, and it wouldn’t. Pretty scary.
&lt;/p&gt;
&lt;p&gt;
Playing it better safe than sorry, I was sent off to the hospital to spend two hours
crammed in the MRI machine to get an scan of my brain and spine done. Also not a pleasant
experience, but much better than fainting. There was much more ominous talk like “admitting
for observation” and “lumbar puncture”, but apparently the MRI didn’t show anything
requiring all that so I was sent home. 
&lt;/p&gt;
&lt;p&gt;
I still have the numbness and tingling, though it’s somewhat better today than yesterday.
The good news is that it’s not diabetes or my thyroid or anything like that and they
don’t think the fainting was related at all. Since the tingling and numbness is a
little better today, I’m thinking it’s something like a pinched nerve. My doctor wants
me to go see a specialist, so I’ve got an appointment with a neurologist in a couple
of weeks. We’ll see how it feels by then - in the meantime, I’m taking it easy. I
even skipped work again today – five day weekend FTW! 
&lt;/p&gt;
&lt;p&gt;
As for my birthday, we did decide to postpone my “&lt;a href="http://twitter.com/JuliannePierson/status/1851811876"&gt;FANTASTIC
surprise&lt;/a&gt;”. Jules had arranged for us to go camping on Orcas island over the weekend.
I’m really excited for the trip – it’ll be our first real camping trip outside of
the back yard - but I’m not sure if I’ll be up for it this weekend. My parents sent
me a bunch of Capitals gear as well as some money for new hockey equipment – I really
need a new helmet and elbow pads. My kids both made me awesome cards – Patrick’s new
thing is to make pop-up cards. He also made me a paper “cake” crown.
&lt;/p&gt;
&lt;p&gt;
So even though that whole tingling/vasovagal/hospital/MRI thing was a less than fun
way to spend the day, I still ended up having a pretty decent birthday. I’m especially
thankful for my awesome wife, who does an amazing job taking care of me when I’m sick
– much better than I am able to do for her when she’s sick I’m afraid. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=9720afea-0387-4ee7-85b6-914d26a40ec7" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=9720afea-0387-4ee7-85b6-914d26a40ec7</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,9720afea-0387-4ee7-85b6-914d26a40ec7.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,9720afea-0387-4ee7-85b6-914d26a40ec7.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=9720afea-0387-4ee7-85b6-914d26a40ec7</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://devhawk.net/2009/05/22/A+Somewhat+Scary+Birthday.aspx</feedburner:origLink></item><item><title>IronPython 2.6 Beta 1</title><link>http://feedproxy.google.com/~r/Devhawk/~3/Kqh7eem_VYc/IronPython+26+Beta+1.aspx</link><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 20 May 2009 17:30:57 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,6af3ecd9-fef5-4181-9f8f-762b3ecdd575.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In addition to the <a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27320">IronPython
CTP for .NET Framework 4.0 Beta 1</a> I <a href="http://devhawk.net/2009/05/20/IronPython+26+CTP+For+NET+40+Beta+1.aspx">blogged
about earlier</a>, we also released the <a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25126">first
beta of IronPython 2.6</a> today. How about that – two IronPython releases in one
day! This is our second preview release as we work towards our 2.6 RTM in September.
2.6 Alpha 1 was <a href="http://devhawk.net/2009/03/27/IronPython+26+Alpha+1.aspx">released</a> back
in March. 
</p>
        <p>
There are two big new features in this release. The first is our implementation of
the <a href="http://docs.python.org/library/ctypes.html">ctypes module</a>. The ctypes
module is like P/Invoke for Python. It allows Python code to call into unmanaged DLL
functions. Here, for example, I’m calling into the standard <a href="http://msdn.microsoft.com/en-us/library/wc7014hz.aspx">wprintf
function</a> from msvcrt.dll
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:2a20cc48-d467-488e-ab84-0c85e306132a" class="wlWriterEditableSmartContent">
          <div style="font-family:consolas,lucida console,courier,monospace">
            <span style="color:#808080">IronPython 2.6 Beta 1 (2.6.0.10) on .NET 2.0.50727.4918<br></span>
            <span style="color:#000080">
              <b>&gt;&gt;&gt; </b>
            </span>
            <span style="color:#008000">
              <b>import</b>
            </span> <span style="color:#0000FF"><b>ctypes</b></span><br><span style="color:#000080"><b>&gt;&gt;&gt; </b></span>libc <span style="color:#666666">=</span> ctypes<span style="color:#666666">.</span>cdll<span style="color:#666666">.</span>msvcrt<br><span style="color:#000080"><b>&gt;&gt;&gt; </b></span>ret <span style="color:#666666">=</span> libc<span style="color:#666666">.</span>wprintf(<span style="color:#BA2121">"</span><span style="color:#BB6688"><b>%s</b></span><span style="color:#BB6622"><b>\n</b></span><span style="color:#BA2121">"</span>, <span style="color:#BA2121">"hello"</span>)<br><span style="color:#808080">hello<br></span></div>
        </div>
        <p>
Between ctypes and <a href="http://code.google.com/p/ironclad/">Ironclad</a>, I think
we’ll eventually be able to load most native Python extensions in IronPython. Woot!
</p>
        <p>
The other big new feature in this release is a real implementation of <a href="http://docs.python.org/library/sys.html#sys._getframe">sys._getframe</a>.
_getframe lets you write code that inspects the Python callstack. Previously, we supported
_getframe only with a depth of zero which is to say you could inspect the current
frame, but no others. Now, by default we don’t implement _getframe at all unless you
pass in –X:Frames or –X:FullFrames on the command line. Removing the version of _getframe
that only worked for depth zero fixes <a href="http://knowbody.livejournal.com/13271.html">an
issue with collections.py</a> that broke much of the 2.6 standard library in IronPython
2.6 Alpha 1. 
</p>
        <p>
        </p>
        <p>
The difference between Frames and FullFrames is in what is returned by frame.f_locals
member. If you’re running with FullFrames, we hoist all local variables into the heap
so they can be accessed by our frame walker. If you’re running with Frames, our ability
to access locals up the stack is limited. Sometimes they are available - If you called <a href="http://docs.python.org/library/functions.html#locals">locals()</a> in
a frame up the stack for example, then f_locals will be available – but usually not.
There’s a performance difference between the default (i.e. no Frames), –X:Frames and
–X:FullFrames, hence why we provide the user fine grained control over the Frame support. 
</p>
        <p>
Our <a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=IP26B1VsCPy26Perf&amp;referringTitle=Home">performance</a> has
gotten better <a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=IP26A1VsCPy26Perf&amp;referringTitle=Home">relative</a> to
2.6 Alpha 1. Our PyStone numbers have improved 80% from Alpha 1, similar to where
we were in IronPython 2.0.1. We’ve also been able to cut our startup time about 25%
from 2.0.1. We’re still an order of magnitude slower than CPython on startup, but
we’re getting better. We’re significantly worse on PyBench than we were in 2.6 Alpha
1, but that’s primarily because there’s now a second exception test. As I <a href="http://devhawk.net/2009/03/27/IronPython+26+Alpha+1.aspx">described
back in March</a>, we get killed on the exceptions benchmarks – the two combine to
consume nearly 62% of our total run time. Ouch!
</p>
        <p>
Finally, there are bug fixes. Of particular relevance to readers of this blog are
a series of fixes that allow me to continue on with my <a href="http://devhawk.net/CategoryView,category,__clrtype__.aspx">__clrtype__
series</a>. Watch for that soon.
</p>
        <p>
As I said back when we released Alpha 1, the <a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=2.6%20Release%20Plan">release
cycle on 2.6</a> will be much shorter than it was for 2.0. 2.0 had eight alphas, five
betas and two release candidates over the course of around twenty months. We expect
2.6 to have one alpha, two betas and a release candidate over eight months. So please
start trying <a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25126">using
the beta</a> as soon as you can so you can give us your feedback and we can fix your
bugs!
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=6af3ecd9-fef5-4181-9f8f-762b3ecdd575"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=Kqh7eem_VYc:qNnXHfiVMug:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=Kqh7eem_VYc:qNnXHfiVMug:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=Kqh7eem_VYc:qNnXHfiVMug:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=Kqh7eem_VYc:qNnXHfiVMug:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=Kqh7eem_VYc:qNnXHfiVMug:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=Kqh7eem_VYc:qNnXHfiVMug:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/Kqh7eem_VYc" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
In addition to the &lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27320"&gt;IronPython
CTP for .NET Framework 4.0 Beta 1&lt;/a&gt; I &lt;a href="http://devhawk.net/2009/05/20/IronPython+26+CTP+For+NET+40+Beta+1.aspx"&gt;blogged
about earlier&lt;/a&gt;, we also released the &lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25126"&gt;first
beta of IronPython 2.6&lt;/a&gt; today. How about that – two IronPython releases in one
day! This is our second preview release as we work towards our 2.6 RTM in September.
2.6 Alpha 1 was &lt;a href="http://devhawk.net/2009/03/27/IronPython+26+Alpha+1.aspx"&gt;released&lt;/a&gt; back
in March. 
&lt;/p&gt;
&lt;p&gt;
There are two big new features in this release. The first is our implementation of
the &lt;a href="http://docs.python.org/library/ctypes.html"&gt;ctypes module&lt;/a&gt;. The ctypes
module is like P/Invoke for Python. It allows Python code to call into unmanaged DLL
functions. Here, for example, I’m calling into the standard &lt;a href="http://msdn.microsoft.com/en-us/library/wc7014hz.aspx"&gt;wprintf
function&lt;/a&gt; from msvcrt.dll
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:2a20cc48-d467-488e-ab84-0c85e306132a" class="wlWriterEditableSmartContent"&gt;
&lt;div style="font-family:consolas,lucida console,courier,monospace"&gt;
&lt;span style="color:#808080"&gt;IronPython&amp;#160;2.6&amp;#160;Beta&amp;#160;1&amp;#160;(2.6.0.10)&amp;#160;on&amp;#160;.NET&amp;#160;2.0.50727.4918&lt;br /&gt;
&lt;/span&gt;&lt;span style="color:#000080"&gt;&lt;b&gt;&amp;gt;&amp;gt;&amp;gt;&amp;#160;&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#008000"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:#0000FF"&gt;&lt;b&gt;ctypes&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style="color:#000080"&gt;&lt;b&gt;&amp;gt;&amp;gt;&amp;gt;&amp;#160;&lt;/b&gt;&lt;/span&gt;libc&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;ctypes&lt;span style="color:#666666"&gt;.&lt;/span&gt;cdll&lt;span style="color:#666666"&gt;.&lt;/span&gt;msvcrt&lt;br /&gt;
&lt;span style="color:#000080"&gt;&lt;b&gt;&amp;gt;&amp;gt;&amp;gt;&amp;#160;&lt;/b&gt;&lt;/span&gt;ret&amp;#160;&lt;span style="color:#666666"&gt;=&lt;/span&gt;&amp;#160;libc&lt;span style="color:#666666"&gt;.&lt;/span&gt;wprintf(&lt;span style="color:#BA2121"&gt;"&lt;/span&gt;&lt;span style="color:#BB6688"&gt;&lt;b&gt;%s&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#BB6622"&gt;&lt;b&gt;\n&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#BA2121"&gt;"&lt;/span&gt;,&amp;#160;&lt;span style="color:#BA2121"&gt;"hello"&lt;/span&gt;)&lt;br /&gt;
&lt;span style="color:#808080"&gt;hello&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Between ctypes and &lt;a href="http://code.google.com/p/ironclad/"&gt;Ironclad&lt;/a&gt;, I think
we’ll eventually be able to load most native Python extensions in IronPython. Woot!
&lt;/p&gt;
&lt;p&gt;
The other big new feature in this release is a real implementation of &lt;a href="http://docs.python.org/library/sys.html#sys._getframe"&gt;sys._getframe&lt;/a&gt;.
_getframe lets you write code that inspects the Python callstack. Previously, we supported
_getframe only with a depth of zero which is to say you could inspect the current
frame, but no others. Now, by default we don’t implement _getframe at all unless you
pass in –X:Frames or –X:FullFrames on the command line. Removing the version of _getframe
that only worked for depth zero fixes &lt;a href="http://knowbody.livejournal.com/13271.html"&gt;an
issue with collections.py&lt;/a&gt; that broke much of the 2.6 standard library in IronPython
2.6 Alpha 1. 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
The difference between Frames and FullFrames is in what is returned by frame.f_locals
member. If you’re running with FullFrames, we hoist all local variables into the heap
so they can be accessed by our frame walker. If you’re running with Frames, our ability
to access locals up the stack is limited. Sometimes they are available - If you called &lt;a href="http://docs.python.org/library/functions.html#locals"&gt;locals()&lt;/a&gt; in
a frame up the stack for example, then f_locals will be available – but usually not.
There’s a performance difference between the default (i.e. no Frames), –X:Frames and
–X:FullFrames, hence why we provide the user fine grained control over the Frame support. 
&lt;/p&gt;
&lt;p&gt;
Our &lt;a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=IP26B1VsCPy26Perf&amp;amp;referringTitle=Home"&gt;performance&lt;/a&gt; has
gotten better &lt;a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=IP26A1VsCPy26Perf&amp;amp;referringTitle=Home"&gt;relative&lt;/a&gt; to
2.6 Alpha 1. Our PyStone numbers have improved 80% from Alpha 1, similar to where
we were in IronPython 2.0.1. We’ve also been able to cut our startup time about 25%
from 2.0.1. We’re still an order of magnitude slower than CPython on startup, but
we’re getting better. We’re significantly worse on PyBench than we were in 2.6 Alpha
1, but that’s primarily because there’s now a second exception test. As I &lt;a href="http://devhawk.net/2009/03/27/IronPython+26+Alpha+1.aspx"&gt;described
back in March&lt;/a&gt;, we get killed on the exceptions benchmarks – the two combine to
consume nearly 62% of our total run time. Ouch!
&lt;/p&gt;
&lt;p&gt;
Finally, there are bug fixes. Of particular relevance to readers of this blog are
a series of fixes that allow me to continue on with my &lt;a href="http://devhawk.net/CategoryView,category,__clrtype__.aspx"&gt;__clrtype__
series&lt;/a&gt;. Watch for that soon.
&lt;/p&gt;
&lt;p&gt;
As I said back when we released Alpha 1, the &lt;a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=2.6%20Release%20Plan"&gt;release
cycle on 2.6&lt;/a&gt; will be much shorter than it was for 2.0. 2.0 had eight alphas, five
betas and two release candidates over the course of around twenty months. We expect
2.6 to have one alpha, two betas and a release candidate over eight months. So please
start trying &lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25126"&gt;using
the beta&lt;/a&gt; as soon as you can so you can give us your feedback and we can fix your
bugs!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=6af3ecd9-fef5-4181-9f8f-762b3ecdd575" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=6af3ecd9-fef5-4181-9f8f-762b3ecdd575</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,6af3ecd9-fef5-4181-9f8f-762b3ecdd575.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,6af3ecd9-fef5-4181-9f8f-762b3ecdd575.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=6af3ecd9-fef5-4181-9f8f-762b3ecdd575</wfw:commentRss><feedburner:origLink>http://devhawk.net/2009/05/21/IronPython+26+Beta+1.aspx</feedburner:origLink></item><item><title>IronPython 2.6 CTP for .NET 4.0 Beta 1</title><link>http://feedproxy.google.com/~r/Devhawk/~3/qQBpioxpvGw/IronPython+26+CTP+For+NET+40+Beta+1.aspx</link><category>IronPython</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Wed, 20 May 2009 11:54:30 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,892c4513-9a42-440c-9971-b28b231f8bcf.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The .NET Framework 4.0 and Visual Studio 2010 Beta 1 is now <a href="http://go.microsoft.com/fwlink/?LinkID=151797">generally
available</a> for download. Jason Zander has a very thorough rundown on <a href="http://blogs.msdn.com/jasonz/archive/2009/05/18/announcing-vs2010-net-framework-4-0-beta-1.aspx">some
of the new features</a> in this release. Of course, my favorite new features in VS2010
is the new dynamic language support in <a href="http://msdn.microsoft.com/en-us/library/dd264736(VS.100).aspx">C#</a> and <a href="http://msdn.microsoft.com/en-us/library/dd537660(VS.100).aspx">Visual
Basic</a>, which let’s you easily call out to IronPython code from those languages. 
</p>
        <p>
For anyone who wants to experiment with interoperating C# or VB with IronPython, we
released <a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27320">IronPython
2.6 CTP for .NET 4.0 Beta 1</a> today. There’s also a <a href="http://msdn.microsoft.com/en-us/library/dd867744.aspx">walkthru</a> showing
how you can use the standard Python library module <a href="http://docs.python.org/library/random.html">random</a> from
both C# and VB. <strike>Note, there’s currently a URL bug in that walkthru – it links
to IronPython 2.6 Alpha 1 rather than the .NET 4.0 Beta 1 IronPython CTP. Make sure
you pick up the right version of IronPython if you want to try out the walkthru.</strike> Looks
like they fixed the redirect in the walkthru.
</p>
        <p>
FYI, this is a CTP quality release with about the same functionality as IronPython
2.6 Alpha 1.  Essentially, this is the version of IronPython that was in the
source tree when the VS team branched for Beta 1. 
</p>
        <p>
If you’ve got any feedback, please drop us a line on the <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">mailing
list</a>.
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=892c4513-9a42-440c-9971-b28b231f8bcf"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=qQBpioxpvGw:5Sj4tf8pUjM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=qQBpioxpvGw:5Sj4tf8pUjM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=qQBpioxpvGw:5Sj4tf8pUjM:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=qQBpioxpvGw:5Sj4tf8pUjM:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=qQBpioxpvGw:5Sj4tf8pUjM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=qQBpioxpvGw:5Sj4tf8pUjM:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/qQBpioxpvGw" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
The .NET Framework 4.0 and Visual Studio 2010 Beta 1 is now &lt;a href="http://go.microsoft.com/fwlink/?LinkID=151797"&gt;generally
available&lt;/a&gt; for download. Jason Zander has a very thorough rundown on &lt;a href="http://blogs.msdn.com/jasonz/archive/2009/05/18/announcing-vs2010-net-framework-4-0-beta-1.aspx"&gt;some
of the new features&lt;/a&gt; in this release. Of course, my favorite new features in VS2010
is the new dynamic language support in &lt;a href="http://msdn.microsoft.com/en-us/library/dd264736(VS.100).aspx"&gt;C#&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd537660(VS.100).aspx"&gt;Visual
Basic&lt;/a&gt;, which let’s you easily call out to IronPython code from those languages. 
&lt;/p&gt;
&lt;p&gt;
For anyone who wants to experiment with interoperating C# or VB with IronPython, we
released &lt;a href="http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27320"&gt;IronPython
2.6 CTP for .NET 4.0 Beta 1&lt;/a&gt; today. There’s also a &lt;a href="http://msdn.microsoft.com/en-us/library/dd867744.aspx"&gt;walkthru&lt;/a&gt; showing
how you can use the standard Python library module &lt;a href="http://docs.python.org/library/random.html"&gt;random&lt;/a&gt; from
both C# and VB. &lt;strike&gt;Note, there’s currently a URL bug in that walkthru – it links
to IronPython 2.6 Alpha 1 rather than the .NET 4.0 Beta 1 IronPython CTP. Make sure
you pick up the right version of IronPython if you want to try out the walkthru.&lt;/strike&gt; Looks
like they fixed the redirect in the walkthru.
&lt;/p&gt;
&lt;p&gt;
FYI, this is a CTP quality release with about the same functionality as IronPython
2.6 Alpha 1.&amp;#160; Essentially, this is the version of IronPython that was in the
source tree when the VS team branched for Beta 1. 
&lt;/p&gt;
&lt;p&gt;
If you’ve got any feedback, please drop us a line on the &lt;a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com"&gt;mailing
list&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=892c4513-9a42-440c-9971-b28b231f8bcf" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=892c4513-9a42-440c-9971-b28b231f8bcf</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,892c4513-9a42-440c-9971-b28b231f8bcf.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,892c4513-9a42-440c-9971-b28b231f8bcf.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=892c4513-9a42-440c-9971-b28b231f8bcf</wfw:commentRss><feedburner:origLink>http://devhawk.net/2009/05/20/IronPython+26+CTP+For+NET+40+Beta+1.aspx</feedburner:origLink></item><item><title>Microsoft and Open Source</title><link>http://feedproxy.google.com/~r/Devhawk/~3/VAg4A2xFAL0/Microsoft+And+Open+Source.aspx</link><category>Microsoft</category><category>Open Source</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harry Pierson</dc:creator><pubDate>Mon, 18 May 2009 14:23:28 PDT</pubDate><guid isPermaLink="false">http://devhawk.net/PermaLink,guid,45a06ea2-5414-452e-9e0b-c18ec6519b60.aspx</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://devhawk.net/content/binary/WindowsLiveWriter/af4c4ff204c4_C655/clip_image001_2.jpg">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="clip_image001" border="0" alt="clip_image001" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/af4c4ff204c4_C655/clip_image001_thumb.jpg" width="240" height="144"></img>
          </a>In
a couple of weeks, I‘m participating in an internal “Presentation Idol”competition.
It’s a contest of presentation skills against impressive competition (I can’t name
names, but rest assured it’s a strong group) being judged by Microsoft executives
(again, I can’t name names, but this time it’s because I don’t know who’s judging)
in front of what I assume will be a large technical internal Microsoft audience. To
top it off, we each only get three minutes and thirty three seconds each to deliver
our presentations.
</p>
        <p>
So yeah, no pressure.
</p>
        <p>
        </p>
        <p>
The topic we’re all presenting is “What is the one thing we should do to improve Microsoft?”
For those who know me, it should come as little surprise that I picked a variant of
“more open source” for my presentation. More specifically, I’m planning to present
the following:
</p>
        <ol>
          <li>
Any product Microsoft gives away for free should also be Open Source. 
</li>
          <li>
Open Source Microsoft products should accept contributions from the community. 
</li>
        </ol>
        <p>
I realize that many people consider this separation between “source availability”
and “community contributions” completely artificial. Sure, the <a href="http://opensource.org/docs/osd">accepted
definition of Open Source</a> only addresses the availability and distribution of
source code, but most Open Source advocates consider the ability to collaborate and
contribute – what Wikipedia calls “<a href="http://en.wikipedia.org/wiki/Commons-based_peer_production">Commons-based
peer production</a>” - a critical aspect of Open Source. For example, with respect
to the <a href="http://weblogs.asp.net/scottgu/archive/2009/04/01/asp-net-mvc-1-0.aspx">announcement</a> that
ASP.NET MVC would be released under the <a href="http://opensource.org/licenses/ms-pl.html">Ms-PL</a>,
Keith Elder <a href="http://twitter.com/keithelder/status/1438253992">tweeted</a>: 
</p>
        <blockquote>
          <p>
“Giving someone your source code is NOT open source. So although Asp.Net MVC's source
code is out there for download, not open source.”
</p>
        </blockquote>
        <p>
          <a title="DevHawk on DFB" href="http://deepfriedbytes.com/podcast/episode-32-being-dynamic-about-ironpython-with-harry-pierson-ndash-part-2/">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://deepfriedbytes.com/files/media/image/WindowsLiveWriter/Media_8AE9/image_thumb_4.png" width="240" height="98"></img>
          </a>In
what now seems like a huge coincidence, Keith and his co-host <a href="http://twitter.com/cwoodruff">Chris
“Woody” Woodruff</a> interviewed me later that day for their podcast <a href="http://deepfriedbytes.com/">Deep
Fried Bytes</a>. As you might imagine, while we started with <a href="http://deepfriedbytes.com/podcast/episode-31-being-dynamic-about-ironpython-with-harry-pierson-ndash-part-1/">talking
about IronPython</a>, we eventually started discussing <a href="http://deepfriedbytes.com/podcast/episode-32-being-dynamic-about-ironpython-with-harry-pierson-ndash-part-2/">open
source at Microsoft</a> more generally. It was a great conversation, and we found
lots of common ground.
</p>
        <p>
Personally, I think Microsoft is making small steps in the right direction when it
comes to Open Source. Not only have some high profile Microsoft projects go Open Source
like ASP.NET MVC and <a href="http://codebetter.com/blogs/glenn.block/archive/2008/10/02/mef-going-ms-pl-the-little-engine-that-could.aspx">MEF</a>,
but we’ve even started taking baby steps for including external intellectual property.
Releasing ASP.NET MVC under Ms-PL is a big deal, but I think <a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx">including
jQuery “in the box”</a> is a much, <em>much</em> bigger deal. It remains to be seen
if it’s a one-time-only deal or if it’s a new trend inside Microsoft. 
</p>
        <p>
Obviously, I hope it’s a trend. Going from “include jQuery in ASP.NET” to “accept
community contributions in ASP.NET” seems like a relatively achievable goal. 
</p>
        <p>
Now, here’s where I need <u><strong>your</strong></u> help. 
</p>
        <p>
I can easily fill three and a half minutes talking about Open Source community collaboration.
But since my presentation is about taking contributions from the community, I decided
to put my money where my mouth is and crowdsource it:
</p>
        <p align="center">
          <font size="4">
            <strong>What is the elevator pitch *you* would make for including community
contributions in Microsoft Open Source products?</strong>
          </font>
        </p>
        <p>
Leave me a comment, send me an email, tweet it, whatever – I’ll be keeping an eye
out for responses. Please remember that I only have three and a half minutes to present,
so keep your ideas short and sweet. 
</p>
        <img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=45a06ea2-5414-452e-9e0b-c18ec6519b60"></img>
      </body><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Devhawk?a=VAg4A2xFAL0:tZrCYoafeu0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=VAg4A2xFAL0:tZrCYoafeu0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=VAg4A2xFAL0:tZrCYoafeu0:XQ266DUsA9M"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=XQ266DUsA9M" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=VAg4A2xFAL0:tZrCYoafeu0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Devhawk?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Devhawk?a=VAg4A2xFAL0:tZrCYoafeu0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Devhawk?i=VAg4A2xFAL0:tZrCYoafeu0:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Devhawk/~4/VAg4A2xFAL0" height="1" width="1"/>]]></content:encoded><description>&lt;p&gt;
&lt;a href="http://devhawk.net/content/binary/WindowsLiveWriter/af4c4ff204c4_C655/clip_image001_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="clip_image001" border="0" alt="clip_image001" align="right" src="http://devhawk.net/content/binary/WindowsLiveWriter/af4c4ff204c4_C655/clip_image001_thumb.jpg" width="240" height="144" /&gt;&lt;/a&gt;In
a couple of weeks, I‘m participating in an internal “Presentation Idol”competition.
It’s a contest of presentation skills against impressive competition (I can’t name
names, but rest assured it’s a strong group) being judged by Microsoft executives
(again, I can’t name names, but this time it’s because I don’t know who’s judging)
in front of what I assume will be a large technical internal Microsoft audience. To
top it off, we each only get three minutes and thirty three seconds each to deliver
our presentations.
&lt;/p&gt;
&lt;p&gt;
So yeah, no pressure.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
The topic we’re all presenting is “What is the one thing we should do to improve Microsoft?”
For those who know me, it should come as little surprise that I picked a variant of
“more open source” for my presentation. More specifically, I’m planning to present
the following:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Any product Microsoft gives away for free should also be Open Source. 
&lt;/li&gt;
&lt;li&gt;
Open Source Microsoft products should accept contributions from the community. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
I realize that many people consider this separation between “source availability”
and “community contributions” completely artificial. Sure, the &lt;a href="http://opensource.org/docs/osd"&gt;accepted
definition of Open Source&lt;/a&gt; only addresses the availability and distribution of
source code, but most Open Source advocates consider the ability to collaborate and
contribute – what Wikipedia calls “&lt;a href="http://en.wikipedia.org/wiki/Commons-based_peer_production"&gt;Commons-based
peer production&lt;/a&gt;” - a critical aspect of Open Source. For example, with respect
to the &lt;a href="http://weblogs.asp.net/scottgu/archive/2009/04/01/asp-net-mvc-1-0.aspx"&gt;announcement&lt;/a&gt; that
ASP.NET MVC would be released under the &lt;a href="http://opensource.org/licenses/ms-pl.html"&gt;Ms-PL&lt;/a&gt;,
Keith Elder &lt;a href="http://twitter.com/keithelder/status/1438253992"&gt;tweeted&lt;/a&gt;: 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“Giving someone your source code is NOT open source. So although Asp.Net MVC's source
code is out there for download, not open source.”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;a title="DevHawk on DFB" href="http://deepfriedbytes.com/podcast/episode-32-being-dynamic-about-ironpython-with-harry-pierson-ndash-part-2/"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://deepfriedbytes.com/files/media/image/WindowsLiveWriter/Media_8AE9/image_thumb_4.png" width="240" height="98" /&gt;&lt;/a&gt;In
what now seems like a huge coincidence, Keith and his co-host &lt;a href="http://twitter.com/cwoodruff"&gt;Chris
“Woody” Woodruff&lt;/a&gt; interviewed me later that day for their podcast &lt;a href="http://deepfriedbytes.com/"&gt;Deep
Fried Bytes&lt;/a&gt;. As you might imagine, while we started with &lt;a href="http://deepfriedbytes.com/podcast/episode-31-being-dynamic-about-ironpython-with-harry-pierson-ndash-part-1/"&gt;talking
about IronPython&lt;/a&gt;, we eventually started discussing &lt;a href="http://deepfriedbytes.com/podcast/episode-32-being-dynamic-about-ironpython-with-harry-pierson-ndash-part-2/"&gt;open
source at Microsoft&lt;/a&gt; more generally. It was a great conversation, and we found
lots of common ground.
&lt;/p&gt;
&lt;p&gt;
Personally, I think Microsoft is making small steps in the right direction when it
comes to Open Source. Not only have some high profile Microsoft projects go Open Source
like ASP.NET MVC and &lt;a href="http://codebetter.com/blogs/glenn.block/archive/2008/10/02/mef-going-ms-pl-the-little-engine-that-could.aspx"&gt;MEF&lt;/a&gt;,
but we’ve even started taking baby steps for including external intellectual property.
Releasing ASP.NET MVC under Ms-PL is a big deal, but I think &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx"&gt;including
jQuery “in the box”&lt;/a&gt; is a much, &lt;em&gt;much&lt;/em&gt; bigger deal. It remains to be seen
if it’s a one-time-only deal or if it’s a new trend inside Microsoft. 
&lt;/p&gt;
&lt;p&gt;
Obviously, I hope it’s a trend. Going from “include jQuery in ASP.NET” to “accept
community contributions in ASP.NET” seems like a relatively achievable goal. 
&lt;/p&gt;
&lt;p&gt;
Now, here’s where I need &lt;u&gt;&lt;strong&gt;your&lt;/strong&gt;&lt;/u&gt; help. 
&lt;/p&gt;
&lt;p&gt;
I can easily fill three and a half minutes talking about Open Source community collaboration.
But since my presentation is about taking contributions from the community, I decided
to put my money where my mouth is and crowdsource it:
&lt;/p&gt;
&lt;p align="center"&gt;
&lt;font size="4"&gt;&lt;strong&gt;What is the elevator pitch *you* would make for including community
contributions in Microsoft Open Source products?&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Leave me a comment, send me an email, tweet it, whatever – I’ll be keeping an eye
out for responses. Please remember that I only have three and a half minutes to present,
so keep your ideas short and sweet. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://devhawk.net/aggbug.ashx?id=45a06ea2-5414-452e-9e0b-c18ec6519b60" /&gt;</description><trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://devhawk.net/Trackback.aspx?guid=45a06ea2-5414-452e-9e0b-c18ec6519b60</trackback:ping><pingback:server xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/pingback.aspx</pingback:server><pingback:target xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/">http://devhawk.net/PermaLink,guid,45a06ea2-5414-452e-9e0b-c18ec6519b60.aspx</pingback:target><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/CommentView,guid,45a06ea2-5414-452e-9e0b-c18ec6519b60.aspx</wfw:comment><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devhawk.net/SyndicationService.asmx/GetEntryCommentsRss?guid=45a06ea2-5414-452e-9e0b-c18ec6519b60</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">6</slash:comments><feedburner:origLink>http://devhawk.net/2009/05/18/Microsoft+And+Open+Source.aspx</feedburner:origLink></item><item><title>Links for 2009-04-21 [del.icio.us]</title><link>http://feedproxy.google.com/~r/Devhawk/~3/a2QZbt9KXCY/harrypierson</link><pubDate>Wed, 22 Apr 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/harrypierson#2009-04-21</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.43folders.com/izero"&gt;43 Folders : Inbox Zero&lt;/a&gt;&lt;br/&gt;
These are posts from a special 43 Folders series looking at the skills, tools, and attitude needed to empty your email inbox — and then keep it that way.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/Devhawk/~4/a2QZbt9KXCY" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/harrypierson#2009-04-21</feedburner:origLink></item><item><title>Links for 2009-04-16 [del.icio.us]</title><link>http://feedproxy.google.com/~r/Devhawk/~3/lIo-x14Cmig/harrypierson</link><pubDate>Fri, 17 Apr 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/harrypierson#2009-04-16</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx"&gt;Code Contracts&lt;/a&gt;&lt;br/&gt;
Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs. The contracts take the form of pre-conditions, post-conditions, and object invariants. Contracts act as checked documentation of your external and internal APIs. The contracts are used to improve testing via runtime checking, enable static contract verification, and documentation generation. Code Contracts bring the advantages of design-by-contract programming to all .NET programming languages.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/Devhawk/~4/lIo-x14Cmig" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/harrypierson#2009-04-16</feedburner:origLink></item><item><title>Links for 2009-04-15 [del.icio.us]</title><link>http://feedproxy.google.com/~r/Devhawk/~3/A2ZPOkNTONg/harrypierson</link><pubDate>Thu, 16 Apr 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/harrypierson#2009-04-15</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/v8/"&gt;V8 JavaScript Engine&lt;/a&gt;&lt;br/&gt;
V8 is Google&amp;#039;s open source JavaScript engine.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/Devhawk/~4/A2ZPOkNTONg" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/harrypierson#2009-04-15</feedburner:origLink></item><item><title>Links for 2009-04-14 [del.icio.us]</title><link>http://feedproxy.google.com/~r/Devhawk/~3/zggxXmR4sus/harrypierson</link><pubDate>Wed, 15 Apr 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/harrypierson#2009-04-14</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://eagle.to/"&gt;The Eagle Project&lt;/a&gt;&lt;br/&gt;
Eagle (Extensible Adaptable Generalized Logic Engine) is an implementation of the Tcl scripting language for the Common Language Runtime (CLR). It is designed to be a universal scripting solution for any CLR based language.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://newspeaklanguage.org/"&gt;Newspeak&lt;/a&gt;&lt;br/&gt;
Newspeak is a new programming language in the tradition of Self and Smalltalk. Newspeak is highly dynamic and reflective  - but designed to support modularity and security. It supports both object-oriented and functional programming.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.sable-language.com/"&gt;SABLE Programming Language&lt;/a&gt;&lt;br/&gt;
SABLE is a general-purpose programming language derived from Smalltalk which runs on Microsoft® .NET and Mono1 (i.e. on the ECMA CLR).

SABLE is the CLR&amp;#039;s athletic body with Smalltalk&amp;#039;s poetic spirit, a powerful combination of the best of both. SABLE brings the many benefits of the Smalltalk language and environments to the native CLR platform, to be a beneficial alternative to those languages based on C and BASIC.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/tycho/"&gt;Tycho&lt;/a&gt;&lt;br/&gt;
Tycho is a new programming language designed for language oriented programming (LOP). Combined with a very dynamic runtime, Tycho programmers can define syntax and semantics that bring the code closer to the problem domain. 

At its heart, it&amp;#039;s a dynamically typed language that runs on the .Net Framework. It&amp;#039;s object oriented but requires no classes. Aspect orientation is achieved with actors (see the example below for a laziness aspect.) Software transactional memory in tycho is, too, an aspect, and makes for a pretty good &amp;quot;free&amp;quot; concurrency. Program consistency is supported with schemas that check validity of objects at runtime, not to mention provide functional programming style pattern matching for just about anything. Macros can be used to augment the language&amp;#039;s syntax, and whole new languages can be created too.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://ioke.org/"&gt;Ioke&lt;/a&gt;&lt;br/&gt;
Ioke is a folding language. It allows you to write highly expressive code that writes code. Ioke allows you to create abstractions at any level, and expressiveness is the ultimate goal of the language.

Ioke is a dynamic language targeted at the Java Virtual Machine. It&amp;#039;s been designed from scratch to be a highly flexible general purpose language. It is a prototype-based programming language that is inspired by Io, Smalltalk, Lisp and Ruby.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://powerboots.codeplex.com/"&gt;PowerShell PowerBoots&lt;/a&gt;&lt;br/&gt;
PowerBoots makes it easier for scripters to create graphical user interfaces in PowerShell, exposing much of the power of WPF to PowerShell in a simple syntax which supports events, threading, and much, much, more.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/Devhawk/~4/zggxXmR4sus" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/harrypierson#2009-04-14</feedburner:origLink></item><item><title>Links for 2009-04-10 [del.icio.us]</title><link>http://feedproxy.google.com/~r/Devhawk/~3/mRtjxJLd_PE/harrypierson</link><pubDate>Sat, 11 Apr 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/harrypierson#2009-04-10</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://ecee.colorado.edu/~siek/gradualtyping.html"&gt;What is Gradual Typing?&lt;/a&gt;&lt;br/&gt;
Gradual typing is a type system Jeremy Siek developed with Walid Taha that allows parts of a program to be dynamically typed and other parts to be statically typed. The programmer controls which parts are which by either leaving out type annotations or by adding them in. This article gives a gentle introduction to gradual typing.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/Devhawk/~4/mRtjxJLd_PE" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/harrypierson#2009-04-10</feedburner:origLink></item><item><title>Links for 2009-03-28 [del.icio.us]</title><link>http://feedproxy.google.com/~r/Devhawk/~3/hRe5NNhx-G0/harrypierson</link><pubDate>Sun, 29 Mar 2009 00:00:00 PDT</pubDate><guid isPermaLink="false">http://del.icio.us/harrypierson#2009-03-28</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;a href="http://pymite.python-hosting.com/"&gt;PyMite&lt;/a&gt;&lt;br/&gt;
PyMite is a flyweight Python interpreter written from scratch to execute on 8-bit and larger microcontrollers with resources as limited as 64 KiB of program memory (flash) and 4 KiB of RAM. PyMite supports a subset of the Python 2.5 syntax and can execute a subset of the Python 2.5 bytecodes.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/playerpiano/"&gt;PlayerPiano&lt;/a&gt;&lt;br/&gt;
PlayerPiano is a fake interactive shell for Python for demoing code in presentations&lt;/li&gt;
&lt;li&gt;&lt;a href="http://pinaxproject.com/"&gt;Pinax&lt;/a&gt;&lt;br/&gt;
Pinax is an open-source collection of integrated, but reusable apps for the Django Web Framework.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/Devhawk/~4/hRe5NNhx-G0" height="1" width="1"/&gt;</description><feedburner:origLink>http://del.icio.us/harrypierson#2009-03-28</feedburner:origLink></item></channel></rss>
