On 14/10/05, Stevan Little <[EMAIL PROTECTED]> wrote:
> So anyway, here are a few ideas, in no particular order:
>
>    method bark (::Dog $d:) { ... }
>    # not sure if this notation is already taken or not
>
>    method bark ($Dog $d:) { ... }
>    # not sure I like this one myself, but to me it helps to re-
> enforce the singleton nature of the class instance
>
>    method bark (Dog) { ... }
>    # this would be similar to functional languages where the
> parameter matches a value, not the type of a value.
>    # The user would then be forced to use $?CLASS inside (this one is
> probably too much B&D)
>
>    classmethod bark { ... }
>    # you can't get more specific than this :)
>
> Okay, thats all for now, however, be on the lookout for some other
> mails on the specifics of class method dispatch. If we are going to
> do it, we need to do it right.

How about:

  method bark (Dog ::K:) { ... }

Where ::K must hold a class that is a subclass of Dog.  Or 'is a
subtype of', or 'does', or whatever the most correct term is in this
context.

(I seem to recall Damian mentioning something like this on the list
somewhere, but I might have misunderstood him and made it up myself.)

I do notice, though, that most of these class-method forms don't stand
out very well--maybe something like 'classmethod' might be best after
all, particularly if class methods aren't heavily used.


Stuart

Reply via email to