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

[Wildcard Variables][spec] Late wildcard variables #3820

Closed
kallentu opened this issue May 17, 2024 · 3 comments
Closed

[Wildcard Variables][spec] Late wildcard variables #3820

kallentu opened this issue May 17, 2024 · 3 comments
Labels
wildcard-variables The wildcard-variables feature

Comments

@kallentu
Copy link
Member

(Pretty small thing, but I wanted to make sure we tracked this.)

What do we want to do with late wildcard variables? What does this combo even mean? Do we want to provide a warning on the late modifier?

late int _;
late int _ = 2;

cc. @dart-lang/language-team

@kallentu kallentu added the wildcard-variables The wildcard-variables feature label May 17, 2024
@lrhn
Copy link
Member

lrhn commented May 17, 2024

We don't have to special-case it. If we don't, it means precisely what it looks like: A late variable with no name to refer to it.

That makes it useless. No more useless than int _(int x) => x; or const _ = Banana();, and no less.
We generally haven't tried to disallow places where declaring something names _ is "useless". That would require us to define "useless", which is always precarious.

@eernstg
Copy link
Member

eernstg commented May 19, 2024

Note the overlap with #3798.

@kallentu
Copy link
Member Author

Good call @eernstg. Didn't see that issue. Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wildcard-variables The wildcard-variables feature
Projects
None yet
Development

No branches or pull requests

3 participants