On Fri, 24 Jan 2014 13:42:42 GMT, Uplink_Coder wrote:

for stringTempates to seamlessly fit in I need the ALIASES avilable.
once this is sorted out the rest is a breeze.

However to recursivly use stringTemplates it will have to be a 2pass-parser
....

I'm continuing this discussion about support for multiple includes.
https://github.com/rejectedsoftware/vibe.d/pull/480

The idea is to be able to compile multiple diet templates into multiple diet templates of a project's dependencies. E.g. to have a templating library with a diet template that has left, right columns, and be able to add a calendar library or poll library that add to this same menu in aforementioned template library's diet template.

The idea I have for this is to simulate an enum dynamic array and compile the diet templates into that. The final project could then use filenames that point to where it should be included, e.g. include #{top.*} would fetch filenames with ctRegex that are top.menu.dt and top.search.dt from two other dependencies. Those would be in enum topmenu; enum topsearch; Here's a proof of concept of a compile-time semi-dynamic array of strings.

import std.stdio;
import std.algorithm;
import std.file;
import std.conv;

enum str1 = "dt1";
enum str2 = "dt2";
enum str3 = "dt3";
enum str4 = "dt4";
enum str5 = "dt5";

string genNextEnum(string ident, int i = 1,string val = "")(){

static if (!__traits(compiles, mixin("writeln(" ~ ident ~ i.to!string() ~ ")"))){
    return "enum " ~ ident ~ i.to!string() ~ " = \"" ~ val ~ "\";";
} else static if (i < 100)
    return genNextEnum!(ident, i+1, val)();
return "";

}

string listEnums(string ident, int i = 1)(){

static if (i < 100 && __traits(compiles, mixin("writeln(" ~ ident ~ i.to!string() ~ ")"))){
	return ident ~ i.to!string() ~ ", " ~ listEnums!(ident, i+1)();
}
return "";

}

mixin(genNextEnum!("str", 1, "dt6")());

int main(){

mixin("writeln(" ~ listEnums!("str")() ~ ");");

}