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