
On Thu, Jun 10, 2021 at 10:12 AM Stestagg <stestagg@gmail.com> wrote:
On Thu, Jun 10, 2021 at 2:58 PM Ricky Teachey <ricky@teachey.org> wrote:
Something I don't understand is whether there is anything about this proposed feature that can't be accomplished with a simple function...
.... And use it like this:
templify("Here, have some {foo}.") TemplateLiteral(template = " Here, have some {foo}.", tokens = (("Here, have some ", True), ("spam & eggs", False)))
What is it about this task that requires it being handled at the language level...?
AIUI, that is hard to do without language support, because the function templify can't easily access the value of 'foo' because the binding only exists in the caller's scope.
So for a simple function to be used, you'd have to pass in the placeholder values explicitly as separate arguments, which somewhat defeats the point.
Steve
Got it now. Should have been able to figure that out on my own thanks for explaining! Makes me wonder if stepping back and thinking, instead, about a way to automatically (optionally?) put the current calling context dictionary(ies) somewhere that a called function can get at it/them, so it can do what it wants with the context. --- Ricky. "I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler