Basically correct - you'd need to build the expression tree by hand. IronRuby 
does, of course, generate expression trees, but even if there were a convenient 
way to get at them, they'd be full of scopes and closures and other kinds of 
language-specific cruft.

Also, under .NET 3.5, the expression trees built by the compiler are "V1" not 
compatible with the "V2" expression trees used by the DLR.

From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Orion Edwards
Sent: Tuesday, August 18, 2009 4:00 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Can I get method expresion tree by method name?

Based on my (limited) knowledge of expression trees, they are provided by the 
C# or VB.net compiler, at compilation time.

As such you can only get the expression tree by calling a function which takes 
Expression<T> from some C# code. The C# compiler will notice that you are doing 
this, and will build the expression tree as part of it's other compilation.

This means that
a) you can't get expression trees for things at runtime, =>
b) dynamic languages can't get expression trees, =>
c) IronRuby can't get expression trees =>
d) No, you can't get a method expression tree by it's name

If I'm wrong on this, I'd be overjoyed, because getting an expression tree in a 
DLR language would be awesome :-)

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to