about summary refs log tree commit diff
path: root/doc/tutorial/data.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tutorial/data.md')
-rw-r--r--doc/tutorial/data.md15
1 files changed, 14 insertions, 1 deletions
diff --git a/doc/tutorial/data.md b/doc/tutorial/data.md
index 638db23cb08..0ae474aa54c 100644
--- a/doc/tutorial/data.md
+++ b/doc/tutorial/data.md
@@ -292,4 +292,17 @@ strings. They are always immutable.
 
 ## Resources
 
-FIXME fill this in
+Resources are data types that have a destructor associated with them.
+
+    resource file_desc(fd: int) {
+        close_file_desc(fd);
+    }
+
+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.
+
+NOTE: We're considering alternative approaches for data types with
+destructors. Resources might go away in the future.