我尝试从http://blogs.msdn.com/b/dsyme/archive/2011/04/01/fsharpchart-wrapping-the-system-windows-forms-datavisualization-charting-charting-types.aspx编译FSharpChart库,得到的编译错误如下
Error 1 The value 'StackedArea100' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible 从…
type FSharpChart =
/// Displays multiple seriesÿof data as stacked areas. The cumulative proportion
/// of each stacked element is always 100% of the Y
/// axis.
static member StackedArea100<'TY when 'TY :> IConvertible>(data: seq<'TY>) =
GenericChart<_>.Create<StackedArea100Chart>(oneY data)
/// Displays multiple seriesÿof data as stacked areas. The cumulative proportion
/// of each stacked element is always 100% of the Y
/// axis.
static member inline StackedArea100<'TX, 'TY when 'TX :> IConvertible and 'TY :> IConvertible>(data:seq<'TX * ('TY)>) =
GenericChart<_>.Create<StackedArea100Chart>(oneXYSeq data)
/// Displays multiple seriesÿof data as stacked areas. The cumulative proportion
/// of each stacked element is always 100% of the Y
/// axis.有人能告诉我这是怎么回事吗?谢谢。
发布于 2011-05-27 03:40:54
没有理由说明为什么StackedArea100 (和其他类似成员)应该是inline。您可以通过仅用static member替换所有出现的static member inline来修复它。如果你可以在F#团队的博客上发表评论,那就太好了(这样他们就可以在下一个版本中纠正这个问题)。
要添加更多详细信息:
F#编译器不喜欢该代码的原因是,实现中使用的oneXYSeq函数应该是internal,因此StackedArea100不能内联(因为它需要访问一个无法访问的助手函数)。它之所以能在F#交互中工作,是因为FSharpChart.fsx文件已加载到当前程序集中,因此internal成员是可见的。
安迪,为什么源代码中有不必要的inline?这是因为我最初尝试使用hat类型,例如^T来编写可以处理任何数字类型的泛型成员(而hat类型需要inline)。然后,我们决定切换到IConvertible,因此不再需要inline注释。
https://stackoverflow.com/questions/6144083
复制相似问题