Possibly relevant StackOverflow question:
"Why does constraining a Perl 6 named parameter to a definite value make it
a required value?"
https://stackoverflow.com/questions/48166325/why-does-constraining-a-perl-6-named-parameter-to-a-definite-value-make-it-a-req
On Mon, Jul 19, 2021 at 10:00 AM P
Matthew has provided some concrete examples of default initializations. I'd
like to scratch the surface of more general problem: encapsulation. In many
cases only a class knows it's real internal structure and can use this
information to protect the data from misuse by 3rd party code which may
In general, the idea of initialized doesn't mean a lot in Raku, at least
not at the language level.
At any given time, any variable has a value. By default, if you've typed a
variable, it's initially set to the type itself (Any is the default type,
so the default default value). The only exception
Yes. I'm agnostic on this point, but there was a time when some
prominent Perl contributors were dogmatic about it and I didn't know how
widespread it was.
Peter
On 7/19/2021 10:06 AM, Vadim Belman wrote:
Let me guess. The school prohibits object self-initialization? It has
to be done by e
Let me guess. The school prohibits object self-initialization? It has to be
done by external code?
Best regards,
Vadim Belman
> On Jul 19, 2021, at 1:00 PM, Peter Scott wrote:
>
> On 7/19/2021 1:24 AM, Elizabeth Mattijsen wrote:
>> If .new wouldn't initialize a type to its basic instantiation
On 7/19/2021 1:24 AM, Elizabeth Mattijsen wrote:
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
> On 19 Jul 2021, at 05:49, Peter Scott 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 u
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 at line