|
|
Created:
4 years, 11 months ago by Leaf Modified:
4 years, 11 months ago CC:
dev-compiler+reviews_dartlang.org, Jacob, Bob Nystrom Base URL:
git@github.com:dart-lang/dev_compiler.git@master Target Ref:
refs/heads/master Visibility:
Public. |
DescriptionAdd file documenting generic method prototype syntax
BUG=
R=jmesserly@google.com, vsm@google.com
Committed: https://github.com/dart-lang/dev_compiler/commit/a1b57501c1528b7573f807e076e0b02aa83e5d35
Patch Set 1 #Patch Set 2 : #
Total comments: 4
Patch Set 3 : #
Total comments: 12
Messages
Total messages: 12 (3 generated)
leafp@google.com changed reviewers: + jmesserly@google.com, vsm@google.com
This is just a quick doc describing the generic method comment syntax. It could get folded into STRONG_MODE.md, but wanted to get something written down that we can start referring people to. There's a markdown previewer here: https://jbt.github.io/markdown-editor/ if you want to see the rendered version.
lgtm! https://codereview.chromium.org/1586803002/diff/20001/GENERIC_METHODS.md File GENERIC_METHODS.md (right): https://codereview.chromium.org/1586803002/diff/20001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:6: method syntax, but wraps it in comments. Probably worth a line here that this allows devs to try out generic methods but still run on all platforms (until generic methods are implemented :-)). https://codereview.chromium.org/1586803002/diff/20001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:167: // This line will not produce a type error, because string mode is unable s/string/strong/
LGTM!
Description was changed from ========== Add file documenting generic method prototype syntax BUG= ========== to ========== Add file documenting generic method prototype syntax BUG= R=jmesserly@google.com, vsm@google.com Committed: https://github.com/dart-lang/dev_compiler/commit/a1b57501c1528b7573f807e076e0... ==========
Message was sent while issue was closed.
Committed patchset #3 (id:40001) manually as a1b57501c1528b7573f807e076e0b02aa83e5d35 (presubmit successful).
Message was sent while issue was closed.
https://codereview.chromium.org/1586803002/diff/20001/GENERIC_METHODS.md File GENERIC_METHODS.md (right): https://codereview.chromium.org/1586803002/diff/20001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:6: method syntax, but wraps it in comments. On 2016/01/13 22:01:29, vsm wrote: > Probably worth a line here that this allows devs to try out generic methods but > still run on all platforms (until generic methods are implemented :-)). Done. https://codereview.chromium.org/1586803002/diff/20001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:167: // This line will not produce a type error, because string mode is unable On 2016/01/13 22:01:29, vsm wrote: > s/string/strong/ Done.
Message was sent while issue was closed.
rnystrom@google.com changed reviewers: + rnystrom@google.com
Message was sent while issue was closed.
Super cool! LGTM. https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md File GENERIC_METHODS.md (right): https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:3: This is a summary of the current (as of January 2016) supported comment-based Nit: Remove "supported" since it's used later in the sentence. https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:13: of angle brackets and comments. How about: "Generic method parameters are listed using a block comment after the method or function name, inside of angle brackets." https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:109: Type s = dynamic /*=S*/; Generic method type parameters are reified? https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:141: // The shorthand syntax is not yet supported for list and map literals Will this be fixed soon? If so, I wouldn't mention using new List() to workaround it. We have enough trouble getting people to stop writing Dart like it's Java as it is, and I'd hate for people to get in a bad habit. https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:170: // to infer a type and will fill in the type argument with `dynamic`. "no implicit dynamic" would yell here, I assume?
Message was sent while issue was closed.
https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md File GENERIC_METHODS.md (right): https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:109: Type s = dynamic /*=S*/; On 2016/01/13 22:43:20, Bob Nystrom wrote: > Generic method type parameters are reified? In DDC, they will be, yes. https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:141: // The shorthand syntax is not yet supported for list and map literals On 2016/01/13 22:43:20, Bob Nystrom wrote: > Will this be fixed soon? If so, I wouldn't mention using new List() to > workaround it. We have enough trouble getting people to stop writing Dart like > it's Java as it is, and I'd hate for people to get in a bad habit. https://github.com/dart-lang/sdk/issues/25407. It's probably super easy fix, but I haven't looked into it yet. https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:170: // to infer a type and will fill in the type argument with `dynamic`. On 2016/01/13 22:43:20, Bob Nystrom wrote: > "no implicit dynamic" would yell here, I assume? Yup. Aside: we're currently in a funny place with generic inference. For constructors, like `class Foo<T> {}` and `new Foo()`, only downwards inference happens. For generic methods, only upwards inference happens. We really should fix it so they both get a shot. (In this example, we could infer it from downwards inference.)
Message was sent while issue was closed.
https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md File GENERIC_METHODS.md (right): https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:141: // The shorthand syntax is not yet supported for list and map literals On 2016/01/13 22:49:33, John Messerly wrote: > On 2016/01/13 22:43:20, Bob Nystrom wrote: > > Will this be fixed soon? If so, I wouldn't mention using new List() to > > workaround it. We have enough trouble getting people to stop writing Dart like > > it's Java as it is, and I'd hate for people to get in a bad habit. > > https://github.com/dart-lang/sdk/issues/25407. It's probably super easy fix, but > I haven't looked into it yet. sent out a fix
Message was sent while issue was closed.
https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md File GENERIC_METHODS.md (right): https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:3: This is a summary of the current (as of January 2016) supported comment-based On 2016/01/13 22:43:20, Bob Nystrom wrote: > Nit: Remove "supported" since it's used later in the sentence. Done. https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:13: of angle brackets and comments. On 2016/01/13 22:43:20, Bob Nystrom wrote: > How about: > > "Generic method parameters are listed using a block comment after the method or > function name, inside of angle brackets." Done. https://codereview.chromium.org/1586803002/diff/40001/GENERIC_METHODS.md#newc... GENERIC_METHODS.md:109: Type s = dynamic /*=S*/; On 2016/01/13 22:49:33, John Messerly wrote: > On 2016/01/13 22:43:20, Bob Nystrom wrote: > > Generic method type parameters are reified? > > In DDC, they will be, yes. Just to be clear - the intention is that they will be everywhere, but currently DDC is the only platform which implements them. |