canjs / can-view-scope

Scope management for view engines
https://canjs.com/doc/can-view-scope.html
MIT License
4 stars 0 forks source link

Variable scopes #181

Closed justinbmeyer closed 5 years ago

justinbmeyer commented 6 years ago

Related to https://github.com/canjs/can-stache/issues/528

I'd like to create a variable scope like:

var scope = new Scope({
  rootProp: "ROOT"
}).add({
  variableProp: "VARIABLE"
},{variable: true});

And then

scope.get("variableProp")  //-> "VARIABLE";
scope.get("this.rootProp") //-> "ROOT";

this.key should skip all of these variables. key should look in these variables and then end with the first "context" variable it finds.

I feel like most of these variable scopes should have a SimpleMap as their context. This will allow variable re-assignment.

chasenlehara commented 5 years ago

It looks like this was implemented in https://github.com/canjs/can-view-scope/pull/182