about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-07-19 17:56:30 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-07-19 17:56:30 -0700
commitac9cf98564cc394672cd9a96a02093569951027c (patch)
tree3c0913d450c86dd60546350e8ae57b83d7f4351a
parent0f34144be308d28260d2496104ad06c2cb9cf5c3 (diff)
Edit for style
-rw-r--r--doc/tutorial.md25
1 files changed, 18 insertions, 7 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md
index 569538fc948..ef3004f8cbe 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -2504,15 +2504,17 @@ needed because it could also, for example, specify an implementation
 of `seq<int>`—the `of` clause *refers* to a type, rather than defining
 one.
 
-Note that functions do not explicitly have the type parameters that 
-are provided by the iface. It will cause a compile-time error if you
-include them in the iface or impl.
+The type parameters bound by an iface are in scope in each of the
+method declarations. So, re-declaring the type parameter
+`T` as an explicit type parameter for `len` -- in either the iface or
+the impl -- would be a compile-time error.
 
-## Use of the type `self` in interfaces
+## The `self` type in interfaces
 
-Interfaces may use `self` as a type where the implementation uses its
-own type. This defines an interface for testing equality of a type with
-itself:
+In an interface, `self` is a special type that you can think of as a
+type parameter. An implementation of the interface for any given type
+`T` replaces the `self` type parameter with `T`. The following
+interface describes types that support an equality operation:
 
 ~~~~
 iface eq {
@@ -2520,6 +2522,15 @@ iface eq {
 }
 ~~~~
 
+In an implementation for type `int`, the `equals` method takes an
+`int` argument:
+
+~~~~
+impl of eq for int {
+  fn equals(other: int) { other == self }
+}
+~~~~
+
 ## Casting to an interface type
 
 The above allows us to define functions that polymorphically act on