Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: GENERIC_METHODS.md

Issue 1585753003: Some phrasing fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Strong mode generic method prototype syntax 1 # Strong mode generic method prototype syntax
2 2
3 This is a summary of the current (as of January 2016) supported comment-based 3 This is a summary of the current (as of January 2016) comment-based generic
4 generic method syntax supported by the analyzer strong mode and the Dart Dev 4 method syntax supported by the analyzer strong mode and the Dart Dev Compiler.
5 Compiler. The comment-based syntax essentially uses the proposed actual generic 5 The comment-based syntax essentially uses the proposed actual generic method
6 method syntax, but wraps it in comments. This allows developers to experiment 6 syntax, but wraps it in comments. This allows developers to experiment with
7 with generic methods while still ensuring that their code runs on all platforms 7 generic methods while still ensuring that their code runs on all platforms while
8 while generic methods are still being evaluated for inclusion into the language. 8 generic methods are still being evaluated for inclusion into the language.
9 9
10 ## Declaring generic method parameters 10 ## Declaring generic method parameters
11 11
12 Generic method parameters are listed after the method or function name, inside 12 Generic method parameters are listed using a block comment after the method or
13 of angle brackets and comments. 13 function name, inside of angle brackets.
14 14
15 ```dart 15 ```dart
16 // This declares a function which takes two unused generic method parameters 16 // This declares a function which takes two unused generic method parameters
17 int f/*<S, T>*/(int x) => 3; 17 int f/*<S, T>*/(int x) => 3;
18 ``` 18 ```
19 19
20 As with classes, you can put bounds on type parameters. 20 As with classes, you can put bounds on type parameters.
21 21
22 ```dart 22 ```dart
23 // This declares a function which takes two unused generic method parameters 23 // This declares a function which takes two unused generic method parameters
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 C c = new C(); 181 C c = new C();
182 // This line will produce a type error, because strong mode will infer 182 // This line will produce a type error, because strong mode will infer
183 // `int` as the generic argument to fill in for S 183 // `int` as the generic argument to fill in for S
184 String x = c.inferableFromArgument(3); 184 String x = c.inferableFromArgument(3);
185 185
186 // This line will produce a type error in strong mode, because `int` is 186 // This line will produce a type error in strong mode, because `int` is
187 // explicitly passed in as the argument to use for S 187 // explicitly passed in as the argument to use for S
188 String y = c.notInferable/*<int>*/(3); 188 String y = c.notInferable/*<int>*/(3);
189 } 189 }
190 ``` 190 ```
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698