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 }}
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
I can't help but feel that the currently proposed syntax look out of the ordinary.
Consider the following:
classExample{x=5;constructor(){}}
Eventhough x = 5; is part of the class definition, it appears to belong to a piece of sequential(?) code.
Another issue with simply having x = 5; (without having a clear previous let x; or such) is that it appears too reminiscent of assignment to window/global, something that is considered bad behavior and is resented by many.
Would it be possible to require a new keyword such as field to be added infront of instance members?
Consider the following (imagine field to be treated by syntax highlighting as it would static):
classExample{fieldx=5;constructor(){}}
I believe this would help make instance members appear more definition-like.
I also think this will help normalize the appearance of the # sigil use without having to add public/private specifiers.
The text was updated successfully, but these errors were encountered:
We discussed having different syntax for declarations (see e.g. here and here) and ultimately decided against it.
For me a fairly compelling argument was that many, many people are using this syntax through TypeScript and Babel without apparent confusion, so there doesn't seem to be an extremely strong need to be more explicit and verbose.
I can't help but feel that the currently proposed syntax look out of the ordinary.
Consider the following:
Eventhough
x = 5;
is part of the class definition, it appears to belong to a piece of sequential(?) code.Another issue with simply having
x = 5;
(without having a clear previouslet x;
or such) is that it appears too reminiscent of assignment to window/global, something that is considered bad behavior and is resented by many.Would it be possible to require a new keyword such as
field
to be added infront of instance members?Consider the following (imagine
field
to be treated by syntax highlighting as it wouldstatic
):I believe this would help make instance members appear more definition-like.
I also think this will help normalize the appearance of the # sigil use without having to add public/private specifiers.
The text was updated successfully, but these errors were encountered: