[Haskell-cafe] Code that writes code

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Tue Aug 24 22:05:49 EDT 2010


On 25 August 2010 07:51, Richard O'Keefe <ok at cs.otago.ac.nz> wrote:
>
> On Aug 22, 2010, at 7:34 PM, Jesse Schalken wrote:
>
>> Every software project which I've worked on that used a code generator
>> turned into a nightmare, because when we find we need to change
>> something about the generator's output, all the already generated code
>> has to be updated manually while at the same time maintaining all of the
>> unique modifications that have been since the code was first generated.
>> It's a horrible duplication of program logic and maintenance work.
>
> If you need to change something about a generator's output,
> you do it (always!) by changing the generator's input, or by
> changing the generator.  Then you *re*generate the code.
> There should never *be* any "unique modifications" to the output
> of a code generator.

Yes, and if your ad-hoc changes cannot be expressed in the actual
generated code, then you may wish to re-think what you're generating
(what's the point of generating it if you have to edit it anyway?).

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list