On Mon, 02 Oct 2017 18:09:45 -0700, alex.jakime...@gmail.com wrote:
> Right, because it's a Rat.
> 
> sub foo(num64 $scale = 1.0) {}; say foo # This type cannot unbox to a
> native
> number: P6opaque, Rat
> sub foo(num64 $scale = 1.0.Num) {}; say foo # Nil
> 
No need for .Num, just write it as 1e0 so it's a Num literal.

> I don't know what is the consensus on this one, but having to .Num
> your values
> is rather reasonable.
> 
The rule is simple: types in Perl 6 are constraints. We do go as far as letting 
literals play the role of both a native and a boxed (int/Int, num/Num), but no 
further.

> The error message is LTA though.
> 
What would you like it to say? It seems to contain all relevant information we 
can reasonably provide in a runtime error (what we tried to unbox it to, and 
what type it was); the mention of P6opauqe could go away, though, as it doesn't 
really add anything.

Reply via email to