Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
Last active December 8, 2018 20:21
Show Gist options
  • Select an option

  • Save SteveGilham/48ebeaab5fd23e0ac1d43e397a97ce07 to your computer and use it in GitHub Desktop.

Select an option

Save SteveGilham/48ebeaab5fd23e0ac1d43e397a97ce07 to your computer and use it in GitHub Desktop.
What happens to a record with an [<Obsolete>] field?
open System
type R =
{ Wanted : String
[<Obsolete("Use 'Wanted' instead")>]
Unwanted : String }
static member Create () =
{ Wanted = String.Empty
Unwanted = String.Empty }
let UseR s =
let r1 = R.Create()
printfn "%A" r1
let r2 = { R.Create() with Wanted = s }
printfn "%A" r2
let r3 = { R.Create() with Unwanted = s }
printfn "%A" r3
UseR "is this wanted?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment