OK; let me get a quick clarification here.  How does:

    say "Hello, World!";

differ from:

    "Hello, World!".say;

or:

    say $*OUT: "Hello, World!";

in terms of dispatching?  And more generally, would there be a
reasonable way to write a single routine (i.e., implementation) that
could be invoked by a programmer's choice of these calling
conventions, without redirects (i.e., code blocks devoted to the sole
task of calling another code block)?

Could you use binding?

    my sub say (String *$first, String *...@rest, OStream :$out = $*OUT,
OStream :$err = $*ERR)
        { ... }

    role String {
        has &say:(String $first: String *...@rest, OStream :$out = $*OUT,
OStream :$err = $*ERR)
            := &OUTER::say;
    }

That (or something like it) might be doable.  But in the spirit of
TIMTOWTDI, I'd like to explore another possibility: what difficulties
would arise from allowing subs to have signatures with invocants,
which in turn allow the sub to be called using method-call syntax
(though possibly not method dispatch semantics)?  In effect, allow
some syntactic sugar that allows properly-sigged subs outside of a
role to masquerade as methods of that role.

-- 
Jonathan "Dataweaver" Lang

Reply via email to