extendedMethod

Extends a method to include UFCS functions in the calling context.

When calling an extended method of an object, the following locations are searched, in order, for a method or UFCS function with the given name:

  1. The object itself.
  2. The module where the object's type is defined.
  3. The context module (by default, the module that contains the extended method call).

If no method or function is found, a compile-time error is generated.

template extendedMethod(string method, string context = __MODULE__)
ref
extendedMethod
(
T
Args...
)
(
auto ref T obj
,
auto ref Args args
)

Members

Functions

extendedMethod
auto ref extendedMethod(auto ref T obj, auto ref Args args)

Calls the extended method.

Parameters

method

the name of the method to call

context

the name of the module to search for extended methods

Meta