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
From:
chromatic
Date:
March 30, 2005 15:48
Subject:
Re: Parameter and trait questions - just how 'only' _is_'read-only'?
Message ID:
1112226490.28739.72.camel@localhost
On Wed, 2005-03-30 at 18:35 -0500, Aaron Sherman wrote:

> When the Perl 6 compiler sees:
> 
>         my X $a;
>         $a.m(1);
> 
> What should it do?
> 
> Options:
> 
>       * Accept the method call regardless of the definition of X
>       * Accept the method call if it matches the signature from X
>       * Accept the method call if {magic($*INTERP)}

That's a fair question, but I think you're leaving out several important
pieces of information:

	* Where does $a come from?  (As far as I see, it's just an
uninteresting undef here, but I don't know if that's the point of the
code.)
	* At what point in the program are you asking what the compiler sees?
	* Where's the definition of X in relation to this code?
	* What pragmas are in effect here?
	* What other code may have altered the type definition of X or undef?

I don't think anyone can answer your question well without assuming some
answers to my questions.

-- c


Thread Previous | 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