reflection based on my experience so far on compile-time meta-programming in D as a novice user: the problems

H. S. Teoh hsteoh at
Mon Sep 14 22:20:15 UTC 2020

On Mon, Sep 14, 2020 at 08:25:36PM +0000, mw via Digitalmars-d wrote:
> The point I want to make is: all the supposed high level fancy D
> mechanisms are too complex to use (or may not even made to work at
> all, I'm not sure).
> The safe bet so far is: go back to raw string manipulation, and *keep*
> the generated code, to be read by human (for inspection) and compiled
> by the compiler in the 2nd pass.

It makes me that feel you're not using the right tool for the right job.
What exactly are your requirements, and what exactly are you trying to
accomplish?  If you're thinking of your "meta-programming" in terms of
string manipulations, then what's the point of trying to redress it with
"high level fancy D mechanisms"?  Just generate the string and mixin.
Job done.

Your original post in D.learn consisted of a bunch of exercises with no
clear explanation of what the goal is.  You mentioned that you're trying
to wrap a library, but I didn't see any concrete list of C functions
that you're trying to interface with, and your Github links are dead.
Instead of assuming a certain way of doing things and complaining when
it doesn't do what you thought it should do, I wish you'd post the list
of C functions you're trying to wrap, and then we can discuss what are
the options for wrapping them, instead of this finger-pointing exercise
that, fun as it may be, leads to no constructive result.


An elephant: A mouse built to government specifications. -- Robert Heinlein

More information about the Digitalmars-d mailing list