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

Re: Messing with the type heirarchy

Thread Previous | Thread Next
From:
=?ISO-8859-1?Q?=22TSa_=28Thomas_Sandla=DF=29=22?=
Date:
July 28, 2005 03:39
Subject:
Re: Messing with the type heirarchy
Message ID:
42E8B5DD.8060308@orthogon.com
HaloO Michele,

you wrote:
> On Wed, 27 Jul 2005, [ISO-8859-1] TSa wrote:
> 
>> value to carry on a useless imaginary part. And
>> Complex should consistently return undef when compared
>> to other Nums or Complexes. And the Compare role
> 
> 
> My 0.02+0.01i: in mathematics it is commonly used to write e.g. z<3 to 
> mean "z is real AND as a real number is less than 3".

Which in Perl6 is written as

    Complex where { .imaginary =:= 0|Undef } does Num;

somewhere in the Complex package. This would make your
intensions possible by dispatching to &infix:{'<'}:(Num,Num)
but still preventing the general case.
-- 
$TSa.greeting := "HaloO"; # mind the echo!

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