3 ms·
It is useful for autogenerated code. Which is a big sledgehammer that should only be swung carefully. But one use case is that you can have a DSL that you con
by btilly 16y ago
It is useful for autogenerated code. Which is a big sledgehammer that should only be swung carefully. But one use case is that you can have a DSL that you convert into code in your target language that you then eval.
Given the ease of going horribly wrong with this strategy, I strongly recommend only using it in cases where it is obviously a huge win. Such cases are not non-existent, but they are rare.
- japherwocky 16y agoThe only good use I've seen for turning a template into a callable bit of code for performance.
- jashkenas 16y agoHere's a JavaScript example of such a templating function: http://documentcloud.github.com/underscore/docs/underscore.html#section-97 http://documentcloud.github.com/underscore/docs/underscore.h...