Comment #0 by default_357-line — 2020-10-27T08:49:44Z
Consider the following code:
```
import std.stdio;
import std.traits;
void foo(int value) { }
static if (is(FunctionTypeOf!foo Params == __parameters))
{
void bar(Params params)
{
writefln!"%s, but %s also works??"(value, params);
}
}
void main() { bar(5); }
```
Note how bar, despite taking a tuple called "params", can also access the individual parameter 'value' from foo.
This can cause name collisions when you try to declare a variable called 'value'. Since this is used for metaprogramming, this introduces the risk of name collisions based on parameter names in functions passed to a metaprogramming function, which is quite hard to debug.
Since the parameters are already accessible via 'params', the individual parameters should not also be visible inside 'bar'.
Comment #1 by robert.schadek — 2024-12-13T19:12:19Z