Skip to content

Commit d4d21b4

Browse files
committed
tutorial: Mention how the destructor works in the section on resources. Closes #1615.
1 parent 857ad58 commit d4d21b4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/tutorial.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,10 +1329,11 @@ resource file_desc(fd: int) {
13291329
~~~~
13301330

13311331
This defines a type `file_desc` and a constructor of the same name,
1332-
which takes an integer. Values of such a type can not be copied, and
1333-
when they are destroyed (by going out of scope, or, when boxed, when
1334-
their box is cleaned up), their body runs. In the example above, this
1335-
would cause the given file descriptor to be closed.
1332+
which takes an integer. The type has an associated destructor procedure,
1333+
whose contents are specified by the block. Values of such a type can not
1334+
be copied, and when they are destroyed (by going out of scope, or, when
1335+
boxed, when their box is cleaned up), their body runs. In the example
1336+
above, this would cause the given file descriptor to be closed.
13361337

13371338
NOTE: We're considering alternative approaches for data types with
13381339
destructors. Resources might go away in the future.

0 commit comments

Comments
 (0)