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

mw mingwu at
Mon Sep 14 23:17:09 UTC 2020

On Monday, 14 September 2020 at 22:20:15 UTC, H. S. Teoh wrote:
> with, and your Github links are dead. Instead of assuming a

Sorry, I changed the dir structure, but the git repo root always 
stay the same:

Maybe you didn't follow the discussion very closely, but I think 
both Paul and Steven knows what I'm trying to do.

Never mind, let's start from fresh again, here is the *challenge*:

in this generated file:

Notice the similarity, but different parameters of these 3 

bool TA_MA(double[] inData , double[] outMA , int 
MA_optInTimePeriod=default_MA_optInTimePeriod, TA_MAType 
optInMAType=default_optInMAType) { ... }

bool TA_RSI(double[] inData , double[] outRSI , int 
RSI_optInTimePeriod=default_RSI_optInTimePeriod) { ... }

bool TA_MACD(double[] inData , double[] outMACD, double[] 
outMACDSignal, double[] outMACDHist , int 
optInFastPeriod=default_optInFastPeriod, int 
optInSlowPeriod=default_optInSlowPeriod, int 
optInSignalPeriod=default_optInSignalPeriod) { ... }

These are the target functions we want to generate.

Now the goal: write a single function template to generate these 
3 functions in D, better not to use the very raw string 
interpolation :-)

More information about the Digitalmars-d mailing list