<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Jb in a nutshell</title>
    <link>http://evain.net/blog/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description />
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/jbevain" type="application/rss+xml" /><item>
      <title>The Thing About ExpressionVisitor</title>
      <description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/3068345308/" title="Brouillard by Jb Evain, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3034/3068345308_aa2e001dd4.jpg" width="500" height="333" alt="Brouillard" style="border: 2px solid black" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;There was &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2008/12/04/i-love-ayende-and-oss.aspx"&gt;a discussion&lt;/a&gt; recently about why the class &lt;a href="http://msdn.microsoft.com/en-us/library/bb882521.aspx"&gt;ExpressionVisitor&lt;/a&gt;, which every programmer that developed a &lt;span class="caps"&gt;LINQ&lt;/span&gt; provider or code manipulating .net 3.5 expression trees knows about.&lt;/p&gt;


	&lt;p&gt;I certainly agree that this class could have been made public, as basically everyone ends up embedding it. Even if it could use a little refactoring to visit lists.&lt;/p&gt;


	&lt;p&gt;Thing is that I have a naming issue with this class ever since I saw it on &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/07/31/linq-building-an-iqueryable-provider-part-ii.aspx"&gt;Matt&amp;#8217;s blog&lt;/a&gt;. To me it does more than just visiting an expression tree. It allows you to transform it. And when I&amp;#8217;m facing an expression tree, I often like to sometimes visit it, and at some other times, transform it.&lt;/p&gt;


	&lt;p&gt;That&amp;#8217;s basically the reason why I have both a:&lt;/p&gt;


&lt;pre&gt;
class ExpressionVisitor {

    public void Visit (Expression expression)
    {
        // ..
    }

    // ...
}
&lt;/pre&gt;

	&lt;p&gt;And a:&lt;/p&gt;


&lt;pre&gt;
class ExpressionTransformer {

    public Expression Visit (Expression expression)
    {
        // ..
    }

    // ...
}
&lt;/pre&gt;

	&lt;p&gt;Simply because I write a lot of code that would look like:&lt;/p&gt;


&lt;pre&gt;
SomethingExpression VisitSomethingExpression (SomethingExpression expression)
{
    if (Foo (expression))
        return expression;

    if (Bar (expression))
        return expression;

    Baz (expression);
    return expression;
}

&lt;/pre&gt;

	&lt;p&gt;And it looks a lot better (and is also a tiny bit faster) this way:&lt;/p&gt;


&lt;pre&gt;

void VisitSomethingExpression (SomethingExpression expression)
{
    if (Foo (expression))
        return;

    if (Bar (expression))
        return;

    Baz (expression);
}
&lt;/pre&gt;

	&lt;p&gt;So if they make the current ExpressionVisitor public, having a real non transforming ExpressionVisitor will introduce an interesting naming issue.&lt;/p&gt;


	&lt;p&gt;I submitted a &lt;a href="http://www.codeplex.com/dlr/WorkItem/View.aspx?WorkItemId=1101"&gt;bug to the &lt;span class="caps"&gt;DLR&lt;/span&gt; CodePlex&lt;/a&gt;, as the namespace System.Linq.Expressions will come from the &lt;span class="caps"&gt;DLR&lt;/span&gt; in .net 4. What about voting for it?&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/486605584" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 16 Dec 2008 14:25:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:a77de277-55ea-4ffb-b680-bf536821a9a1</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/486605584/the-thing-about-expressionvisitor</link>
      <category>Mono</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/525</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/12/16/the-thing-about-expressionvisitor</feedburner:origLink></item>
    <item>
      <title>Decompiler CodeCamp</title>
      <description>&lt;p&gt;As I was writing in my &lt;a href="http://evain.net/blog/articles/2008/12/15/cecil-decompiler"&gt;last entry&lt;/a&gt;, announcing the most awesome Cecil.Decompiler library, I took my last week off to host a CodeCamp event at my parents place in the quiet place of Ardèche, France.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/3113068990/" title="CodeCamp by Jb Evain, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3027/3113068990_f350ce9b61.jpg" width="500" height="333" alt="CodeCamp" style="border: 2px solid black" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;I had the pleasure to host, by order of arrival,&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href="http://codingly.com/"&gt;Romain Verdier&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://patricelamarche.net/"&gt;Patrice Lamarche&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://evilznet.com/"&gt;Vincent Bourdon&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://strangelights.com/blog/"&gt;Robert Pickering&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://batswirl.com/"&gt;Mathieu Szablowski&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://sebastien.lebreton.free.fr/blog/"&gt;Sébastien Lebreton&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

	&lt;p&gt;While I was working on the core of the decompiler, I paired with Romain to work on improving our pattern matching story, to refine a basic &lt;span class="caps"&gt;AST&lt;/span&gt; to something more evolved. We still clearly need to do some work here, as we&amp;#8217;re not completely satisfied with what we came with. Robert with his experience of F# and pattern matching then helped Romain.&lt;/p&gt;


	&lt;p&gt;Patrice worked on a NUnit addin which allow us to write tests that are executed for both optimized and non optimized code. He then joined Vincent to work on the Visual Basic language support. Vincent also wrote a ColoredConsoleFormatter, which adds some color to my tests in the console routines.&lt;/p&gt;


	&lt;p&gt;Robert started a Windows.Forms front tend in F# a while ago, but we decided to switch to C#, to lower the entry barrier for contributions. The inimitable Sébastien took the responsibility to write the front-end for the next millennium. I&amp;#8217;ll force him to blog on it &lt;span class="caps"&gt;ASAP&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;Mathieu took the pictures. He sadly was busy working on a presentation he had to do for a client next week.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/3112250797/" title="CodeCamp by Jb Evain, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3056/3112250797_29c238426a.jpg" width="500" height="333" alt="CodeCamp" style="border: 2px solid black" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;On the next monday, Vincent told me something like: wow it&amp;#8217;s quite depressing, I barely had a single laugh today, while we were laughing every five minutes during the last few days.&lt;/p&gt;


	&lt;p&gt;So we maybe weren&amp;#8217;t the most productive crowd of week-end hackers, but at least we had tons of fun.&lt;/p&gt;


	&lt;p&gt;I guess that if I had a lesson to take from the event, it would have been to prepare it a little bit more, and have more fine grained tasks, but I also loved the organic way it evolved.&lt;/p&gt;


	&lt;p&gt;Thanks guys for the week-end, hopefully we&amp;#8217;ll manage to organize more of those CodeCamp.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/486463366" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 16 Dec 2008 10:55:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:c4ed1203-32c7-4413-b71e-b1a6849a47d0</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/486463366/decompiler-codecamp</link>
      <category>Cecil</category>
      <category>Mono</category>
      <category>Personal</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/523</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/12/16/decompiler-codecamp</feedburner:origLink></item>
    <item>
      <title>Cecil.Decompiler</title>
      <description>&lt;p&gt;I know I&amp;#8217;m quite late to present what I&amp;#8217;ve been working on during the last &lt;a href="http://idea.opensuse.org/content/"&gt;Hack-Week&lt;/a&gt; we had at &lt;a href="http://www.novell.com"&gt;Novell&lt;/a&gt;, but better late than never, right?&lt;/p&gt;


	&lt;p&gt;Cecil.Decompiler is a library which relies on &lt;a href="http://mono-project.com/Cecil"&gt;Cecil&lt;/a&gt;, takes one of its method, and give you back an object graph representing the decompiled body of the method, an &lt;a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree"&gt;&lt;span class="caps"&gt;AST&lt;/span&gt;&lt;/a&gt;, depending on the language you target. It also provides you ways to pretty print this &lt;span class="caps"&gt;AST&lt;/span&gt; at your convenience.&lt;/p&gt;


	&lt;p&gt;It takes its roots in Cecil and is actually a refactoring of the Cecil.FlowAnalysis library that folks at &lt;a href="http://developer.db4o.com/"&gt;db4o&lt;/a&gt; contributed to the &lt;a href="http://www.mono-project.com/"&gt;Mono project&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;During the last Hack-Week, I started refactoring Cecil.FlowAnalysis, and since then, I&amp;#8217;ve been working pretty seldom on it. It was last month that I decided to give it a kick, and even took a week of vacations to organize a CodeCamp with friends to give it a boost and have fun altogether.&lt;/p&gt;


	&lt;p&gt;The next blog post will be the occasion to describe the last week, and to thank my friends for their help.&lt;/p&gt;


	&lt;p&gt;Let me first warn you. It&amp;#8217;s still very young, and doesn&amp;#8217;t support a lot of constructions. On the other hand, it can already do pretty neat stuff, and its architecture makes it easy to use and improve, or add new languages.&lt;/p&gt;


	&lt;p&gt;The mandatory picture of a little program using the decompiler to decompile itself:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://evain.net/public/decompilo_full.png"&gt;&lt;img src="http://evain.net/public/decompilo.png" style="border: 1px solid black" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Don&amp;#8217;t pay attention to the code as it&amp;#8217;s full of debug code. Basically only the last two lines are interesting.&lt;/p&gt;


	&lt;p&gt;The code can be pulled from &lt;span class="caps"&gt;SVN&lt;/span&gt;:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://anonsvn.mono-project.com/source/trunk/cecil/decompiler"&gt;http://anonsvn.mono-project.com/source/trunk/cecil/decompiler&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;I guess this will trigger a few interesting questions, so I cooked a little list of questions I already had, and answers I provided.&lt;/p&gt;


&lt;blockquote&gt;Q: What it is usable for?&lt;/blockquote&gt;

	&lt;p&gt;A: It can be very useful for tools that perform static analysis on the assembly. For instance, &lt;a href="http://mono-project.com/Gendarme"&gt;Gendarme&lt;/a&gt; could use it to detect more complex patterns in your code.&lt;/p&gt;


&lt;blockquote&gt;Q: Why would you work on such a project while there&amp;#8217;s obviously a better known tool that seems to do the same (and which have been working for a long time)?&lt;/blockquote&gt;

	&lt;p&gt;A: Cecil.Decompiler is Open Source, and licensed under the very liberal &lt;span class="caps"&gt;MIT&lt;/span&gt;/X11. Also it&amp;#8217;s a library, which makes it easy to use from your own &lt;span class="caps"&gt;IDE&lt;/span&gt;, tool, or whatever project you can think of.&lt;/p&gt;


&lt;blockquote&gt;Q: But then what&amp;#8217;s a good library without a good &lt;span class="caps"&gt;GUI&lt;/span&gt;?&lt;/blockquote&gt;

	&lt;p&gt;A: I&amp;#8217;ll write more on that later, but my good friend Sébastien, author of the fantastic Reflexil project, started a Windows Forms &lt;span class="caps"&gt;GUI&lt;/span&gt; on top of it. And from what I understand, he plans to write the core of his tool using in platform agnostic fashion, so that plugins for his &lt;span class="caps"&gt;GUI&lt;/span&gt; could be re-used by a Gtk# &lt;span class="caps"&gt;GUI&lt;/span&gt; for instance.&lt;/p&gt;


&lt;blockquote&gt;Q: Why don&amp;#8217;t you push a binary distribution for now?&lt;/blockquote&gt;

	&lt;p&gt;A: The project is still very new, and we&amp;#8217;re changing it a lot. So if someone is interested in having a look at it, he should rather directly pull the sources from &lt;span class="caps"&gt;SVN&lt;/span&gt; regularly.&lt;/p&gt;


&lt;blockquote&gt;Q: Should I start filing bugs ?&lt;/blockquote&gt;

	&lt;p&gt;A: It&amp;#8217;s not worth it from now, we&amp;#8217;re pretty much aware of what&amp;#8217;s missing and failing.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/485997053" height="1" width="1"/&gt;</description>
      <pubDate>Mon, 15 Dec 2008 23:40:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:3aa81331-8e2c-4c37-b6f9-030a869bd791</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/485997053/cecil-decompiler</link>
      <category>Cecil</category>
      <category>Mono</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/520</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/12/15/cecil-decompiler</feedburner:origLink></item>
    <item>
      <title>Twitter</title>
      <description>&lt;p&gt;Alright, &lt;a href="http://twitter.com/jbevain"&gt;I surrender&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/450769894" height="1" width="1"/&gt;</description>
      <pubDate>Wed, 12 Nov 2008 15:59:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:a2a06fc9-5058-476a-8681-e4e0b38bb190</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/450769894/twitter</link>
      <category>Personal</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/519</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/11/12/twitter</feedburner:origLink></item>
    <item>
      <title>Mono 2.0</title>
      <description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/2917328657/" title="Mono 2.0 by Jb Evain, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3023/2917328657_37428d5034.jpg" width="500" height="333" style="border: 2px solid black" alt="Mono 2.0" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.mono-project.com/news/archive/2008/Oct-06.html"&gt;&lt;i&gt;Mono&amp;#8217;s 2.0 grand release has finally arrived.&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/448285139" height="1" width="1"/&gt;</description>
      <pubDate>Mon, 06 Oct 2008 09:00:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:8486a781-2b20-496c-a90b-e315b81442bf</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/448285139/mono-2-0</link>
      <category>Mono</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/516</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/10/06/mono-2-0</feedburner:origLink></item>
    <item>
      <title>LINQ Expression Trees on the Compact Framework</title>
      <description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/224749567/" title="Red Church, Blue Sky by Jb Evain, on Flickr"&gt;&lt;img src="http://farm1.static.flickr.com/90/224749567_0e49c30cd5.jpg" width="500" height="333" alt="Red Church, Blue Sky" style="border: 2px solid black" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;A week ago, I was &lt;a href="http://evain.net/blog/articles/2008/09/14/c-3-and-linq-on-net-2"&gt;writing&lt;/a&gt; about the ability to use &lt;a href="http://www.mono-project.com"&gt;Mono&lt;/a&gt;&amp;#8217;s System.Core to run C# 3 and &lt;span class="caps"&gt;LINQ&lt;/span&gt; applications on .net 2.&lt;/p&gt;


	&lt;p&gt;A few months ago, I was &lt;a href="http://evain.net/blog/articles/2008/02/06/an-elegant-linq-to-db4o-provider-and-a-few-linq-tricks"&gt;writing&lt;/a&gt; about the new &lt;span class="caps"&gt;LINQ&lt;/span&gt; provider that friends at &lt;a href="http://developer.db4o.com"&gt;db4o&lt;/a&gt; released. This &lt;span class="caps"&gt;LINQ&lt;/span&gt; provider uses &lt;span class="caps"&gt;LINQ&lt;/span&gt; expression trees to optimize &lt;span class="caps"&gt;LINQ&lt;/span&gt; queries, turning them into db4o&amp;#8217;s native query language.&lt;/p&gt;


	&lt;p&gt;Today I&amp;#8217;m going to write about a cute new hack from our friends at db4o.&lt;/p&gt;


	&lt;p&gt;If the 3.5 version of the Compact Framework comes with a System.Core, and a &lt;span class="caps"&gt;LINQ&lt;/span&gt; to objects implementation, it doesn&amp;#8217;t contain the namespace System.Linq.Expressions, which is used by all optimized &lt;span class="caps"&gt;LINQ&lt;/span&gt; providers. What those fine folks did, was simply to take Mono&amp;#8217;s implementation of this namespace. There was one issue with that approach. Expression Trees can be compiled at runtime, and that uses System.Reflection.Emit, that the Compact Framework doesn&amp;#8217;t have.&lt;/p&gt;


	&lt;p&gt;A nice thing is that folks at &lt;a href="http://www.mainsoft.com"&gt;Mainsoft&lt;/a&gt; contributed to Mono&amp;#8217;s System.Core an expression interpreter, which allows you to use the full &lt;span class="caps"&gt;LINQ&lt;/span&gt; expression trees without using System.Reflection.Emit. They sent me the patches they have for the expression interpreter to make it pass the full test suite we have, so I&amp;#8217;ll integrate it shortly.&lt;/p&gt;


	&lt;p&gt;And voilà, just by using Mono&amp;#8217;s implementation of System.Core, and by hacking a little in it, to make it compile on the Compact Framework, they&amp;#8217;ve been able to produce a new assembly, System.Linq.Expressions.dll. You just have to reference it in your Compact Framework project, and it will let you use &lt;span class="caps"&gt;LINQ&lt;/span&gt; expression trees, which allows you to write optimized &lt;span class="caps"&gt;LINQ&lt;/span&gt; providers for the Compact Framework.&lt;/p&gt;


	&lt;p&gt;Of course, this is completely open-source and licensed under the &lt;span class="caps"&gt;MIT&lt;/span&gt;/X11. For now, you can find the code in &lt;a href="https://source.db4o.com/db4o/trunk/db4o.net/Libs/compact-3.5/System.Linq.Expressions/"&gt;db4o&amp;#8217;s repository&lt;/a&gt;, but I&amp;#8217;ll backport the changes they did to the &lt;span class="caps"&gt;LINQ&lt;/span&gt; expression interpreter, so that people that want to use it can use our code base directly.&lt;/p&gt;


	&lt;p&gt;Congrats to you guys for making the finest choice in the third party code you ship!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/448285140" height="1" width="1"/&gt;</description>
      <pubDate>Mon, 22 Sep 2008 19:59:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:e19d5d22-0fc9-46fa-bab3-dbf39cc1ec50</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/448285140/linq-expression-trees-on-the-compact-framework</link>
      <category>Mono</category>
      <category>db4o</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/515</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/09/22/linq-expression-trees-on-the-compact-framework</feedburner:origLink></item>
    <item>
      <title>C# 3 and LINQ on .net 2</title>
      <description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/429558558/" title="Macro test by Jb Evain, on Flickr"&gt;&lt;img src="http://farm1.static.flickr.com/167/429558558_58ec2bf043.jpg" width="500" height="333" alt="Macro test" style="border: 2px solid black" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;My friend &lt;a href="http://codebetter.com/blogs/patricksmacchia/"&gt;Patrick&lt;/a&gt; is &lt;a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/09/14/targeting-the-net-runtime-version-2-0-matters.aspx"&gt;wondering&lt;/a&gt; what&amp;#8217;s the best way to use the type &lt;a href="http://msdn.microsoft.com/en-us/library/bb359438.aspx"&gt;System.Collections.Generic.HashSet&lt;/a&gt;, in &lt;a href="http://www.ndepend.com"&gt;NDepend&lt;/a&gt;, that he wants to deploy on computers with only .net 2 installed.&lt;/p&gt;


	&lt;p&gt;Well it&amp;#8217;s pretty simple, the best way to get it, is to get it from &lt;a href="http://www.mono-project.com"&gt;Mono&lt;/a&gt;. The code is licensed under the &lt;span class="caps"&gt;MIT&lt;/span&gt;/X11 license, allowing multiple usages.&lt;/p&gt;


	&lt;p&gt;And that&amp;#8217;s not all. If you&amp;#8217;re dying to use C#3 or &lt;span class="caps"&gt;LINQ&lt;/span&gt; to objects in your application, but that you want to be able to release on .net 2 only, you can simply compile and ship Mono&amp;#8217;s implementation of System.Core. Microsoft&amp;#8217;s C# compiler, csc 3.5, won&amp;#8217;t have any issue using it, et voilà, you&amp;#8217;ll get an application using &lt;span class="caps"&gt;LINQ&lt;/span&gt; or C#3, and deployable on .net 2.&lt;/p&gt;


	&lt;p&gt;Mono&amp;#8217;s implementation of System.Core is available in &lt;span class="caps"&gt;SVN&lt;/span&gt; &lt;a href="http://anonsvn.mono-project.com/source/trunk/mcs/class/System.Core/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/448285141" height="1" width="1"/&gt;</description>
      <pubDate>Sun, 14 Sep 2008 19:08:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:a731ce73-b01c-40a6-9b8e-2e9c5cb03984</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/448285141/c-3-and-linq-on-net-2</link>
      <category>Mono</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/508</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/09/14/c-3-and-linq-on-net-2</feedburner:origLink></item>
    <item>
      <title>Cecil performance issues</title>
      <description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/2496833680/" title="Then it showed up by Jb Evain, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2032/2496833680_7d3b8086f5.jpg" width="500" height="333" alt="Then it showed up" style="border: 2px solid black" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;At the beginning, &lt;a href="http://mono-project.com/Cecil"&gt;Cecil&lt;/a&gt; was written to be an assembly manipulation library. The initial goal was to be able to read assemblies without loading them in an AppDomain, and also, to expose more that what .net 1.1 provided.&lt;/p&gt;


	&lt;p&gt;I implemented the writing parts of Cecil during my first Summer of Code, and barely touched it after, at it turns out it was working.&lt;/p&gt;


	&lt;p&gt;But this summer, two great hackers, &lt;a href="http://weblog.ikvm.net/"&gt;Jeroen, author or &lt;span class="caps"&gt;IKVM&lt;/span&gt;&lt;/a&gt;, and &lt;a href="http://rolfkvinge.blogspot.com"&gt;Rolf&lt;/a&gt;, our &lt;a href="http://www.mono-project.com/Language_BASIC"&gt;&lt;span class="caps"&gt;VB 8&lt;/span&gt; compiler&lt;/a&gt; author, decided that they gave enough blood and sweat to work around System.Reflection.Emit issues, and prototyped a version of their project based on Cecil instead.&lt;/p&gt;


	&lt;p&gt;If Rolf decided to go the full Cecil way, and replaced the usage of System.Reflection and System.Reflection.Emit (his &lt;a href="http://anonsvn.mono-project.com/source/branches/rolf/cecil-vbnc/"&gt;branch is available&lt;/a&gt;), Jeroen decided to write a layer on top of Cecil that mimics the System.Reflection.Emit &lt;span class="caps"&gt;API&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;Both wrote a sum-up about their findings, &lt;a href="http://weblog.ikvm.net/CommentView.aspx?guid=afda88af-e2cf-47d6-917b-5f3134b681c1"&gt;here for Jeroen&lt;/a&gt;, and &lt;a href="http://rolfkvinge.blogspot.com/2008/08/cecil-reloaded.html"&gt;there for Rolf&lt;/a&gt;. And both came to the conclusion that Cecil performs a lot less well that System.Reflection.Emit, both in terms of speed and memory consumption.&lt;/p&gt;


	&lt;p&gt;Rolf also uses the &lt;a href="http://anonsvn.mono-project.com/source/branches/cecil-delayed-loading/"&gt;delay loading branch&lt;/a&gt; of Cecil, created by &lt;a href="http://dev.mainsoft.com/"&gt;Mainsoft&lt;/a&gt; for their &lt;span class="caps"&gt;CIL&lt;/span&gt; to Java bytecode translator.&lt;/p&gt;


	&lt;p&gt;So the point is that Cecil uses too much memory, and is not fast enough in those scenarios, while it performs better in the reading only or reading + manipulating.&lt;/p&gt;


	&lt;p&gt;The good news is that, thanks to those hackers, we have now two amazing test cases to work on and to optimize. I&amp;#8217;ve also started a few weeks ago, as a night hack, a refactoring of Cecil, that removes the intermediate structures that the current version of Cecil uses to read and write assemblies. If that makes reading and writing a little bit more complicated, it should also save a lot of memory.&lt;/p&gt;


	&lt;p&gt;And who knows, maybe one day, when Cecil will be optimized properly, and that the &lt;span class="caps"&gt;SRE&lt;/span&gt; on top of Cecil layer will be sufficient, it will require only a couple of changes to base mcs on Cecil.&lt;/p&gt;


	&lt;p&gt;Anyway, kudos to those hackers, let see what I can do to catch up.&lt;/p&gt;


	&lt;p&gt;&lt;i&gt;We&amp;#8217;ll let you know!&lt;/i&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/448285142" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 02 Sep 2008 08:45:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:c0f4d289-1f2a-4182-a73a-cb4de4989768</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/448285142/cecil-performance-issues</link>
      <category>Cecil</category>
      <category>Mono</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/504</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/09/02/cecil-performance-issues</feedburner:origLink></item>
    <item>
      <title>System.Scripting</title>
      <description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/271257238/" title="Plume by Jb Evain, on Flickr"&gt;&lt;img src="http://farm1.static.flickr.com/117/271257238_e544c3fe8e.jpg" width="500" height="333" alt="Plume" style="border: 2px solid black" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Two days ago, I was sharing what I was foreseeing for &lt;a href="http://evain.net/blog/articles/2008/07/29/net-4-c-4-and-the-dlr"&gt;C# 4 and .net 4&lt;/a&gt;, and the integration with the &lt;span class="caps"&gt;DLR&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;Turns out that today, by reading &lt;a href="http://blogs.msdn.com/shrib/archive/2008/07/30/idispatch-support-on-in-ironpython-beta-4.aspx"&gt;this post&lt;/a&gt;, my eye was caught by the namespace I was thinking about: System.Scripting.&lt;/p&gt;


	&lt;p&gt;But this post is about the beta 4 of &lt;a href="http://www.codeplex.com/IronPython/"&gt;IronPython&lt;/a&gt; 2, that hasn&amp;#8217;t been released yet. But heh, it&amp;#8217;s easy to forget that latest IronPython code can be &lt;a href="http://www.codeplex.com/IronPython/SourceControl/ListDownloadableCommits.aspx"&gt;downloaded from CodePlex&amp;#8217;s &lt;span class="caps"&gt;TFS&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;And it indeed turns out, that in the latest revision, Microsoft.Scripting.Core namespace has been renamed to System.Scripting, and that the &lt;span class="caps"&gt;DLR AST&lt;/span&gt; has been merged into System.Linq.Expressions.&lt;/p&gt;


	&lt;p&gt;So yeah, I guess we can safely admit that C# 4 will have statements support inside expression trees.&lt;/p&gt;


	&lt;p&gt;And that .net 4 will contain very cute features for dynamically generating programs, without resorting to emitting plain IL, simply using the &lt;span class="caps"&gt;DLR&lt;/span&gt;, contained in a new assembly (or namespace, if they move some to parts to System.Core), System.Scripting.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/448285143" height="1" width="1"/&gt;</description>
      <pubDate>Thu, 31 Jul 2008 10:36:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:a23e7961-baa9-408a-85dd-0a32a8d44cf9</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/448285143/system-scripting</link>
      <category>Mono</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/493</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/07/31/system-scripting</feedburner:origLink></item>
    <item>
      <title>.net 4, C# 4, and the DLR</title>
      <description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/jbevain/453037066/" title="On the road again by Jb Evain, on Flickr"&gt;&lt;img src="http://farm1.static.flickr.com/170/453037066_16cc80df54.jpg" width="500" height="333" style="border: 2px solid black" alt="On the road again" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;b&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;&lt;/b&gt;: turns out that there&amp;#8217;s some true in those previsions, a small &lt;a href="http://evain.net/blog/articles/2008/07/31/system-scripting"&gt;follow up&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve been thinking a bit about the discussion in &lt;a href="http://channel9.msdn.com/posts/Charles/C-40-Meet-the-Design-Team/"&gt;this video&lt;/a&gt;, about the future of C#, and specifically about its next version. If nothing is said clearly and loudly, as they&amp;#8217;re most probably waiting for the &lt;span class="caps"&gt;PDC&lt;/span&gt;, you can still get a glimpse of what C# 4 and .net 4 will get as new features.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m mostly interested in one aspect of those new features. It&amp;#8217;s the possible integration of the &lt;a href="http://en.wikipedia.org/wiki/Dynamic_Language_Runtime"&gt;&lt;span class="caps"&gt;DLR&lt;/span&gt;&lt;/a&gt; inside the framework, and in the C# language.&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;DLR&lt;/span&gt;, as we used to have it in &lt;a href="http://www.codeplex.com/IronPython"&gt;IronPython&lt;/a&gt;, has been split into two separate assemblies, Microsoft.Scripting, and Microsoft.Scripting.Core a few months ago.&lt;/p&gt;


	&lt;p&gt;Microsoft.Scripting.Core is probably the part that will make it into the framework. It&amp;#8217;s the part that contains a generalist &lt;a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree"&gt;&lt;span class="caps"&gt;AST&lt;/span&gt;&lt;/a&gt;, a compiler for this &lt;span class="caps"&gt;AST&lt;/span&gt;, using both &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx"&gt;&lt;span class="caps"&gt;LCG&lt;/span&gt;&lt;/a&gt; and traditional &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.aspx"&gt;&lt;span class="caps"&gt;SRE&lt;/span&gt;&lt;/a&gt; for the debug scenarios. It also comes with a fast dynamic call site implementation, and an hosting &lt;span class="caps"&gt;API&lt;/span&gt;. So are we going to have a new System.Scripting assembly?&lt;/p&gt;


	&lt;p&gt;An interesting change in the &lt;span class="caps"&gt;DLR&lt;/span&gt;, is the naming of the &lt;span class="caps"&gt;AST&lt;/span&gt; factory and nodes. I&amp;#8217;ve spent the last months working on &lt;a href="http://msdn.microsoft.com/en-us/vbasic/aa904594.aspx"&gt;&lt;span class="caps"&gt;LINQ&lt;/span&gt;&lt;/a&gt; and the &lt;a href="http://msdn.microsoft.com/en-us/library/bb345362.aspx"&gt;&lt;span class="caps"&gt;LINQ&lt;/span&gt; compiler&lt;/a&gt; in &lt;a href="http://mono-project.com"&gt;Mono&lt;/a&gt;, and comparing the &lt;span class="caps"&gt;LINQ&lt;/span&gt; expression &lt;span class="caps"&gt;AST&lt;/span&gt; with the &lt;span class="caps"&gt;DLR AST&lt;/span&gt; is an interesting thing to do.&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;DLR AST&lt;/span&gt; is now basically the &lt;span class="caps"&gt;LINQ&lt;/span&gt; expression &lt;span class="caps"&gt;AST&lt;/span&gt;, with statements added. And it looks like the current &lt;span class="caps"&gt;DLR AST&lt;/span&gt; has been tinkered around what has been already shipped inside .net 3.5 in the namespace System.Linq.Expressions.&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s a small example. In System.Linq.Expressions, pretty much all node from the &lt;span class="caps"&gt;AST&lt;/span&gt; extends the type Expression. Each Expression has a NodeType property, of type ExpressionType.&lt;/p&gt;


	&lt;p&gt;And you can find the same thing now in the &lt;span class="caps"&gt;DLR&lt;/span&gt;, but with some stuff added.&lt;/p&gt;


&lt;pre&gt;
public enum ExpressionType {
    // some traditional expressions

    Add,
    AddChecked,

    // ...
    Call,

    // ...

    IfStatement,
    SwitchStatement,   

    // ...
}
&lt;/pre&gt;

	&lt;p&gt;So for the &lt;span class="caps"&gt;DLR&lt;/span&gt;, a statement is an expression. It makes kind of sense for a dynamic language you&amp;#8217;ll tell me, but it looks a bit weird to be implemented this way.&lt;/p&gt;


	&lt;p&gt;Anyway, C# 3 already has a way to create expression trees to support some basic meta programming features, I guess we can only wonder if C# 4 will extend the meta programming features to support not only expressions but also statements, using the &lt;span class="caps"&gt;DLR&lt;/span&gt; tree.&lt;/p&gt;


	&lt;p&gt;I have no idea how they&amp;#8217;ll deal with the fact that the existing stuff is in System.Linq.Expressions. Are they going to obsolete the whole namespace, and redirect everything to a possible System.Scripting.Ast (sounds less likely)? Are they moving the &lt;span class="caps"&gt;DLR AST&lt;/span&gt; to System.Linq.Expressions (sounds more likely)? Who knows? Not me (I&amp;#8217;ve never lost control).&lt;/p&gt;


	&lt;p&gt;Interesting speculations anyway :)&lt;/p&gt;


	&lt;p&gt;So for now, the only change I can foresee for C# 4, is that you&amp;#8217;ll be able to get full code blocks instead of only expressions when asking for an Expression of T.&lt;/p&gt;


	&lt;p&gt;But here&amp;#8217;s another interesting one we can have a &lt;a href="http://blogs.msdn.com/charlie/archive/2008/01/25/future-focus.aspx"&gt;glimpse here&lt;/a&gt;, is duck typing support based the &lt;span class="caps"&gt;DLR&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;At the language level, it&amp;#8217;s difficult to say if they&amp;#8217;re going to rely&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;on a dynamic code block, like the example shows in this blog entry,&lt;/li&gt;
		&lt;li&gt;on a custom marker type,&lt;/li&gt;
		&lt;li&gt;on another syntax for message passing to dynamic objects,&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;All in all, it looks like C# 4 will have some nifty stuff, let&amp;#8217;s wait for the &lt;span class="caps"&gt;PDC&lt;/span&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/jbevain/~4/448285144" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 29 Jul 2008 17:07:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:95b74d8a-e628-404f-ba90-c2512a942b62</guid>
      <author>Jb Evain</author>
      <link>http://feeds.feedburner.com/~r/jbevain/~3/448285144/net-4-c-4-and-the-dlr</link>
      <category>Mono</category>
      <trackback:ping>http://evain.net/blog/articles/trackback/492</trackback:ping>
    <feedburner:origLink>http://evain.net/blog/articles/2008/07/29/net-4-c-4-and-the-dlr</feedburner:origLink></item>
  </channel>
</rss>
