Hi,
perhaps Julian is referring to disposal of the member objects of a class instance?
attempting to use implicit class constructors with use bindings causes the following error:
type ParentClass() =
use child = new ChildClass()
Warning FS0191: 'use' bindings are not permitted in implicit class constructors. file1.fs
using a let binding, however, doesn't call the Dispose function in child objects.
#light
module DisposalTest
open System
type ChildClass() =
do printfn "creating object of class ChildClass"
interface IDisposable with
member x.Dispose() = printfn "disposed object of class ChildClass"
type ParentClass() =
let child = new ChildClass()
do printfn "creating object of class ParentClass"
interface IDisposable with
member x.Dispose() = printfn "disposed object of class ParentClass"
let main() =
use parent = new ParentClass()
()
do main()
produces the following output
>project1.exe
creating object of class ChildClass
creating object of class ParentClass
disposed object of class ParentClass
notice that ChildClass.Dispose() is not called.
warm regards,
Danny