Wouldn't it be interesting to have a "scope" variable? as is arguments...
Something like
function(){
window.scope.set('strict', true);
}
of
function(){
scope.set({
"strict": true,
"experimental": true,
"safe": false
});
// then, other functions could turn on/off some of it
someEl.addEventListener('click', function(){
scope.set('safe', true);
...
// or even
if( scope.get('experimental') ){
// doSomethingNew();
}
});
}
This is just a "raw" suggestion, and personally, I think it should NOT be
possible to turn off an "strict" or "safe" definition, even when it comes
from a parenting scope.
But this way, it would be "polyfillable", future-friendly, for new stuff
and new versions of ES, and browser support, and maybe the new scope
feature might bring some other benefits, such as a native "supports" for
new feature, or a new way to support sandboxed scopes.
I wonder if something like this couldn't be used to define a scope as a
"worker", to run in a new process thread(sandboxed, in this case).
Let me know what you think, or if you haven't already discussed something
similar.
Cheers.
On Thu, Dec 18, 2014 at 10:46 AM, Alex Kocharin <[email protected]> wrote:
>
>
>
> 16.12.2014, 17:04, "Andrea Giammarchi" <[email protected]>:
>
>
>
> On Tue, Dec 16, 2014 at 1:50 PM, Felipe Nascimento de Moura <
> [email protected]> wrote:
>
>
> function () {
> use strict, safe;
> }
>
> This could allow us to even add some extra scoped-options, such as a safe
> mode..
>
>
>
> I'm quite sure we've discussed already other directives and the unanimous
> answer here was "NO, 'use strict' is already problematic"
>
>
>
> It's problematic mostly because it can't be turned off when it's needed.
> So another directive like "use nostrict" would be welcome imho. Especially
> in modules when "strict" is on by default.
>
> I think we should either deprecate one of the modes, or officially support
> multiple modes and provide a method to switch between them.
>
>
--
*Felipe N. Moura*
Senior Web Developer
Website: http://felipenmoura.org
Twitter: @felipenmoura <http://twitter.com/felipenmoura>
LinkedIn: http://goo.gl/qGmq
Meet some of my projects:
BrazilJS Conference <http://braziljs.com.br/> | BrazilJS Foundation
<http://braziljs.org> | Power Polygon
<http://github.com/braziljs/power-polygon> | TheWebMind
<http://thewebmind.org/> | PHPDevBar
<https://addons.mozilla.org/pt-BR/firefox/addon/php-developer-toolbar/>
---------------------------------
LinuxUser #508332
*Changing the world* is the least I expect from myself!
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss