On Wednesday, 27 May 2015 at 17:03:30 UTC, Artur Skawina wrote:
That already works. Eg:

   alias deduceType(Args...) = typeof({
// some complex imperative code to deduce the type from the args
      import std.range;
return mixin(iota(Args.length).map!q{`Args[`~text(a)~']'}().join("+"));
   }());

   struct Foo(T...) {
      deduceType!(T) value;
   }

static assert(is(typeof(Foo!(short, ubyte, bool).value)==int));


What all these proposals seem to be about is:

a) better introspection (ie exposing a (preferably simplified and std) AST)
b) AST injection
c) "better" syntax
d) better "optimizations", meaning skipping the emission of code and data
     that is never used at runtime.

artur

Maybe extending capabilities of templates would be a better direction. They already accept aliases which are essentially simple hygienic identifier expressions.

Reply via email to