develooper Front page | perl.perl6.users | Postings from July 2021

Why does .new initialize?

Thread Next
From:
Peter Scott
Date:
July 19, 2021 03:49
Subject:
Why does .new initialize?
Message ID:
a7b34193-9094-fd8d-2acc-03260a81a544@psdt.com
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

----
Peter Scott

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About