How to modify the scope chain without `with` ?
coroutines at gmail.com
Mon Feb 15 17:49:11 UTC 2016
On Mon, Feb 15, 2016 at 4:48 AM, Benjamin Gruenbaum <inglor at gmail.com> wrote:
> For what it's worth very popular templating libraries like KnockoutJS use
> `woth` heavily.
> I think the consensus is that writing DSLs should be done as a
> Knockout and your library)
> The dynamic nature of `with` is why it is forbidden in strict mode, when
> import/export land in browsers things will run in strict mode by default
> which means `with` is gone.
Aside from this, I wish JS would provide the ability to modify the
scope chain - and it should be just objects that can inherit from one
another through prototypes. I think it would be too perfect/clean to
handle scope in the existing way we handle inheritance. My example
isn't completely justified to say "I need this" - but I think having
direct control over scope would be important in the future and should
be considered for ES7. Especially if the existing way is not portable
I don't think it would be a security concern either, as you could only
make objects you have reference to your new scope.
More information about the es-discuss