Dan Sugalski wrote: > >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.
The value of the result is actually '3' after reducing, but I'm assuming that a division of a type Complex by a type Complex would assume a result of type Complex, regardless of the actual value. This is why I assumed that the result would be promoted, even if it's not actually necessary. > >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. I have to subscribe to ANOTHER list?!?!? <<grumble>><<grumble>> Actually, maybe if I just post it with a note that I'm not subscribed :-). Grant M.