CACI-International / ergo

The ergo language and runtime.
MIT License
2 stars 2 forks source link

Implement file templating #17

Open calebzulawski opened 1 year ago

calebzulawski commented 1 year ago

File templating is common, but the easiest way to do it right now is with multiline strings. It would be nice if files could be templated directly, with the same syntax as strings.

afranchuk commented 1 year ago

I assume you mean something where the templated file exists outside the script, and you could do something like std:fs:apply-template path/to/template/file path/to/output?

This would work very differently from multiline strings if it were a function, as they statically determine all captures and are parsed during tokenization. A syntax builtin would make it more equivalent, e.g. rust's include! macro occurs prior to tokenization.