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

Re: Messing with the type heirarchy

Thread Previous | Thread Next
July 28, 2005 03:39
Re: Messing with the type heirarchy
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About