Earlier quoted context omitted.
Generating code is fine, if the generated code strictly never evolves independently of what it is generated from. For instance generating libraries from .proto files (or other declarative schema definition solutions) works really well. If the schema changes, you throw away the old generated code and generate brand new code, no problem. But if you want to make even a single tiny modification to one of the generated fi…
As a Lisp guy I find this entire discussion weird
Don't be clever
221–230 of 231 posts
Re: Don't be clever
#222Re: Don't be clever
#223The issue at hand is not about cleverness. Code was devised to address a specific problem (DRY), which it did quite elegantly. Then, the situation evolved, rendering the solution inappropriate. When a controller starts to deviate from the standard approach, it's best to refrain from inheriting from the base controller and instead create custom ones. Once all controllers operate independently, the base class can be sa…
What about making all of the "clever" things composable and optional, instead of tightly coupled? That way when you get a special case you can just make that part a special handler. You neither need to throw out the whole "clever" thing nor make the "clever" thing "more clever".
Re: Don't be clever
#224Earlier quoted context omitted.
As a Lisp guy I find this entire discussion weird
I absolutely prefer code generation over macros. It is a general solution that works for all languages, databases, protocols etc. And you can easily inspect the code generated.
Re: Don't be clever
#225Re: Don't be clever
#226Earlier quoted context omitted.
> For instance generating libraries from .proto files (or other declarative schema definition solutions) works really well. ...does it ? Generated ones always feel being mismatched with the language paradigms. Maybe that's just my nightmares of dealing with MS Graph generated vomit hose of a library...
Sure, that's true, I'm a heavy user of the standard protobuf library in python, and you certainly won't catch me singing its praises for its style. But that's a different (and less important) kind of problem. It does not exhibit the huge issue with generated-and-then-modified code where you have to maintain all the generated code rather than just the source from which it was generated.
It is IMO very bad tradeoff.
Re: Don't be clever
#227Earlier quoted context omitted.
I absolutely prefer code generation over macros. It is a general solution that works for all languages, databases, protocols etc. And you can easily inspect the code generated.
You can wrap a code generator by a macro.
Re: Don't be clever
#228Re: Don't be clever
#229Earlier quoted context omitted.
You can wrap a code generator by a macro.
Why would you want to do that? That would be adding unnecessary compile time overhead. And (again) code generation works for any language/framework/OS/… Not just for Lisp.
Re: Don't be clever
#230Earlier quoted context omitted.
Why would you want to do that? That would be adding unnecessary compile time overhead. And (again) code generation works for any language/framework/OS/… Not just for Lisp.
You can handle any language with a read-time parser, then work with ASTs, pretty-print the result in another language. In between, it's just Lisp.