How to create a string template?

Maybe my post was not clear enough: What I showed you was what a function like the function_from_string macro would do.

While the parsing part is ‘slow’ (but no slower than any way you might be able to do this manually), you only have to do it once, and then can re-use it every time you fill it in. You can even (and this is what e.g. Phoenix does) run the parsing step at compile-time.

This is the only way to store a ‘template string’ directly without using e.g. EEx would be to store it as quote do "aaa#{x}bbb#{y}ccc" end and later on ‘embed’ it from within another macro that you write. That is probably very messy.

@Nicd’s approach below is much better :slightly_smiling_face: