Hello.

I am reading through TDPL by Andresscu. The book has the following example, which I am abbreviating:


void main( string[] args) {
  Stat [] stats;

  foreach( arg; args[1..$]) {
auto newStat = cast(Stat) Object.factory( "statsinc04." ~ arg);
    enforce( newStat, "Invalid statistical function: " ~ arg);
    stats ~= newStat;
  }


My module is called statsinc04.d and you can see it listed above in the foreach loop. My question is, how do I change the code above so that it works even if I change the name of the file/module? I'm looking for clean solution something like a macro if one actually exists.


Thanks.



Reply via email to