2011-05-26 52 views
1

我试图从http://blogs.msdn.com/b/dsyme/archive/2011/04/01/fsharpchart-wrapping-the-system-windows-forms-datavisualization-charting-charting-types.aspx编译FSharpChart libary,并得到了编译像F#编译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. 

谁能赐教这是怎么回事?谢谢。

回答

3

没有理由为什么StackedArea100(和其他类似的成员)应该是inline。您可以通过将static member inline的所有匹配项替换为static member来修复它。如果您可以向F#团队的博客文章发表评论,那很棒(以便他们可以在下一个版本中更正此问题)。

要添加一些细节:

为什么F#编译器不喜欢的代码是是在实现中使用的oneXYSeq功能应该是internal等等StackedArea100不能被内联(原因因为它需要访问无法访问的帮助函数)。它在F#Interactive中的原因是FSharpChart.fsx文件被加载到当前程序集中,因此internal成员可见。

Andy为什么在源代码中不需要inline?这是因为我最初尝试使用帽子类型,例如^T可以使用任何数字类型编写通用成员(并且帽子类型需要inline)。然后我们决定切换到IConvertible,因此不再需要inline注释。