7

在任何控制流语句中使用 af# 计算表达式的自定义操作都会导致类型检查失败

error FS3086: A custom operation may not be used in conjunction with 'use',
'try/with', 'try/finally', 'if/then/else' or 'match' operators within this
computation expression

为什么不允许这样做?不允许重写的自定义操作是什么:

expr {
    if a then
        custom (x)
    else
        return (y)
}

像这样:

expr {
    return! 
        if a then
            expr { custom (x) }
        else
            expr { return (y) }
}
4

0 回答 0