develooper Front page | perl.perl6.internals | Postings from February 2002

RE: PMCs, setting, and suchlike things

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
February 13, 2002 07:48
Subject:
RE: PMCs, setting, and suchlike things
Message ID:
a05101403b890375c319f@[63.120.19.221]
At 7:16 AM -0800 2/13/02, Wizard wrote:
>  > my Complex $c = 3+4i;
>>  my $plain = 1.1;
>>  $plain = $c;
>
>This might be even more "Complex" than that - what if Complex can be
>reduced? Should it? for instance:
>
>my Complex $c = 3+4i;
>my Complex $d = 4i;
>my $plain = $c / $d;
>
>Does $plain get promoted, or does the result from the division get demoted?

Since $plain's not a fixed scalar type, it should be whatever the 
division of $c and $d produces, presumably a complex number.

>Should parrot bother to even check, or should it just promote automatically
>and let the implementation decide? I think promotion would be best and
>fastest for all circumstances.

I prefer letting the destination decide, with automatic type changing 
as the default. Given the potentially large number of variable types 
that can be created, I can't picture a workable hierarchy that won't 
be restrictive here.

>Perhaps there could be a sort of 'try' for
>conversion that returns the best possible result?

That's an interesting idea. I kind of like it--float it past Larry 
and p6-language and see what happens.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk

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