Thread overview
What does dual-context mean?
Mar 01, 2022
wjoe
Mar 01, 2022
Paul Backus
Mar 02, 2022
wjoe
March 01, 2022

Hello,

what's a dual context as in the deprecation message?

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
}
March 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

March 02, 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:

>

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

That makes sense. Reading the bug report was really helpful.

Thanks.