5 ms·
Funny I do that in perl, and some people freak out about having code in an unfashionable language generating code in another language. It's just equivalent to
by 1996 7y ago
Funny I do that in perl, and some people freak out about having code in an unfashionable language generating code in another language.
It's just equivalent to a preprocessor.
- lizmat 7y agoIn the mid-90's, before mod_perl, I used to generate PHP in minutely cron job using a Perl script from a constantly changing database. That came close to the best of both worlds at the time: the flexibility of Perl, fed from a database, and no CGI overhead when serving.
- marcosdumay 7y agoCode generation usually sucks. A small one-off run under your control is an exception. But people learn to fear the thing, and apply that fear everywhere.
- vageli 7y ago> Code generation usually sucks. > A small one-off run under your control is an exception. But people learn to fear the thing, and apply that fear everywhere. Why does it usually suck? Writing code that writes code seems like an optimization that would bolster productivity.
- karatinversion 7y agoMost of the code generation code I’ve seen is itself opaque and generates opaque code. This makes refactoring, extending and bug fixing hard.
- marcosdumay 7y ago> Why does it usually suck? One large factor is that when somebody really dislike the result of a code generator, they most commonly cope by editing the generated code by hand. With other metaprogramming techniques people can't do the same, so they fix the issues. The end result is that code generators are usually a set of mostly-functioning tools that create bad code that is almost, but not exactly impossible to understand but that you will be required to change at some point.
- saagarjha 7y agoCode generation usually doesn’t get you any support from standard tooling. My autocomplete can see through macros, but it has no idea what C is if I was working with Perl.