>
> how about introducing a well known concept in JS as `own` ?
>
> ```js
> class Person {
>   static name String: "A person name"
>   own name String: "anonymous"
>   own items Array: []
>

Let's take a step back and ask:  what's the motivation for having these
property declarations and initializers outside of the constructor?  As Mark
pointed out, it's a syntactic feature that is strictly less expressive than
the current solution of putting property assignments in the constructor
body.

Instance property initializer syntax is really geared toward type systems,
where you are expressing type constraints (either structural or nominal) on
objects created by the given constructor.

I'm wary of adding syntax whose primary motivation is to express type
constraints, when we haven't even defined (or proposed) what typing in JS
means.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to