>    > Question 2:
>    > 
>    > Afaict, even with use strict at its most strict, perl 6
>    > can't (in practice) complain, at compile time, if
>    > 
>    >         $foo.Foun
>    > 
>    >     refers to an undeclared Foun.
> 
> It could certainly warn you

Consider the code:

    my $foo = 1 is Found;
    &bar($foo);

    sub bar { my $baz = shift; if ($baz.Found) { ...} }

Does the value of $baz have the Found property?

If so, does the compiler know that?


>    > Question 2:
>    > 
>    > Should there be a strict mode that warns if a
>    > method name matches a built in property name?
> 
> Possibly. 
> 
> Of course, the whole point of unifying the method and
> property access syntaxes was to allow exactly those
> kinds of shenanigans. But it might be a Good Thing
> if you had to explicitly turn off such a stricture to shenan
> that way:
> 
>         class FooClass;
>         no strict 'properties';
> 
>         sub const (FooClass $self) {
>                 return $self{const} || $self.prop{const} 
>         }

Yes. That was pretty much exactly what I was thinking.

One of several benefits would be to help deal with the
introduction of new properties in later Perl versions.
When an older class was used with the newer Perl,
conflicting names would immediately break or warn,
which it seems to me would be a Good Thing.

Reply via email to