Loyal Opposition to Const, Private, Freeze, Non-Configurable, Non-Writable...

Brendan Eich brendan at mozilla.com
Wed Nov 2 10:49:22 PDT 2011

On Nov 2, 2011, at 9:30 AM, Quildreen Motta wrote:

> Also, note that `with' makes a whole awesome use-case for `Object.freeze':

'with' is gone in ES5 strict, ES6, and beyond -- you knew that, right?

> ---
> with (require({'library1': 'lib1'}, {'library2': 'lib2'})) {
>   lib1.foo(lib2.something)
> }

This is still hard to optimize, even with the implied freeze under require.

Also, you can't load code dynamically without nesting an event loop and violating run-to-completion, so I'm not sure how such a require would work.

This does remind me: JS's "freedom" is Dart's "cannot be tooled" and "inherent performance problems", and without aggressive optimization work it can mean JS is measurably slower for some kinds of code than Dart (or Java).

("cannot be tooled" is flat wrong, as past discussion here of static+dynamic/live-system analysis concluded.)

To "inherent performance problems", I say "feature" and "optimize harder". But it's worth mentioning, especially since you cited 'with', which is a bug that I brought ;-). Stupid-dynamic is just stupid and we should avoid it.

Freedom without fences and other tools for accountability fails at scale.


More information about the es-discuss mailing list