On 09/14/2018 08:07 PM, ToddAndMargo wrote:
":D"
means it wants actual data in the string and not a Nil.
The jargon for this requirement is that is is constrained
to an actual value
If it wanted a Nil, it would say ":U" or constrained to
a Nil
Iteration 3:
":D"
means it wants the variable "Defined" (Constrained).
For example:
my Str $x;
my Int $i;
The value of the variable may be empty but the variable
does not become "defined" until a value is places in it.
("Nil" is seen as "Undefined")
":U"
means the variable is "Undefined" (defaults to type "Any")
For example:
my $x;
my $i;
$ p6 'my $x; if $x.defined {say "Defined"}else{say "Undefined"};'
Undefined
$ p6 'my Real $x; if $x.defined {say "Defined"}else{say "Undefined"};'
Undefined
$ p6 'my Real $x=3; if $x.defined {say "Defined"}else{say "Undefined"};'
Defined
$ p6 'my $x=3; if $x.defined {say "Defined"}else{say "Undefined"};'
Defined
$ p6 'my $x=3; dd $x'
Int $x = 3
$ p6 'my $x; dd $x'
Any $x = Any
$ p6 'my Real $x; dd $x'
Real $x = Real
$ p6 'my Real $x = 3; dd $x'
Int $x = 3
Huh ??????