English 中文(简体)
F#编译FSharpChart:内联错误
原标题:F# compile FSharpChart: inline error

我试图从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。您可以通过将内联中所有出现的静态成员替换为的静态成员来修复它。如果你能在F#团队的博客上发表评论,那就太好了(这样他们就可以在下一个版本中纠正这一点)。

要添加更多详细信息,请执行以下操作:

F#编译器不喜欢该代码的原因是,实现中使用的oneXYSeq函数应该是内部,因此StackedArea100不能内联(因为它需要访问一个不可访问的辅助函数)。它在F#Interactive中工作的原因是FSharpChart.fsx文件已加载到当前程序集中,因此内部成员可见。

Andy为什么源代码中有不必要的<code>内联^T来编写适用于任何数字类型的泛型成员(而帽子类型需要inline)。然后,我们决定切换到IConvertible,因此不再需要inline注释。

问题回答

暂无回答




相关问题
F#: Storing and mapping a list of functions

I have a number of events that happen in a game. I want to control the time and order at which these events occur. For example: Event 1: Show some text on screen for N frames & play a sound ...

Creating Silverlight 3 applications with F#

Is there an easy way to create Silverlight 3 applications with F# (October CTP)? I have seen the F# for Silverlight, but that only works with the May CTP. I am using Visual Studio Integrated Shell ...

How To Change List of Chars To String?

In F# I want to transform a list of chars into a string. Consider the following code: let lChars = [ a ; b ; c ] If I simply do lChars.ToString, I get "[ a ; b ; c ]". I m trying to get "abc". I ...

Unzipping ZLIB compressed portions of a binary file

I m reading a file(a flash swf) from .Net 3.5 that has a header which states whether the body of the file/Stream is compressed or not. However, I m having problems-after I rewrap the basic File ...

Pretty print a tree

Let s say I have a binary tree data structure defined as follows type a tree = | Node of a tree * a * a tree | Nil I have an instance of a tree as follows: let x = Node (Node (...

F# String Pattern-Matching with Wildcards

As part of a project I have assigned myself as a way of improving my knowledge of F# and functional programming in general, I am attempting to write a string pattern-matching algorithm from scratch ...

热门标签