←back to thread

620 points tambourine_man | 1 comments | | HN request time: 0.315s | source
1. feraidoon ◴[] No.43754755[source]
I had something like this implemented for safely executing shell commands, by using metaprogramming:

name="A$ron"

z("echo Hello {name}")

Note that this is not an f-string. The z function expands the variables by parsing this string and accessing its caller's local variables.

https://github.com/NightMachinery/brish