开发者

lambda expression in boo

dose boo understand Expression tree?

I try to compile this line with sharp develop

exp as System.Linq.Expressions.Expression[of Func[of SomeClass, bool]] = { p as Text | retu开发者_运维百科rn (p.Name == 'tttt') } 

but sharp develop raised this error

Cannot convert 'callable(testlinq.SomeClass) as bool' to 'System.Linq.Expressions.Expression[of System.Func[of testlinq.SomeClass, bool]]'. (BCE0022) 


Boo has had expression trees longer than C#.

http://ayende.com/blog/3065/meta-methods

[Meta]
static def verify(expr as Expression):
    return [|
        unless $expr:
            raise $(expr.ToCodeString())
    |]

IIRC Boo was designed to allow meta-programming macro's (much like Lisp, Nemerle, and many other functional languages) and has as such allowed full access to the AST of any fragment of Boo code.

Now this is all served from long memory, so I advise you to consult the Boo documentation for up-to-date information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜