Given the following code:
let bar =
lazy(
printfn "bar"
())
let foo =
lazy(
printfn "foo"
bar)
In the interactive window (resetting it each time),
When I call let res = foo.Force ()
I get:
foo
val res : Lazy<unit> = Value is not created.
When I just call foo.Force()
, I get:
foo
bar
val it : Lazy<unit> =
<ToString exception: Object reference not set to an instance of an object.>
{IsValueCreated = false;
Value = null;}
In both cases I would have expected it to just print "foo", however the second case prints "foo\nbar". What's going on here?