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

Remove generalized tear-offs #27518

Closed
5 tasks done
munificent opened this issue Oct 6, 2016 · 10 comments
Closed
5 tasks done

Remove generalized tear-offs #27518

munificent opened this issue Oct 6, 2016 · 10 comments
Assignees
Labels
area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...).
Milestone

Comments

@munificent
Copy link
Member

munificent commented Oct 6, 2016

The language team has decided the generalized tear-off feature looks like it won't work as well as originally hoped, so we're going to take it out. Fortunately, it was never fully implemented and it appears to be completely unused within Google (both strong signs it wasn't a highly desired feature).

In the future, we hope to support constructor tear-offs with a more natural syntax. In the meantime, the tools that have implemented generalized tear-offs should remove support for it.

Tracking issues:

@munificent munificent added the area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...). label Oct 6, 2016
@munificent munificent added this to the 1.50 milestone Oct 6, 2016
@dgrove
Copy link
Contributor

dgrove commented Oct 6, 2016

@bwilkerson I believe there's analyzer work as well (not strictly required, since it's behind a flag). Correct?

@munificent
Copy link
Member Author

Thanks, added one for that too.

@mit-mit
Copy link
Member

mit-mit commented Nov 3, 2016

Moving to 1.22 per release discussion, deprecation warning will happen in 1.21 (see #27742).

@mit-mit mit-mit modified the milestones: 1.22, 1.50 Nov 3, 2016
@mit-mit
Copy link
Member

mit-mit commented Nov 11, 2016

Marking spec update complete in the checklist up top.

@trinarytree
Copy link

Part of the reason for lack of use may have been that constructor tear-offs were not considered const:

class A {}

void main() {
  const c = new A#;  // error: expression is not a valid compile-time constant
}

This made it impossible to use such tear-offs as factories in the version of Angular's DI system that demands constants. See #24845.

munificent, you said in that issue that we don't have to worry about that issue because this tear-off feature is being removed, but that may be circular reasoning: That issue made tear-offs unattractive => the feature wasn't used much => you think you should remove the feature => we should keep tear-offs unattractive.

@munificent
Copy link
Member Author

That issue made tear-offs unattractive => the feature wasn't used much => you think you should remove the feature => we should keep tear-offs unattractive.

My logic isn't that I think we should remove generalized tear-offs. That decision has already been made. The logic is thus:

This issue relies on generalized tear-offs → Generalized tear-offs are being removed → We can close this issue. :)

The larger picture here is that the language team does want to add a better story for:

  • Closurizing constructors
  • Creating closures for other tiny common operations where an explicit closure feels too verbose

Generalized tear-offs handled the former, but with a not great syntax. It only handled a subset of the latter, again with a not great syntax. In some of the cases it did handle, the result was more verbose than an explicit closure, again because of the not great # syntax.

We think we have some ideas on how to do something notably better than generalized tear-offs. And, since they weren't in use anyway, we decided to remove them to simplify things and avoid having multiple overlapping ways to accomplish the same thing.

@munificent
Copy link
Member Author

Oh, to your original comment about canonicalization. If/when we introduce syntax for constructor tear-offs, we'll take canonicalization into account. I don't have a lot of expertise on it, but we'll make sure there's time to iterate on it with the Angular folks and users like yourself so that we don't ship a feature that doesn't handle important use cases.

@mit-mit
Copy link
Member

mit-mit commented Dec 30, 2016

Marking VM complete.

@mit-mit
Copy link
Member

mit-mit commented Dec 30, 2016

Changelog updated in #28221

@mit-mit
Copy link
Member

mit-mit commented Dec 30, 2016

All done, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...).
Projects
None yet
Development

No branches or pull requests

6 participants