develooper Front page | perl.perl6.language | Postings from March 2005

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

Thread Previous | Thread Next
Luke Palmer
March 30, 2005 14:12
Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?
Message ID:
Aaron Sherman writes:
> On Wed, 2005-03-30 at 13:53, Luke Palmer wrote:
> >     class CodeProxy {
> >         has Code $.code is rw;
> >         sub call ($a) {
> >             $.code($a);
> >         }
> >     }
> > This is valid Perl 6, and anyone who says otherwise (because of type
> > signatures) is changing the Perl philosophy too much to be taken
> > seriously.  Now, tell me at compile time whether the call inside `call`
> > is valid.
> It's valid because it's a function call on a code ref. In that case, the
> compiler has to hand your request off to the run-time to check the
> vtable of $.code. Clearly that's a special case. I may have missed
> context at the start, but are we worried about the special cases or the
> general case or the implications to the general case of the special
> cases?

Okay, now we're starting to talk past each other.  I /think/ Thomas
orignially suggested that we use type inference to determine whether to
lvalue cast an argument or not, which is what I got all worked up about.
I'm saying that you can't determine that kind of thing in general at
compile time.  I'm all for an optional strong type system, as long as it
remains optional and mixable (so static things and dynamic things can
play nicely together, whether the module is static and the user dynamic
or vice-versa).  


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About