You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by Sam Ruby <ru...@intertwingly.net> on 2018/01/15 21:08:40 UTC

Upcoming script changes

TL;DR: in the upcoming weeks and months, I plan to upgrade the scripts 
generated to "use strict" and to make use of ECMAScript 2015 and later 
syntax.

---

I've been making changes to ruby2js in the past week or so to support 
features added to Javascript since 2009.  All browsers from IE 10 on 
support "use strict", and the major browsers (Chrome, Edge, Firefox, and 
Safari) support ES2017.

Enabling these changes is as simple as "require 'ruby2js/strict'" and/or 
"require 'ruby2js/es2017'".  I don't plan on adding those statements 
until after I have run some tests.  I also don't plan on changing the 
board agenda tool until after this month's meeting.  Should we need to 
revert the changes (either temporarily or permanently), all we will have 
to do is change back to "require 'ruby2js'".

In my opinion, all whimsy tools (particularly the one that run under 
passenger) should be upgraded to "use strict".  As I believe that it is 
unlikely that the secretary workbench will be used with IE 11, I believe 
that it is safe to update that tool to ES2017.

Some links outlining the changes:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

https://babeljs.io/learn-es2015/

---

Early explorations with the board agenda tool have identified some 
problematic code; things that work, but aren't quite right.  As an 
example, it seems that with the current code, 'color' is a computed 
property (more specifically a 'getter') that use used to determine the 
color of the top and bottom banners.  Despite not having a setter, the 
code does assign this value, which without either having strict on or 
using ES2015 classes will overwrite the getter.

Having JavaScript enforce the desired semantics will result in more 
maintainable code.

- Sam Ruby

Re: Upcoming script changes

Posted by Sam Ruby <ru...@intertwingly.net>.
I accidentally pushed a partial update for the board agenda tool
before it was ready, but as we are between meetings, I went ahead and
completed it.

Those who return to the board agenda tool using browsers that support
service workers (currently Firefox and Chrome; Edge and Safari have
this support in beta test) will get an "ES2017 strict" version of the
scripts; everybody else will continue to get "ES5 non-strict" (circa
2009) versions of the scripts.

To see the differences, compare:

https://whimsy.apache.org/board/agenda/app.js
https://whimsy.apache.org/board/agenda/app-es5.js

Major features: classes, arrow methods, for...of, const, let, methods
(including getters and setters) in object literals, default
parameters, rest/spread operators, template literals with
interpolation.

Fallbacks for all of these (generally requiring more code) is
implemented in es5.  Overall, the code is 5-6% smaller, more readable,
and provides additional error checks with strict and ES2015 above.  It
also is supposed to be faster, but client speed has generally not been
an issue with the board agenda tool.

- Sam Ruby

On Sun, Jan 21, 2018 at 6:10 PM, Sam Ruby <ru...@intertwingly.net> wrote:
> Secretary workbench has been updated:
>
> https://github.com/apache/whimsy/commit/dee30b73b5637f33806d8369cf9c5e9e528635fd
>
> If there are any problems that are suspected to be caused by this
> change, feel free to remove that line.
>
> - Sam Ruby
>
>
> On Mon, Jan 15, 2018 at 4:08 PM, Sam Ruby <ru...@intertwingly.net> wrote:
>> TL;DR: in the upcoming weeks and months, I plan to upgrade the scripts
>> generated to "use strict" and to make use of ECMAScript 2015 and later
>> syntax.
>>
>> ---
>>
>> I've been making changes to ruby2js in the past week or so to support
>> features added to Javascript since 2009.  All browsers from IE 10 on support
>> "use strict", and the major browsers (Chrome, Edge, Firefox, and Safari)
>> support ES2017.
>>
>> Enabling these changes is as simple as "require 'ruby2js/strict'" and/or
>> "require 'ruby2js/es2017'".  I don't plan on adding those statements until
>> after I have run some tests.  I also don't plan on changing the board agenda
>> tool until after this month's meeting.  Should we need to revert the changes
>> (either temporarily or permanently), all we will have to do is change back
>> to "require 'ruby2js'".
>>
>> In my opinion, all whimsy tools (particularly the one that run under
>> passenger) should be upgraded to "use strict".  As I believe that it is
>> unlikely that the secretary workbench will be used with IE 11, I believe
>> that it is safe to update that tool to ES2017.
>>
>> Some links outlining the changes:
>>
>> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
>>
>> https://babeljs.io/learn-es2015/
>>
>> ---
>>
>> Early explorations with the board agenda tool have identified some
>> problematic code; things that work, but aren't quite right.  As an example,
>> it seems that with the current code, 'color' is a computed property (more
>> specifically a 'getter') that use used to determine the color of the top and
>> bottom banners.  Despite not having a setter, the code does assign this
>> value, which without either having strict on or using ES2015 classes will
>> overwrite the getter.
>>
>> Having JavaScript enforce the desired semantics will result in more
>> maintainable code.
>>
>> - Sam Ruby

Re: Upcoming script changes

Posted by Sam Ruby <ru...@intertwingly.net>.
Secretary workbench has been updated:

https://github.com/apache/whimsy/commit/dee30b73b5637f33806d8369cf9c5e9e528635fd

If there are any problems that are suspected to be caused by this
change, feel free to remove that line.

- Sam Ruby


On Mon, Jan 15, 2018 at 4:08 PM, Sam Ruby <ru...@intertwingly.net> wrote:
> TL;DR: in the upcoming weeks and months, I plan to upgrade the scripts
> generated to "use strict" and to make use of ECMAScript 2015 and later
> syntax.
>
> ---
>
> I've been making changes to ruby2js in the past week or so to support
> features added to Javascript since 2009.  All browsers from IE 10 on support
> "use strict", and the major browsers (Chrome, Edge, Firefox, and Safari)
> support ES2017.
>
> Enabling these changes is as simple as "require 'ruby2js/strict'" and/or
> "require 'ruby2js/es2017'".  I don't plan on adding those statements until
> after I have run some tests.  I also don't plan on changing the board agenda
> tool until after this month's meeting.  Should we need to revert the changes
> (either temporarily or permanently), all we will have to do is change back
> to "require 'ruby2js'".
>
> In my opinion, all whimsy tools (particularly the one that run under
> passenger) should be upgraded to "use strict".  As I believe that it is
> unlikely that the secretary workbench will be used with IE 11, I believe
> that it is safe to update that tool to ES2017.
>
> Some links outlining the changes:
>
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
>
> https://babeljs.io/learn-es2015/
>
> ---
>
> Early explorations with the board agenda tool have identified some
> problematic code; things that work, but aren't quite right.  As an example,
> it seems that with the current code, 'color' is a computed property (more
> specifically a 'getter') that use used to determine the color of the top and
> bottom banners.  Despite not having a setter, the code does assign this
> value, which without either having strict on or using ES2015 classes will
> overwrite the getter.
>
> Having JavaScript enforce the desired semantics will result in more
> maintainable code.
>
> - Sam Ruby