Kurt Mueller
Kurt Mueller

Reputation: 3224

Example from Microsoft F# documentation doesn't compile

MS documentation: Use interfaces to group related operations

type Serializer =
    abstract Serialize<'T>: preserveRefEq: bool -> value: 'T -> string
    abstract Deserialize<'T>: preserveRefEq: bool -> pickle: string -> 'T

If I copy and paste that into an fsx script or a dotnet-interactive notebook, I'll get a compiler error that says:

This construct is deprecated: ':' is not permitted as a character in operator names and is reserved for future useF# Compiler(35)

What changes would I need to make in order to fix this example?

Upvotes: 1

Views: 43

Answers (1)

Scott Hutchinson
Scott Hutchinson

Reputation: 1721

I think just adding a space before the colon fixes it:

type Serializer =
    abstract Serialize<'T> : preserveRefEq: bool -> value: 'T -> string
    abstract Deserialize<'T> : preserveRefEq: bool -> pickle: string -> 'T

This might be a compiler bug.

Upvotes: 3

Related Questions