Przeglądaj źródła

replace me with self 2nd try (#2631)

this is a second try after PR 2629,
I restarted from scratch since most changes were undone.
Avi Aaron 3 lat temu
rodzic
commit
0a70614235
2 zmienionych plików z 16 dodań i 16 usunięć
  1. 10 10
      docs/design/expressions/indexing.md
  2. 6 6
      docs/design/sum_types.md

+ 10 - 10
docs/design/expressions/indexing.md

@@ -50,13 +50,13 @@ Its semantics are defined in terms of the following interfaces:
 ```
 interface IndexWith(SubscriptType:! type) {
   let ElementType:! type;
-  fn At[me: Self](subscript: SubscriptType) -> ElementType;
-  fn Addr[addr me: Self*](subscript: SubscriptType) -> ElementType*;
+  fn At[self: Self](subscript: SubscriptType) -> ElementType;
+  fn Addr[addr self: Self*](subscript: SubscriptType) -> ElementType*;
 }
 
 interface IndirectIndexWith(SubscriptType:! type) {
   impl as IndexWith(SubscriptType);
-  fn Addr[me: Self](subscript: SubscriptType) -> ElementType*;
+  fn Addr[self: Self](subscript: SubscriptType) -> ElementType*;
 }
 ```
 
@@ -78,11 +78,11 @@ final external impl forall
     [SubscriptType:! type, T:! IndirectIndexWith(SubscriptType)]
     T as IndexWith(SubscriptType) {
   let ElementType:! type = T.(IndirectIndexWith(SubscriptType)).ElementType;
-  fn At[me: Self](subscript: SubscriptType) -> ElementType {
-    return *(me.(IndirectIndexWith(SubscriptType).Addr)(index));
+  fn At[self: Self](subscript: SubscriptType) -> ElementType {
+    return *(self.(IndirectIndexWith(SubscriptType).Addr)(index));
   }
-  fn Addr[addr me: Self*](subscript: SubscriptType) -> ElementType* {
-    return me->(IndirectIndexWith(SubscriptType).Addr)(index);
+  fn Addr[addr self: Self*](subscript: SubscriptType) -> ElementType* {
+    return self->(IndirectIndexWith(SubscriptType).Addr)(index);
   }
 }
 ```
@@ -98,8 +98,8 @@ An array type could implement subscripting like so:
 class Array(template T:! type) {
   external impl as IndexWith(like i64) {
     let ElementType:! type = T;
-    fn At[me: Self](subscript: i64) -> T;
-    fn Addr[addr me: Self*](subscript: i64) -> T*;
+    fn At[self: Self](subscript: i64) -> T;
+    fn Addr[addr self: Self*](subscript: i64) -> T*;
   }
 }
 ```
@@ -110,7 +110,7 @@ And a type such as `std::span` could look like this:
 class Span(T:! type) {
   external impl as IndirectIndexWith(like i64) {
     let ElementType:! type = T;
-    fn Addr[me: Self](subscript: i64) -> T*;
+    fn Addr[self: Self](subscript: i64) -> T*;
   }
 }
 ```

+ 6 - 6
docs/design/sum_types.md

@@ -111,7 +111,7 @@ interface Match {
   }
 
   let template Continuation:! type;
-  fn Op[me: Self, C:! Continuation](continuation: C*)
+  fn Op[self: Self, C:! Continuation](continuation: C*)
     -> C.(MatchContinuation.ReturnType);
 }
 ```
@@ -146,13 +146,13 @@ class Optional(T:! type) {
   external impl as Match {
     interface Continuation {
       extends Match.BaseContinuation;
-      fn Some[addr me: Self*](value: T) -> ReturnType;
-      fn None[addr me: Self*]() -> ReturnType;
+      fn Some[addr self: Self*](value: T) -> ReturnType;
+      fn None[addr self: Self*]() -> ReturnType;
     }
 
-    fn Op[me: Self, C:! Continuation](continuation: C*) -> C.ReturnType {
-      if (me.has_value) {
-        return continuation->Some(me.value);
+    fn Op[self: Self, C:! Continuation](continuation: C*) -> C.ReturnType {
+      if (self.has_value) {
+        return continuation->Some(self.value);
       } else {
         return continuation->None();
       }