Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scitesy/604634 to your computer and use it in GitHub Desktop.
Save scitesy/604634 to your computer and use it in GitHub Desktop.
//Here's the view of an f# interactive session.
> open System.IO;;
> let foo = new MemoryStream();;
val foo : MemoryStream
> let bar = foo;;
val bar : MemoryStream
> let fooy() = MemoryStream();;
let fooy() = MemoryStream();;
-------------^^^^^^^^^^^^^^
stdin(4,14): warning FS0760: It is recommended that objects that support the IDisposable interface are created using 'new Type(args)' rather than 'Type(args)' to indicate that resources may be owned by the generated value
val fooy : unit -> MemoryStream
> let bary = fooy();;
val bary : MemoryStream
//let foo() = MemoryStream() return can be read as "a function that takes a unit(void), which returns a //function that returns a MemoryStream". So it is different than let foo = MemoryStream(). I'm not sure why //a unit(void) would ever be passed in but hey it is different.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment