On Tue, May 14, 2013 at 4:36 PM, Dimitri Glazkov <dglazkov@google.com>wrote:
> Today, scripting engines in browsers return the value of the script
> that was executed the <script> block. This value is then promptly
> dropped on the floor by respective rendering engine. But what if it
> wasn't?
>
This is called the completion value. The only way the completion value is
observable in ES5 is using eval. The good thing is that we are improving it
for ES6.
> What if instead, we taught the rendering engine to hold on to the last
> value, returned by the executed <script> block, and only discarded it
> at the microtask checkpoint?
>
No need. GC will clean it when it is not reachable any more.
This seems pretty nice. And it works with ES6 syntax:
>
> <element name="foo-bar">
> ...
> <script>
> class FooBar {
> ...
> };
> </script>
> </element>
>
Allen, correct me if I'm wrong but the completion value of ClassDeclaration
is undefined (just like for VariableDeclaration).
--
erik