On Tue, 20 Apr 2004, Luke Palmer wrote:
> There.  Now here's the important part: in order to *use* all this, you
> import whatever module defines it, and then say:
>
>     class Dog {
>         method foo (?$arg) is accessor {
>             # accessor code here
>         }
>     }
>
> If that's not easy enough for you, well, you're probably out of luck.

It would be even easier if we could put the read-accessor-code and
write-accessor-code in different methods.

    class Dog {
        multi method foo { ... }
        multi method foo ($arg) is accessor { ... }
    }

With this syntax, either method could be simply be omitted to create a
read-only or write-only accessor.  The tricky part is getting the trait
on foo($) to override foo() correctly.

~ John Williams


Reply via email to