In this case, the signature constraint on opDispatch could be used for
auto completion:

            auto opDispatch(string field)()
                if (is(typeof(__traits(getMember, t, field))))
                ...

From the signature constraint, it should be obvious that "field" must be
among the members of t.

Of course, checking signature constraints isn't always practical in the general case where it may be arbitrarily complex, but obvious cases like
this one should be easily manageable, no?

In this case auto completion could work flawless because of

alias this t;

At least for cases where even a frontend based tool has a hard time, we could introduce a ddoc section for this, if there really is a need.

/**
 * Dispatch method call.
 * Completion: LIKE t
 */
auto opDispatch(string field)() { ... }

If phobos does this consistently the tools will recognize this.

Reply via email to