People usually want .NET expression trees to support something like LINQ. But 
Ruby has excellent metaprogramming facilities built right into the language; 
doing metaprogramming through some IronRuby-specific extension facility not 
only means that your code is less portable, it's also likely to tie you to a 
specific version of IronRuby.

Having said that, there are certain things for which this ability could be 
interesting -- particularly if there were also a compile hook that let you 
automatically transform any code after it had been compiled. I toyed with the 
idea of creating a facility like this for IronPython after adding profiling 
support because it felt like profiling could have been created entirely through 
such a hook, had one been present.

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

Have a specific cruft is better then have nothing. I thing it will be usefull 
for metaprogramming if we can get or maybe change expression tree use some DLR 
or only IronRuby functionality.
I don't see the problem to use V2 insted V1
2009/8/19 Curt Hagenlocher <cu...@microsoft.com<mailto:cu...@microsoft.com>>

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> 
[mailto: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<mailto: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<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

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

Reply via email to