News for hackers. Stuff that matters.
Re:Ask HN: Weirdest hack that you ever saw in production? by ndh2 on Sunday March 25, 2018 @11:03AM (#16672471)
I disagree that you shouldn't do it. The way you do it is to add a comment

// This %thing% was generated from %template% using data from %data%.

If your language is too restrictive to add sensible tools, you should write the tools yourself. As with any code, write it in a way such that other people will be able to understand it.

There is no magic, it's just code. I wish people would stop using that word.

Re:Ask HN: Weirdest hack that you ever saw in production? by msangi on Sunday March 25, 2018 @12:54PM (#16673059)
The original comment says "they just weren't anywhere in the code that humans could see."

Where would you and the comment in a situation like that one?

I don't have anything against generated code but it should be visible and, as you said, it should be crystal clear where it come from

Re:Ask HN: Weirdest hack that you ever saw in production? by ndh2 on Sunday March 25, 2018 @01:16PM (#16673184)
I think in this instance it's also a matter of tools. Visual Studio/Visual Assist would have been able to find the class definition, and that's where the comment would go. For cscope it's a matter of configuration, which should be auto-generated by the build tool.

If the class is being used, then the definition has got to be somewhere, hopefully in a header. It's simply a file that is included somewhere. And it will be human readable. There is no magic.

Re:Ask HN: Weirdest hack that you ever saw in production? by mikelevins on Sunday March 25, 2018 @08:38PM (#16675619)
The class definitions were not in any file. That was the entire point. They didn't exist at all except as transient build artifacts.