We have universal function calling syntax, so: instance.method()
is equivalent to Type::method(instance)
. The D language (and to a degree, JS and Python too) goes as far as making all functions equally usable with both syntaxes. IMHO that's pretty elegant.
So I see .
not as related to the type, but as a syntax sugar that moves the first function argument to the prefix position. Macros already pretend to be function-like. Therefore, making macro!(expr)
and expr.macro!()
equal would seem like a logical extension of the function<>method relationship.