expanding comments proposal

Tab Atkins Jr. jackalmage at gmail.com
Fri Oct 21 21:57:46 UTC 2016


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