digitalmars.D.learn - What does dual-context mean?
- wjoe (18/18) Mar 01 2022 Hello,
- Paul Backus (5/7) Mar 01 2022 It means you have a struct or class member function that accesses
- wjoe (3/11) Mar 02 2022 That makes sense. Reading the bug report was really helpful.
Hello,
what's a dual context as in the deprecation message?
```d
struct MockFile {
[...]
void writef(alias fmt, A...)(A args) { // Deprecation: function
'writef': function requires a dual-context, which is deprecated
import std.format: format;
write(format!fmt(args));
}
[...]
}
unittest {
auto f = MockFile();
immutable fmt = "%d";
f.writef!fmt(0); // instatiated from here
}
```
Mar 01 2022
On Tuesday, 1 March 2022 at 14:51:47 UTC, wjoe wrote:Hello, what's a dual context as in the deprecation message?It means you have a struct or class member function that accesses its calling context via a template alias parameter. See this bug report for more information: https://issues.dlang.org/show_bug.cgi?id=5710
Mar 01 2022
On Tuesday, 1 March 2022 at 17:58:24 UTC, Paul Backus wrote:On Tuesday, 1 March 2022 at 14:51:47 UTC, wjoe wrote:That makes sense. Reading the bug report was really helpful. Thanks.Hello, what's a dual context as in the deprecation message?It means you have a struct or class member function that accesses its calling context via a template alias parameter. See this bug report for more information: https://issues.dlang.org/show_bug.cgi?id=5710
Mar 02 2022








wjoe <wjoe example.com>