Skip to content

Commit c0e8c56

Browse files
authored
Merge pull request #26 from Rufflewind/master
subtyping: clarify the concreteness of 'a in example
2 parents e7bb51f + 91dbbbc commit c0e8c56

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/subtyping.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ confusion, because it seems intuitively backwards to many: the bigger scope is a
1111
*subtype* of the smaller scope.
1212

1313
This does in fact make sense, though. The intuitive reason for this is that if
14-
you expect an `&'a u8`, then it's totally fine for me to hand you an `&'static
15-
u8`, in the same way that if you expect an Animal in Java, it's totally fine for
16-
me to hand you a Cat. Cats are just Animals *and more*, just as `'static` is
17-
just `'a` *and more*.
14+
you expect an `&'a u8` (for some concrete `'a` that you have already chosen),
15+
then it's totally fine for me to hand you an `&'static u8` even if `'static !=
16+
'a`, in the same way that if you expect an Animal in Java, it's totally fine
17+
for me to hand you a Cat. Cats are just Animals *and more*, just as `'static`
18+
is just `'a` *and more*.
1819

1920
(Note, the subtyping relationship and typed-ness of lifetimes is a fairly
2021
arbitrary construct that some disagree with. However it simplifies our analysis

0 commit comments

Comments
 (0)