Thread overview | ||||||
---|---|---|---|---|---|---|
|
August 26, 2022 [Issue 23264] Allow __traits(parameters) in the return type or contract of a function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23264 wolframw <wolframw@protonmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wolframw@protonmail.com --- Comment #1 from wolframw <wolframw@protonmail.com> --- There would be an ambiguity for nested functions: void foo(T1...)(T1 args1) { typeof(__traits(parameters))[0] bar(T2...)(T2 args2) { // ... } } Would the return value of bar depend on foo's or bar's parameters? Currently, it would refer to foo's parameters. -- |
August 29, 2022 [Issue 23264] Allow __traits(parameters) in the return type or contract of a function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23264 --- Comment #2 from Bolpat <qs.il.paperinik@gmail.com> --- (In reply to wolframw from comment #1) > There would be an ambiguity for nested functions: > > void foo(T1...)(T1 args1) > { > typeof(__traits(parameters))[0] bar(T2...)(T2 args2) > { > // ... > } > } > > Would the return value of bar depend on foo's or bar's parameters? Currently, it would refer to foo's parameters. Good catch! I don’t think it’s a big problem. Return types are ambiguous in the same fashion: void f(T)() { T g(T)() { return T.init; } } The `T` value that function `g` returns could – for the uninformed reader – mean f’s type parameter or g’s type parameter (of course, it’s g’s). I see no reason why __traits(parameters) would work any differently. Also, if you wanted the outer function’s parameters, one can alias them. void foo(T1...)(T1 args1) { alias fooParams = typeof(__traits(parameters)); fooParams[0] bar(T2...)(T2 args2) { // ... } } -- |
December 17, 2022 [Issue 23264] Allow __traits(parameters) in the return type or contract of a function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23264 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
December 13 [Issue 23264] Allow __traits(parameters) in the return type or contract of a function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23264 --- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20132 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation