fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Some features of the new UoM support are still "this feature is experimental" warnings

Open abelbraaksma opened this issue 3 years ago • 0 comments

The excellent new feature by @pblasucci (see #9978) provides support for UoM (Units of Measure) for all other primitive types (unsigned integers, native pointer types). The introduction of this has been mentioned in the What's new in F# 6.0 post and on some conference talks.

However, the added functions in FSharp.Core that come with this feature still raise the warning that this feature is experimental:

image

Repro steps

Any code that uses the LanguagePrimitives UoM conversion functions, like this (inspired by the RFC):

[<Measure>] type days
let better_age: uint16<days> = LanguagePrimitives.UInt16WithMeasure(uint16 10)

Expected behavior

Usage of such code should not raise any warning.

Actual behavior

Users will see an "this is an experimental feature" warning in F# 6.0, telling them it requires --langversion:preview.

warning FS0057: Experimental library feature, requires '--langversion:preview'. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'.

Known workarounds

You can ignore the warning. The code appears to compile just fine without setting the --langversion:preview. Though I didn't check the IL (which may make little sense as the UoM doesn't lead to different IL afaik).

Related information

F# 6.0 with .NET 6 and FSharp.Core 6.0.5.

I also noted that it appears that the down-scaling of land and other OCaml operators does not lead to a warning, which is contrary to what's mentioned in that same "What's new in F# 6.0" post, but I'll dig a little deeper into that and post it separately.

abelbraaksma avatar Jul 22 '22 09:07 abelbraaksma