The first block of code binds a value of type query<_>
to identifier consumerKey
while the second binds a value of type () -> query<_>
to identifier consumerKey
. The second is a function which when given unit
will return a value of type query<_>
.
In this example, the difference between the two are explicitly captured by their signatures. In other words, the first can be obtained from the second by invoking the function value with ()
. In terms of runtime, the second will always return a new underlying object instance, while the first one is fixed.
In cases where the evaluation causes side effects, the same would not hold. For example in thw following:
let value1 = Guid.NewGuid()
let value2 () = Guid.NewGuid()
A value1
cannot be obtained via value2
because a different value would be returned for each invocation.