Skip to content

Instantly share code, notes, and snippets.

@mrmonday
Created December 31, 2011 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrmonday/7faf1013f81ea96bfb89 to your computer and use it in GitHub Desktop.
Save mrmonday/7faf1013f81ea96bfb89 to your computer and use it in GitHub Desktop.
Bug?
module example.controllers.HomeController;
import serenity.core.Controller;
class HomeController : Controller {
mixin register!(HomeController);
}
module example.models.HomeModel;
import serenity.core.Model;
struct Article {
ulong id;
}
class HomeModel : Model {
private SqlitePersister!Article mArticles;
}
class Controller {
mixin template register(T : Controller) {
enum _s_pkg = __traits(parent, __traits(parent, __traits(parent, T))).stringof["package ".length .. $];
enum _s_model = T.stringof[0 .. $-`Controller`.length] ~ `Model`;
mixin(q{enum _ = is(} ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{.} ~ _s_model ~ q{ : serenity.core.Model.Model);});
}
}
class SqlitePersister(T) {
static assert(T.tupleof.length > 0, T.stringof ~ `(` ~ (T.tupleof.length + '0') ~ `): ` ~ T.tupleof.stringof);
}
class Model {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment