> On 19 Jul 2021, at 05:49, Peter Scott <pe...@psdt.com> wrote: > > I'm curious as to why Rat.new initializes instead of leaving as undefined: > > > $*RAKU > Raku (6.d) > > my Rat $p > (Rat) > > put $p > Use of uninitialized value $p of type Rat in string context. > Methods .^name, .raku, .gist, or .say can be used to stringify it to > something meaningful. > in block <unit> at <unknown file> line 1 > > my $q = Rat.new > 0 > > put $q > 0
If .new wouldn't initialize a type to its basic instantiation, what would be the point of .new then? FWIW, the same goes for: dd Int.new; # 0 dd Num.new; # 0e0 dd Complex.new; # <0+0i> dd Str.new; # "" If you want to leave it undefined, don't call .new on it? *confused*