Say I have a class method in FooClass, callable as FooClass.greet():

     method greet(Class $class: ) {
        say "Hello, FooClass!";

AFAIK, this is the only signature that would work for making &greet a
class method; but note that I'm not using $class, and I'd expect the
compiler to issue a warning in such a case.

The same problem exists with methods in classes fulfilling a role,
but which want to ignore a parameter in a required method.

What do you say about this proposed syntax?

     method greet(Class undef: ) { ... }

     # the interface calls for a "floor" as 1st arg
         method bereaucracy(Int undef, Int $office_number) { ... }

I'm not sure how this works for named fields, but for positional ones
it should do well, and is similar to ($a, undef, $c) = LIST syntax.


Reply via email to