ES Native Mode proposal

Michaël Rouges michael.rouges at gmail.com
Wed Sep 25 08:41:13 PDT 2013


Hi all,

Given the number of scripts from various sources that may be contained in a
web page, there may be prototyping conflicts.

To solve this, heavy techniques are often used, such as iframes, to execute
code in peace.

I'm often thinking it might be much easier to tell the browser to have a
native to a given context, incidentally, to the functions from this context
& nested, regarding on the last relative scope with this instruction.

What I suggest, therefore it is a complementary mode to `'use strict'`...
the `'use native'`.

Suggested behavior :

`Object.prototype.serialize = function serialize() {
    // serialization code
};

(function () {
    'use strict', 'use native';

    Object.prototype.hasOwnProperty('serialize') // false

    Object.prototype.serialize = function serialize() {
        // serialization code
    };

    (function () {
        Object.prototype.hasOwnProperty('serialize') // true
    }());

    (function () {
        'use native';

        Object.prototype.hasOwnProperty('serialize') // false
    }());
} ());`

Thanks in advance for your advices.


Michaël Rouges - https://github.com/Lcfvs - @Lcfvs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130925/d5efe41d/attachment-0001.html>


More information about the es-discuss mailing list