views:

63

answers:

1

This code works fine in C#:

Expression.Lambda(LambdaBody);

But none of the methods for building AST seem to visible from IronRuby. I required Microsoft.Scripting.Core and Microsoft.Scripting libraries. Do I need something else? Here is the IronRuby code:

require 'C:\reorganize\software\ironruby-1.0rc3\ironruby\bin\microsoft.scripting.core'
require 'C:\reorganize\software\ironruby-1.0rc3\ironruby\bin\microsoft.dynamic'
require 'C:\reorganize\software\ironruby-1.0rc3\ironruby\bin\microsoft.scripting'
include Microsoft::Scripting::Ast
p Expression.Lambda(lambda_body) #i have already constructed the lambda body

gives:

undefined method `Lambda' for #<TypeGroup: Microsoft::Scripting::Ast::Expression, Microsoft::Scripting::Ast::Expression[TDelegate]> (NoMethodError)
    from -e:1:in `load'
    from -e:1
+1  A: 

It seems there are two Expression classes in the Microsoft.Scripting.Ast namespace: a generic and a non-generic one. Try forcing the non-generic one using .of():

Expression.of().Lambda(lambda_body)
dtb
works..thanks alot!
potlee