develooper Front page | perl.perl6.language | Postings from January 2010

Is it 'anon role' but not 'anon enum'? (Re: r29250 - in docs/Perl6/Spec: . S32-setting-library)

Thread Next
From:
Carl Mäsak
Date:
January 8, 2010 15:51
Subject:
Is it 'anon role' but not 'anon enum'? (Re: r29250 - in docs/Perl6/Spec: . S32-setting-library)
Message ID:
16d769b71001081551i7a87ed77vef5d4914219402cd@mail.gmail.com
pugscommitbot, channeling Larry (>):
> [...]
> +    $x = "Today" but Tue;       # $x.Day is read-only
> +    $x = "Today" but Day;       # $x.Day is read-write
> +
> +Mixing in a specific enum object implies only the readonly accessor.
> +
>     $x = "Today" but Tue;
>
> -really means something more like:
> +really means something like:
>
> -    $x = "Today";
> -    $x does Has[Day, '$.Day', (:rw), { Tue }];
> +    $x = "Today".clone;
> +    $x does anon role { method Day { Day::Tue } };
> [...]

I'm not 100% clear on when this 'anon' keyword is to be applied and when not.

Why is it 'anon role' for anonymous roles but not 'anon enum' for
anonymous enumerations?

If 'anon' isn't strictly required before 'enum', is it still allowed?

// Carl

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About