Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Normally 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/



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: