Skip to content

Commit 0f34144

Browse files
committed
Merge remote-tracking branch 'Havvy/master' into Havvy-pull-req
2 parents 4843339 + 2d23669 commit 0f34144

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/tutorial.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,6 +2504,22 @@ needed because it could also, for example, specify an implementation
25042504
of `seq<int>`—the `of` clause *refers* to a type, rather than defining
25052505
one.
25062506

2507+
Note that functions do not explicitly have the type parameters that
2508+
are provided by the iface. It will cause a compile-time error if you
2509+
include them in the iface or impl.
2510+
2511+
## Use of the type `self` in interfaces
2512+
2513+
Interfaces may use `self` as a type where the implementation uses its
2514+
own type. This defines an interface for testing equality of a type with
2515+
itself:
2516+
2517+
~~~~
2518+
iface eq {
2519+
fn equals(other: self) -> bool;
2520+
}
2521+
~~~~
2522+
25072523
## Casting to an interface type
25082524

25092525
The above allows us to define functions that polymorphically act on

0 commit comments

Comments
 (0)