Skip to content

Commit 60a748a

Browse files
committed
Remove section on resources from tutorial; add a todo to cover classes
1 parent 588c1eb commit 60a748a

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

doc/tutorial.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,26 +1377,7 @@ Like vectors, strings are always unique. You can wrap them in a shared
13771377
box to share them. Unlike vectors, there is no mutable variant of
13781378
strings. They are always immutable.
13791379
1380-
## Resources
1381-
1382-
Resources are data types that have a destructor associated with them.
1383-
1384-
~~~~
1385-
# fn close_file_desc(x: int) {}
1386-
resource file_desc(fd: int) {
1387-
close_file_desc(fd);
1388-
}
1389-
~~~~
1390-
1391-
This defines a type `file_desc` and a constructor of the same name,
1392-
which takes an integer. The type has an associated destructor procedure,
1393-
whose contents are specified by the block. Values of such a type can not
1394-
be copied, and when they are destroyed (by going out of scope, or, when
1395-
boxed, when their box is cleaned up), their body runs. In the example
1396-
above, this would cause the given file descriptor to be closed.
1397-
1398-
NOTE: We're considering alternative approaches for data types with
1399-
destructors. Resources might go away in the future.
1380+
NOTE: Section on resources removed. ToDo: document classes and destructors
14001381
14011382
# Argument passing
14021383
@@ -1581,7 +1562,7 @@ without any sophistication).
15811562
## Kinds
15821563
15831564
Perhaps surprisingly, the 'copy' (duplicate) operation is not defined
1584-
for all Rust types. Resource types (types with destructors) can not be
1565+
for all Rust types. Resource types (classes with destructors) cannot be
15851566
copied, and neither can any type whose copying would require copying a
15861567
resource (such as records or unique boxes containing a resource).
15871568

0 commit comments

Comments
 (0)