Thanks Moritz,
it just felt like I should be able to leave out the "+ 0i" since that's
how I wrote them when studying maths;)
Thanks for the shiny new toy;)
Regards,
Michael
On 11/08/10 00:59, Moritz Lenz via RT wrote:
On Tue Aug 10 01:28:11 2010, a_...@bigpond.net.au wrote:
my Complex $c = 1;
fails at runtime with the error message
Type check failed for assignment
in '&infix:<=>' at line 1
in main program body at line 13:t.p6
This conforms to the current specification. If you want something that
accepts both Complex and Real numbers, use 'Numeric' as type constraint.
Please notice that numeric type hierarchy in Perl 6 is not based on
subset types (as the mathematical hierarchy is), mostly for performance
reasons.
Note that in order not to surprise the casual programmar, (-1).sqrt
fails, while (-1 + 0i).sqrt returns one of the complex square roots.
The idea is that if you know about Complex numbers, you know what you're
doing.
Cheers,
Moritz