What would a 1JS-friendly strict mode look like?

Felipe Nascimento de Moura felipenmoura at gmail.com
Thu Dec 18 10:44:07 PST 2014


ok, makes sense!

The fact that this works at the compile time, really makes it impossible to
modify from scope to scope!
It was just a suggestion, syntax or the way it could be implemented was not
supposed to be exactly like that...but I think it might be interesting if
we had some of the advantages/possibilities mentioned, like safe mode,
debug or (specially)experimental...or the supports for new features in the
future.
My concern here, is about future evolution on languages, browsers and
implementation.

It could be a string like "use strict, experimental"...could even be an
annotated comment.

Anyways, I believe it might be something useful to think about :)

Cheers.




On Thu, Dec 18, 2014 at 4:32 PM, Till Schneidereit <
till at tillschneidereit.net> wrote:
>
> On Thu, Dec 18, 2014 at 6:50 PM, Felipe Nascimento de Moura <
> felipenmoura at gmail.com> wrote:
>>
>> did anyone see my suggestion?
>> (actually, am not sure my e-mails are going out!)
>>
>
>> Personally(again, my opinion), I think it is at least weird, having a
>> "floating string" on your code! Specially because(by now) this is the only
>> situation, with only one option, what makes it an "exception".
>> ES has so many great patterns, the least exceptions for the rules, the
>> better!
>> That's why I thought about a "scope" token/accessor.
>> Besides that, some advantages such as enabling experimental features or
>> not, safe mode, etc.
>> When I think about it, new ideas come!
>> Let's say you may use:
>>
>> scope.set("debug", ["error", "call");
>>
>
> Strict mode is a static, compile-time setting, not something that can be
> modified at runtime. Hence, your suggestion falls short, because it would
> be a runtime setting.
>
> the reason why a "floating string" was used is to not introduce syntax
> that older engines would trip over. Something like `use strict` (without
> the quotes) would cause that. You might say that `scope.set` would only be
> allowed at compile time or something, but that would be problematic both
> because it's not backwards-compatible (what if code uses a collection
> called "scope"?) and because it's not distinguishable from normal code.
>
> Also, "use strict" has been around for years and nothing will ever get it
> removed/replaced, anymore.
>
>
>> and this would cause any function call inside this scope, to stop(if a
>> console is opened) pausing the flow for debugging, or also, when any error
>> occur inside it.
>> Other things could be done to log calls, as well(changing the verbosity
>> of the scope).
>>
>> Sorry if this idea is stupid and I can't see it! hehe
>>
>> Regards.
>>
>

-- 
*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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141218/b1162c7b/attachment.html>


More information about the es-discuss mailing list