[06:42] <lizmat> it shouldn't

[06:42] <lizmat> m: my num $a = 42

[06:42] <camelia> rakudo-moar e78c5a7e6: OUTPUT: «===SORRY!=== Error while compiling <tmp>␤Cannot assign a literal of type Int (42) to a native variable ($a) of␤type num. You can declare the variable to be of type Real, or try to␤coerce the value with 42.Num or Num(42).␤at <tmp>:1␤------> m…»

[08:42] *** finanalyst left
[10:51] *** guifa_ left
[10:51] *** guifa joined
[12:43] <ugexe> Then why does the first example work 

[12:48] <lizmat> m: my int $a = 42; my num $b = $a; dd $b

[12:48] <camelia> rakudo-moar e78c5a7e6: OUTPUT: «42e0␤»

[12:48] <lizmat> native values auto-coerce

[12:48] <lizmat> m: my int $a = 42; my str $b = $a; dd $b

[12:48] <camelia> rakudo-moar e78c5a7e6: OUTPUT: «"42"␤»

[12:49] <lizmat> I guess the problem is that even though we have a --> int in the signature, the codegen of the call upgrades the value to Int nonetheless  :-(

[13:25] *** librasteve_ joined
[15:35] *** librasteve_ left
[15:52] <lizmat> ugexe: also, it looks like the optimizer makes that work:

[15:52] <lizmat> $ raku --optimize=off -e 'my int $a = 42; my num $b = $a * $a; say $b'

[15:52] <lizmat> This type cannot unbox to a native number: P6opaque, Int

[15:53] <ugexe> right

[15:53] <lizmat> the optimizer changes that to an nqp::mul_i

[15:53] <ugexe> i actually have a branch that fixes that example. which led me to implement constant folding. which means i have to implement an optimization stage to put it in

[16:18] <ugexe> https://github.com/rakudo/rakudo/blob/e78c5a7e672786e5ae658a50cda8515798b04ea9/src/Raku/ast/README.md?plain=1#L29 i guess we are here

[16:19] <ugexe> although blin the ecosystem should probably be above that 

[16:19] <lizmat> yeah...  

[16:19] <lizmat> but still!

[16:53] *** sjn left
[18:56] *** librasteve_ joined
[21:34] *** Geth left
[21:55] *** RakuIRCLogger left
[22:31] *** Geth joined
