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

Make methods extracted from const objects be const values. #12531

Closed
lrhn opened this issue Aug 19, 2013 · 5 comments
Closed

Make methods extracted from const objects be const values. #12531

lrhn opened this issue Aug 19, 2013 · 5 comments
Labels
area-language New language issues should be filed at https://github.com/dart-lang/language closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug

Comments

@lrhn
Copy link
Member

lrhn commented Aug 19, 2013

Currently top-level and static functions are compile-time constant values.

Would it be possible to also make methods extracted from a const value be const?

That is:
  class C {
    final int x;
    const C(this.x);
    int value() => x;
  }
  typedef int Foo();
   
  const Foo = const C().value;

Since "const C()" is a compile-time constant, the behavior of its value method should also be determinable at compile time.

@gbracha
Copy link
Contributor

gbracha commented Aug 21, 2013

Added this to the Later milestone.
Added Accepted label.

@gbracha
Copy link
Contributor

gbracha commented Aug 21, 2013

Set owner to @gbracha.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@lrhn lrhn added Type-Enhancement area-language New language issues should be filed at https://github.com/dart-lang/language labels Aug 4, 2014
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed priority-unassigned labels Feb 29, 2016
@lrhn lrhn closed this as completed Jan 12, 2024
@lrhn
Copy link
Member Author

lrhn commented Jan 12, 2024

A very small increment on const expressions, probably not worth it by itself.

@lrhn lrhn added the closed-not-planned Closed as we don't intend to take action on the reported issue label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language New language issues should be filed at https://github.com/dart-lang/language closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants