bar($foo, $baz); # looks for subs (lexical then package), and
falls back to MMD
$foo.bar($baz); # looks in ref($foo), then falls back to MMD
If this is correct, can we simplify the latter to mean "MMD only" ?
Would there be a more symmetric MMD only form?
Luke
Er, no.
: $foo.bar($baz); # looks in ref($foo), then falls back to MMD
:
: If this is correct, can we simplify the latter to mean "MMD only" ?
: Would there be a more symmetric MMD only form?
bar($foo, $baz) is the MMD form. However, MMD is defined to pay
attention to lexical scoping, and if the innermost definition of
the sub isn't multi, it reverts to ordinary sub dispatch. If the
innermost definition is multi, then all multies out to a scope
that is not multi are considered.
Basically, all sub calls are inherently MMD, but ordinary subs are
a degenerate wildcard case that hide any outer definitions.
Larry