Sfoglia il codice sorgente

Fix binding syntax to be `id: Type` (#1381)

josh11b 3 anni fa
parent
commit
16f9d82541
1 ha cambiato i file con 10 aggiunte e 10 eliminazioni
  1. 10 10
      docs/design/code_and_name_organization/README.md

+ 10 - 10
docs/design/code_and_name_organization/README.md

@@ -180,7 +180,7 @@ For example, to use `Geometry.Circle` from the `Geometry//Shapes` library:
 ```carbon
 import Geometry library "Shapes";
 
-fn Area(Geometry.Circle circle) { ... };
+fn Area(circle: Geometry.Circle) { ... };
 ```
 
 The `library` keyword is optional for `import`, and its use should parallel that
@@ -351,7 +351,7 @@ package Geometry library "Shapes" api;
 struct Circle { ... }
 
 // CircleHelper is private, and so will not be available to other libraries.
-private fn CircleHelper(Circle circle) { ... }
+private fn CircleHelper(circle: Circle) { ... }
 
 // Only entities in namespaces should be marked as an API, not the namespace
 // itself.
@@ -359,7 +359,7 @@ namespace Operations;
 
 // Operations.GetCircumference is an API, and will be available to
 // other libraries as Geometry.Operations.GetCircumference.
-fn Operations.GetCircumference(Circle circle) { ... }
+fn Operations.GetCircumference(circle: Circle) { ... }
 ```
 
 This means that an API file can contain all implementation code for a library.
@@ -405,7 +405,7 @@ package Checksums library "Sha" api;
 
 namespaces Sha256;
 
-fn Sha256.HexDigest(Bytes data) -> String { ... }
+fn Sha256.HexDigest(data: Bytes) -> String { ... }
 ```
 
 Calling code may look like:
@@ -415,9 +415,9 @@ package Caller api;
 
 import Checksums library "Sha";
 
-fn Process(Bytes data) {
+fn Process(data: Bytes) {
   ...
-  var String digest = Checksums.Sha256.HexDigest(data);
+  var digest: String = Checksums.Sha256.HexDigest(data);
   ...
 }
 ```
@@ -488,7 +488,7 @@ package Geometry api;
 import Geometry library "Shapes";
 
 // Circle must be referenced using the Geometry namespace of the import.
-fn GetArea(Geometry.Circle c) { ... }
+fn GetArea(c: Geometry.Circle) { ... }
 ```
 
 ### Namespaces
@@ -514,7 +514,7 @@ package Time;
 namespace Timezones.Internal;
 struct Timezones.Internal.RawData { ... }
 
-fn ParseData(Timezones.Internal.RawData data);
+fn ParseData(data: Timezones.Internal.RawData);
 ```
 
 A namespace declaration adds the first identifier in the name path as a name in
@@ -556,7 +556,7 @@ namespace Timezones.Internal;
 alias TI = Timezones.internal;
 
 struct TI.RawData { ... }
-fn ParseData(TI.RawData data);
+fn ParseData(data: TI.RawData);
 ```
 
 ## Caveats
@@ -775,7 +775,7 @@ syntax. For example:
 ```carbon
 import Cpp file("myproject/myclass.h");
 
-fn MyCarbonCall(Cpp.MyProject.MyClass x);
+fn MyCarbonCall(x: Cpp.MyProject.MyClass);
 ```
 
 ### Imports from URLs