F# record member evaluation

Posted by Oldrich Svec on Stack Overflow See other posts from Stack Overflow or by Oldrich Svec
Published on 2010-05-20T11:16:21Z Indexed on 2010/05/20 11:20 UTC
Read the original article Hit count: 158

Filed under:
|
|

Why is t.b evaluated on every call? And is there any way how to make it evaluate only once?

type test =
  { a: float }
  member x.b =
    printfn "oh no"
    x.a * 2.

let t = { a = 1. }
t.b
t.b

© Stack Overflow or respective owner

Related posts about F#

Related posts about record