4 ms·
How is this different then literally any other templating language?
by fake-name 3y ago
How is this different then literally any other templating language?
- lifthrasiir 3y agoNormally code generation via templates is a part of the build process, but this is not always ideal for all uses. For example some template is simply too slow to run, or needs some specialized dependency which is otherwise not required. Or a particular code can be manually written, but you want to further document how that code could have been automatically generated. Cog templates are intended to persist, so that the output can safely replace the input and be directly checked into the repository without any additional dependency, making them useful for such situations. (This concept is not that unusual, by the way. CPython itself has a preprocessor called the Argument Clinic [1] which was in fact inspired by Cog.) [1] https://devguide.python.org/development-tools/clinic/ https://devguide.python.org/development-tools/clinic/
- simonw 3y agoSee comment here: https://news.ycombinator.com/item?id=38623182 https://news.ycombinator.com/item?id=38623182 The clever thing about Cog is that it's a templating language which is designed to be hidden in comments inside files (such as Markdown) that don't usually support an embedded templating language.