develooper Front page | perl.perl5.porters | Postings from May 2000

Re: overloading = [a solution]

Thread Previous | Thread Next
From:
Ilya Zakharevich
Date:
May 5, 2000 16:27
Subject:
Re: overloading = [a solution]
Message ID:
20000505192732.A679@monk.mps.ohio-state.edu
On Sat, May 06, 2000 at 08:58:11AM +1000, Damian Conway wrote:
>    > See also
>    > 
>    >   my Dog $snoopy;
>    > 
>    > and PREPARE method.
> 
> This is orthogonal to typed lexicals.

But not orthogonal to PREPARE.

> In fact, there's no reason you couldn't:
> 
> 	classify my Dog $snoopy => 'Pilot';
> 
> Typed lexicals aren't enough on their own. Specifically, they won't stop
> type-incompatible assignments that introduce subtle bugs:
> 
> 	my Dog $snoopy;

PREPARE ties $snoopy to Dog::Tie...

> 	$snoopy = Alligator->new();

Dog::Tie::STORE catches the problem.

Ilya

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