Pass symbol to template?
JS
js.mdnq at gmail.com
Fri Jul 19 01:08:24 PDT 2013
I have some templates to help initialize things, like a property
getter and setter.
mixin(Property!("Name", int));
creates a property named Name with type int.
I'd like to be able to call it like
mixin(Property!(Name, int));
(Name is a symbol but undefined at the mixin site(since it will
be defined once the mixin is done)
I doubt this is possible in any way because it requires the
compiler to allow such undefined symbols but would be nice...
e.g.,
template Property(lazy alias name, type) { ... }
but who knows, maybe I'm wrong and there is some way to do this?
More information about the Digitalmars-d-learn
mailing list