You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support computed properties in class property declarations #1841
Yeah but we would cache the property name. It feels different from the initializer. But I see what you're saying, we could move the name into the constructor too, unless anyone has objections to that.
Activity
JsonFreeman commentedon Jan 28, 2015
We would only do this for initialized properties. For uninitialized properties, we would have to give an error.
DanielRosenwasser commentedon Feb 5, 2015
So if you had something like
I'm assuming that every time the constructor is invoked, the
x++expression gets evaluated.JsonFreeman commentedon Feb 5, 2015
No, that is not the semantics I had in mind. It would get evaluated when the class is evaluated, which happens only once.
DanielRosenwasser commentedon Feb 5, 2015
Why? We don't cache the initializers anyway.
TypeScript input:
JavaScript output:
JsonFreeman commentedon Feb 5, 2015
Yeah but we would cache the property name. It feels different from the initializer. But I see what you're saying, we could move the name into the constructor too, unless anyone has objections to that.
DanielRosenwasser commentedon Feb 18, 2015
As per our design meeting last week, we've decided that we just won't support this because the semantic implications can be counterintuitive.