开发者

lambda expression in boo

开发者 https://www.devze.com 2023-03-27 04:12 出处:网络
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.Nam

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

精彩评论

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

关注公众号