Yuval Kogman wrote:
Since CANDO is a multimethod, IMHO this can be safely extended to
allow:

        $object.can(Class);
        $object.can(Role);

to better support duck typing.

Why would you not use .does or .isa there? Are you wanting this to go through all of the Class/Role's methods and check that the $object.can() them?

I think that perhaps .can($Method) (where $Method.isa(Meta::Method)) would be acceptable, then .can(Role) can either be defined to be .can(all(Role.get_methods)), or we just leave the user to use that snippet - after all, such extreme duck typing is expensive and shouldn't be huffmanised overly IMHO. We want people to use the Role objects unless they have a really good reason, and besides you can always just wrap things up in a Facade if you have to.

Sam.

Reply via email to