Alternative proposal to privateName.public

David Bruant bruant.d at
Mon Dec 26 11:08:40 PST 2011

Le 26/12/2011 19:40, Mark S. Miller a écrit :
> On Mon, Dec 26, 2011 at 7:54 AM, David Bruant <bruant.d at
> <mailto:bruant.d at>> wrote:
>     On a side note, I have seen a talk where someone mentionned that the
>     "use the same JavaScript in server and client" was partially bullshit,
>     because Node has support for some ES5 features that legacy web
>     browsers
>     can't even emu[l]ate.
> A pointer would be appreciated, thanks. Caja has a rather complete
> emulation of ES5 that runs in legacy browsers going back to IE6. The
> features that we're missing -- synchronous "eval" and the "Function"
> constructor -- are not features I would expect many Node programs to
> use. What other features are we missing?
> You can try out our emulation online at
> <> and
> <>.
Since ES3 is Turing-complete, it's always possible to write an ES5.1
interpreter and run any ES5.1 code (as used in node) in an ES3-capable
browser. I don't think neither Caja nor my extreme idea have been
considered by the speaker.

I think that the concern that was raised was about not having the
features natively. For instance, Object.defineProperty is not available
and unless using rewritting like in Caja (or more radical solutions),
it's not possible to emulate it in the browser.

In practice, IE6/7/8 already suffer from a performance penalty and
adding the overhead of runtime checks made by Caja are probably not
worth the cost in most web applications. That is certainly the reason
why people will prefer to either "dumb down" their code to ES3 if they
care about sharing or maintain the few sharable parts independently
rather than using a rewritter.

Do you have benchmarks on the overhead between "naive code" and Caja
generated code, specifically on IE6/7/8?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list