tutorial: Mention how the destructor works in the section on resources. Closes #1615.

This commit is contained in:
Patrick Walton 2012-02-14 09:28:10 -08:00
parent 857ad58dce
commit d4d21b4279
1 changed files with 5 additions and 4 deletions

View File

@ -1329,10 +1329,11 @@ resource file_desc(fd: int) {
~~~~
This defines a type `file_desc` and a constructor of the same name,
which takes an integer. Values of such a type can not be copied, and
when they are destroyed (by going out of scope, or, when boxed, when
their box is cleaned up), their body runs. In the example above, this
would cause the given file descriptor to be closed.
which takes an integer. The type has an associated destructor procedure,
whose contents are specified by the block. Values of such a type can not
be copied, and when they are destroyed (by going out of scope, or, when
boxed, when their box is cleaned up), their body runs. In the example
above, this would cause the given file descriptor to be closed.
NOTE: We're considering alternative approaches for data types with
destructors. Resources might go away in the future.