On Friday, September 01, 2017 20:58:20 EntangledQuanta via Digitalmars-d- learn wrote: > template(A, B...) > { > auto foo(C...)(C c) > { > ... get c's parameter names, should be alpha, beta > } > } > > > foo!(., .)(alpha, beta) > > I need the actual identifiers passed to foo. I can get the > types(obviously C) but when I try to get the identifier > names(__traits(identifier or other methods) I stuff get _param_k > or errors. > > I need both C's types and the parameter identifier names past, > else I'd just pass as strings.
Those would actually be the arguments, not the parameters (c would be the parameters), but regardless, there's no way to do that. The function being called knows nothing about the caller. The only case that's even vaguely like that are the __FILE__ and __LINE__ directives which evaluate at the call site rather at the declaration site if they're used to default initialize a parameter (whereas in C++, they evaluate at the declaration site, which is a lot less useful). The function knows what its parameters are, but it knows nothing about what the arguments that were used to initialize the parameters were. If you want the names of the arguments to be passed to the function, you're going to have to pass them yourself. - Jonathan M Davis