On Sat, May 9, 2020 at 1:50 AM Adam D. Ruppe via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
Another potential use for this would be writing type translation
functions.

I've written something along these lines many times:

      ParameterTypeTuple!T fargs;
      foreach(idx, a; fargs) {
            if(idx == args.length)
                    break;
      cast(Unqual!(typeof(a))) fargs[idx] =
args[idx].get!(typeof(a));


This converts arguments of a dynamic type to the static parameter
types of a given function in preparation to call it.

That ugly cast on the lhs there is to deal with const.

      void foo(const int a) {}

That function there needs the cast to assign to the const param.

Well, with the static map, we MIGHT be able to just do

foo(fromDynamic(fargs, args.pop)...)

or something like that which expands in place so the mutable
thing is implicitly cast to const without the explicit cast
intermediate.


I haven't tried that btw i just think it might work given the
concept. That would be impossible with staticMap as-is because of
the runtime variable in there.

Yes! I use this pattern _all the time_ in C++, and it's definitely a motivating use case for `...` as I see it.
This is an intended and important use case.