ES6 and going forward

79 views
Skip to first unread message

Alexander Tsepkov

unread,
Sep 13, 2015, 4:52:07 PM9/13/15
to RapydScript
It looks like ES6 and ES7 (draft) add several features Python users already enjoy, some of which RapydScript handles, some of which it does not. Of particular interest to me are the following:

- generators
- iterators
- list comprehensions (RS already handles)
- classes (RS already handles)
- variables in hash keys
- implicit packing/unpacking of arrays (RS already handles)
- imports (RS already handles)
- tuple packing/unpacking (RS already handles but has a few bugs)

When I started RapydScript, the goal was to do one thing and do it well. The language was intended to be the opposite of Python-in-a-browser solutions, it was intended to be fast and minimal. RapydScript has grown quite a bit since then, but since ES6 picking up the slack for us, the smart thing for a language aiming to be minimal would be to shed the excess logic. And that is what I'd like to do.

A while ago, one of the members suggested compiling to ES6 directly and then using babel.js to downcompile back to ES5. Given the evolution of ES6, and RS duplicating much of ES6 functionality, this seems like the best way forward. With this approach I could simplify RapydScript and reduce bugs. It would require that users wishing to compile ES5 install Babel as well, however. So I wanted to hear community's thoughts on that.

Bruce Sherwood

unread,
Sep 19, 2015, 9:43:21 PM9/19/15
to RapydScript
I'm happy to see the rapid progress of ES6, but I'm not clear on how moving to ES6 would affect the users at glowscript.org. The typical user writes a program in VPython, which is compiled to JavaScript through the use of RapydScript (plus some preprocessing to closely emulate the VPython API). This compilation/transpiling takes place in the client, the browser. 

I have not yet used ES6 -> babel -> ES5. Would the user have to install babel? That would not be acceptable. Or is babel just another library served from glowscript.org?

Bruce

Alexander Tsepkov

unread,
Sep 21, 2015, 12:42:50 PM9/21/15
to Bruce Sherwood, RapydScript
I don't know how GlowScript serves its dependencies. Babel is a JavaScript library, just like RapydScript and can be installed the same way (manually via npm or as a dependency in package.json). Older version of RapydScript already pulled in 'optimist' library as its dependency for parsing arguments, this would be no different.

Bruce Sherwood

unread,
Sep 21, 2015, 1:33:50 PM9/21/15
to Alexander Tsepkov, RapydScript
Perhaps I should put it another way, as I'm ignorant.

If GlowScript used ES6 internally, with Babel converting to ES5 (current JavaScript), it wouldn't matter whether a user of GlowScript uses a browser that isn't up to date with the latest ES6 components, right?

Alexander Tsepkov

unread,
Sep 21, 2015, 1:35:55 PM9/21/15
to Bruce Sherwood, RapydScript
Exactly (Babel would effectively be part of GlowScript). And I would not use ES6 features that can't be converted to ES5 by Babel/RS.

Bruce Sherwood

unread,
Sep 21, 2015, 1:38:45 PM9/21/15
to Alexander Tsepkov, RapydScript
Thanks!
Reply all
Reply to author
Forward
0 new messages