我试图从http://blogs.msdn.com/b/dsyme/archive/2011/04/01/fsharpchart-wrapping-the-system-windows-forms-datavisualization-charting-charting-types.aspx,并得到类似的编译错误
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.
有人能告诉我发生了什么事吗?谢谢
没有理由将StackedArea100
(和其他类似成员)设为inline
。您可以通过仅用static member
替换所有出现的static member inline
来修复它。如果你能在F#团队的博客上发表评论,那就太好了(这样他们就可以在下一个版本中纠正这一点)。
要添加更多详细信息:
F#编译器不喜欢代码的原因是实现中使用的oneXYSeq
函数应该是internal
,因此StackedArea100
不能内联(因为它需要访问一个不可访问的辅助函数)。它在F#Interactive中工作的原因是FSharpChart.fsx
文件已加载到当前程序集中,因此internal
成员可见。
Andy为什么源代码中有不必要的inline
?这是因为我最初尝试使用帽子类型(例如^T
)来编写适用于任何数字类型的泛型成员(而帽子类型需要inline
)。然后我们决定切换到IConvertible
,因此不再需要inline
注释。