expanding comments proposal

Gert Cuykens gert.cuykens at gmail.com
Fri Oct 21 22:20:43 UTC 2016


First I would like to see if we can agree on the term superset. Like
the question is typescript a superset of ES? As you pointed out there
are many comment like solutions like jsdoc or like your pep 484
suggestion. But then a superset get narrowed down to // and /**/ which
is fine but that means typescript doesn't come close as a super set
and can never be used in jsbin directly for example.

So the big question is can we agree on a superset that stretches the
boundaries so that typescript would fall under that category. If for
example certain typescript syntax is too brought I can ask the
typescript community if they can adjust their compiler in the future
that is compatible with the Ecma superset specifications.

On Fri, Oct 21, 2016 at 11:57 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> On Fri, Oct 21, 2016 at 2:46 PM, Gert Cuykens <gert.cuykens at gmail.com> wrote:
>> Exactly, here is a concrete ES2015 example
>> http://jsbin.com/ruqekam/edit?html,output Now just add a simple
>> typescript type to any of the variables and notice everything breaks.
>> If ES2015 would be smart enough to ignore the typings I can use a
>> simple jsbin to share my code with others without any transpiling. I
>> want to avoid making this a typescript specific thing but just want to
>> point out that Ecma262 can be made more flexible to allow some supper
>> set syntax that browser vendors can simply ignore but editors like
>> vscode can use it for intellisense because it recognizes the extra
>> syntax as typescript for example.
>
> Okay, so it *sounds* like your proposal is that ES allow the
> TypeScript syntax of writing variables declarations as "name:type",
> and treat the :type part as a comment?
>
> If you're interested in "typing that look like comments", you can do
> that today; Python2 defines a reasonable syntax in Pep 484
> <https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code>.
>
> ~TJ


More information about the es-discuss mailing list