Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specification needs to be updated for non-strong mode generic methods. #27639

Closed
leafpetersen opened this issue Oct 20, 2016 · 12 comments
Closed
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). area-specification (deprecated) Deprecated: use area-language and a language- label. P1 A high priority bug; for example, a single project is unusable or has many test failures

Comments

@leafpetersen
Copy link
Member

Informal specification here:

https://docs.google.com/document/d/1nccOSkdSyB9ls7TD8gUqIu6Wl2J_9bTSOoMCEIoAiQI/edit#heading=h.dnanv15dn1me

@leafpetersen leafpetersen added the area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). label Oct 20, 2016
@leafpetersen leafpetersen added this to the 1.50 milestone Oct 20, 2016
@leafpetersen
Copy link
Member Author

Assigning @eernstg for now - if you won't be the person doing this, can you sort out who will?

@leafpetersen
Copy link
Member Author

@bwilkerson noticed that the informal spec has some discussion of super constraints on type parameters, which I don't think we intend to support (at least not yet). @eernstg, can you clarify that in the doc?

@eernstg
Copy link
Member

eernstg commented Oct 31, 2016

Let's use 'syntax-only generic methods' to refer to the semantics specified in Feature: Generic Method Syntax.

Then we have two topics here: (1) Should we update the language specification to cover syntax-only generic methods?, and (2) what's the status of super bounds?

For (1), I didn't expect to change the language specification to cover syntax-only generic methods, because that is a temporary approach which should be extended to support full-fledged generic methods (which would of course be covered in detail in the language specification). So we would rely on the informal document Feature: Generic Method Syntax for the specification of syntax-only generic methods. The full-fledged specification includes local type inference of actual type arguments passed to invocations of generic functions, and the work on specifying local type inference is not complete (and we can't just whip up a brief clarification, it will take some time).

For (2), I also don't think we've decided that we will have super bounds on type arguments; I adjusted Feature: Generic Method Syntax to say explicitly that an implementation does not need to support them.

That said, I think they are useful and probably not hard to implement. In our discussions a long time ago Lasse mentioned that List could use the signature S firstWhere<S super T>(bool test(T element), S defaultValue()), and I believe we had other cases as well. But it is of course an enhancement which can be added later, without breaking existing programs.

@leafpetersen
Copy link
Member Author

I think that for now we should treat the syntax-only generic methods as an experiment and focus on specifying the strong mode behavior.

I think that 'super' bounds would be a useful extension, but I'd rather not tackle them now. I think there are some non-trivial implications to work through for inference and for subtyping.

@eernstg
Copy link
Member

eernstg commented Nov 2, 2016

The informal specification has been adjusted, and the resulting document is available here: Feature: Generic Method Syntax.

@eernstg eernstg closed this as completed Nov 2, 2016
@leafpetersen
Copy link
Member Author

Are we planning to incorporate this into the formal spec?

@eernstg
Copy link
Member

eernstg commented Feb 6, 2017

I'm doing that now.

@eernstg eernstg reopened this Feb 6, 2017
@eernstg
Copy link
Member

eernstg commented Feb 10, 2017

CL for that change.

@dgrove dgrove modified the milestones: 1.50, 1.23 Feb 14, 2017
@mit-mit mit-mit added the area-specification (deprecated) Deprecated: use area-language and a language- label. label Mar 15, 2017
@mit-mit
Copy link
Member

mit-mit commented Mar 15, 2017

@eernstg is this done?

@lrhn
Copy link
Member

lrhn commented Mar 15, 2017

CL (https://codereview.chromium.org/2690553002/) still not landed.

@leafpetersen leafpetersen removed this from the 1.23 milestone Mar 21, 2017
@eernstg
Copy link
Member

eernstg commented May 30, 2017

That CL was stalled for a while, because a new (reifying) semantics was being discussed, specified informally, and implemented in the vm. Turns out that dart2js will not implement the same thing (now, at least), so we will indeed stick to the non-reifying semantics for Dart 1.x. Now working on landing that CL again.

@eernstg eernstg added the P1 A high priority bug; for example, a single project is unusable or has many test failures label May 30, 2017
@eernstg
Copy link
Member

eernstg commented Nov 16, 2017

Closing: Updating the language specification to specify anything new pertaining to Dart 1.x is now an obsolete task.

@eernstg eernstg closed this as completed Nov 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). area-specification (deprecated) Deprecated: use area-language and a language- label. P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

6 participants