|
|
|
|
|
by abecedarius
6288 days ago
|
|
I've written C code emitters too. FWIW, I've found nicely-indented output templates help to keep the source code of the emitter clear (and with no need to get at the enclosing scopes). But the question you raised was whether indentation-only was harder to generate, and I'd say no, because code.replace('\n', '\n ') is as simple as '{' + code + '}', if slightly slower. |
|
Again, I see no point in making efforts to generate clean looking code when utilities like indent exist.