在F#的计算表达式中定义新关键字 [英] Defining new keywords in F#'s computation expression

查看:87
本文介绍了在F#的计算表达式中定义新关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

F#3.0 Beta包含查询{} 具有大量新关键字的计算表达式.

The F# 3.0 beta contains a query {} computation expression with tons of new keywords.

如何在计算生成器中定义自己的关键字?

How can I define my own keywords in a computation builder?

推荐答案

在F#3.0中,可以使用

In F# 3.0, you can use CustomOperationAttribute for this purpose.

新属性的文档记录不充分,我发现的唯一示例是

The new attribute is not very well-documented, the only examples I find are this great answer by @Tomas and this interesting blog post.

这篇关于在F#的计算表达式中定义新关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆