I tried to compile FSharpChart libary from http://blogs.msdn.com/b/dsyme/archive/2011/04/01/fsharpchart-wrapping-the-system-windows-forms-datavisualization-charting-charting-types.aspx, and got compile error like
Error 1 The value 'StackedArea100' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible
from
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.
Can anyone enlighten me what’s going on? thanks.
There is no reason why the
StackedArea100(and other similar members) should beinline. You can fix it by replacing all occurrences ofstatic member inlinewith juststatic member. If you can post a comment to the F# team’s blog post, that would be great (so that they can correct this in the next release).To add some more details:
The reason why the F# compiler doesn’t like the code is that the
oneXYSeqfunction that is used in the implementation should beinternaland so theStackedArea100cannot be inlined (because it would need to access an inaccessible helper function). The reason why it works in F# Interactive is that theFSharpChart.fsxfile is loaded into the current assembly, sointernalmembers are visible.Andy why is there unnecessary
inlinein the source code? It is because I originally experimented with using hat-types e.g.^Tto write generic members that work with any numeric type (and hat types requireinline). Then we decided to switch toIConvertible, so theinlineannotation is no longer needed.