2004-07-08

Take two languages into the shower?

Some days, C++ just isn't awkward enough. And Perl isn't unreadable enough. So what are you do, except write Perl that reads VHDL and writes C++?

Despite myself, I have to admit to having really enjoyed myself today. No individual part of what I did was hard in itself, but the combination made things just complicated enough to require full concentration. A little more, even: I had to stop part way through and do something about the way I kept accidentally fixing errors in the generated source rather than the generator. The big "WRONG WAY" comment at the top doesn't work if you've automatically clicked on your editor's link from the compiler diagnostic (and you've not been using #line directives, which is something I hadn't even thought about until now).

Step 1 was to make the generated files read-only. Obvious, but something missing from the make rules all these years. Step 2 was to modify my editor to include a watermark repeating the text "(read-only)" behind read-only files. It works pretty well. It's subtle enough to not get in your way if you really do want to edit a read-only file (and chmod, or "Save As", say, when you've got down whatever it is you're thinking and don't want to lose), but unmissable enough that there's no way you could accidentally start editing without realizing there was something special about this file.

And indeed, that was the last time I made that mistake all day.