// One read on volatileMutableValue, which may not be duplicated. let (a3, b3) = volatileMutableValue a1, b1, a2, b2, a3, b3 member x.WriteValues() = // One read on mutableValue, which may be duplicated according // to ECMA CLI spec. let (a2, b2) = mutableValue // One write on mutableValue. mutableValue <- (a2 + 1, b2 + 1) // One read on volatileMutableValue, which may not be duplicated. let (a3, b3) = volatileMutableValue // One write on volatileMutableValue. volatileMutableValue <- (a3 + 1, b3 + 1) let obj = ClassContainingMutableData() Async.Parallel [ async { return obj.WriteValues() }; async { return obj.WriteValues() }; async { return obj.ReadValues() }; async { return obj.ReadValues() } ] Zero Values Some types have a zero value. The zero value is the“default” value for the type in the CLI execution environment. The following types have the following zero values: For reference types, the null value. For value types, the value with all fields set to the zero value for the type of the field. The zero value is also computed by the F# library function Unchecked.defaultof<ty>. Taking the Address of an Elaborated Expression When the F# compiler determines the elaborated forms of certain expressions, it must compute a “reference” to an elaborated expression expr, written AddressOf(expr, mutation). The AddressOf operation is used internally within this specification to indicate the elaborated forms of address-of expressions, assignment expressions, and method and property calls on objects of variable and value types. The AddressOf operation is computed as follows: If expr has form path where path is a reference to a value with type byref<ty>, the elaborated form is &path.
// One read on volatileMutableValue, which may not be duplicated. let (a3, b3) = volatileMutableValue a1, b1, a2, b2, a3, b3 member x.WriteValues() = // One read on mutableValue, which may be duplicated according // to ECMA CLI spec. let (a2, b2) = mutableValue // One write on mutableValue. mutableValue <- (a2 + 1, b2 + 1) // One read on volatileMutableValue, which may not be duplicated. let (a3, b3) = volatileMutableValue // One write on volatileMutableValue. volatileMutableValue <- (a3 + 1, b3 + 1) let obj = ClassContainingMutableData() Async.Parallel [ async { return obj.WriteValues() }; async { return obj.WriteValues() }; async { return obj.ReadValues() }; async { return obj.ReadValues() } ] Zero Values Some types have a zero value. The zero value is the“default” value for the type in the CLI execution environment. The following types have the following zero values: For reference types, the null value. For value types, the value with all fields set to the zero value for the type of the field. The zero value is also computed by the F# library function Unchecked.defaultof<ty>. Taking the Address of an Elaborated Expression When the F# compiler determines the elaborated forms of certain expressions, it must compute a “reference” to an elaborated expression expr, written AddressOf(expr, mutation). The AddressOf operation is used internally within this specification to indicate the elaborated forms of address-of expressions, assignment expressions, and method and property calls on objects of variable and value types. The AddressOf operation is computed as follows: If expr has form path where path is a reference to a value with type byref<ty>, the elaborated form is &path.
FSharpSpec-4.0-latest.docx