mitsuhiko/templatetk — comment on commit 08e0f8d4d1614657cc3cf6aa4a23ed125ddb0f55
File: templatetk/res/templatetk.runtime.js line 25
By chrisdickinson:

Re: context scoping; have you considered just doing a simple prototype link from the new context to the parent?

Something like:

````
var link = Object.create || function(parent) {
var F = function() { }
F.prototype = parent
return new F
}

Context.prototype.push = function() {
return link(this)
}

````

Getting attributes out of context turns into a simple lookup: `{{ value }}` -> `ctxt.value` (or this behavior can be encapsulated by the `Context` class). Misses no longer need to be specifically handled (no explicit delegation to `this.parent.lookup`).