4 ms·
> Simple. Programs should themselves be programmed(Generated). Anything that has a structure should be generated, never written. This is the idea behind compile
by hzhou321 5y ago
> Simple. Programs should themselves be programmed(Generated). Anything that has a structure should be generated, never written. This is the idea behind compilers/assemblers. And if you extend that idea, that's true for some thing like Python too.
If the code -- I assume that's what you mean by program -- is generated, the code is not the true source of the program. The true code should be the code that describe or instruct (I prefer describe) how the program is generated. If you do think your code is being generated, yet you are still reading and editing that generated stuff, that's just inefficient or wrong, right?
Treating the code as being generated results in a attitude of not caring about the quality of the code and yet not seeking better alternatives.
- kamaal 5y agoWe write a lot of recipe'ish code all the time. That should really be templated. Nobody should write fileopen-read-close repeatedly over and over again. The editor should write this kind of code for you.
- hzhou321 5y agoNo, the compiler or preprocessor should process a higher level instruction that you write using the editor. The editor can run the preprocessor or compiler or a chain of them with single click and load or view any intermediate code with convenience of course, but none of the generated intermediate form should be written or saved in a repository.
- kamaal 5y ago>>No, the compiler or preprocessor should process a higher level instruction that you write using the editor. Yes. Macros. Only Lisp has it. No body really uses Lisp. And languages like Python don't have it. So we have to use these hacks for the mean while.