Ideas on type hinting and named parameters

Kevin Smith zenparsing at
Tue Jun 9 20:01:21 UTC 2015

> 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

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list