[OT] C vs C++
JG
someone at simewhere.com
Sat Sep 10 05:57:53 UTC 2022
On Friday, 9 September 2022 at 15:58:12 UTC, H. S. Teoh wrote:
> On Fri, Sep 09, 2022 at 09:36:16AM +0000,
...
> In fact, in my own D projects I have resorted to external
> codegen in some cases, instead of adding yet another layer of
> mixins/templates to the code. Sometimes, it's not worth the
> extra complexity and maintenance burden just to have the
> bragging rights that you did it all within the confines of the
> language; sometimes, the more sensible thing to do is just to
> write a utility program that generates the desired D code, and
> compile that into your main executable.
>
> (Of course, this does assume a reasonably sane build system...
> if you're stuck with Certain Hobbled Build Tools
> *cough*notnamingnameshere*cough*, then over-complex templates
> and unreadable mixins may be your only recourse. :-P)
>
>
> T
In my experience this can lead to, hard to debug code, since the
error is in the generated code. Although of course debugging
template heavy or mixin filled code is also not a picnic. How do
you avoid this kind of problem? For instance if you use, say,
vide.d templates, which are an example of heavy usage of compile
time features, and make a mistake in a template you often get a
somewhat meaningful error message relating to the template file.
This would probably be harder with an external tool (since it
would have to be able error check arbitrary d).
More information about the Digitalmars-d
mailing list