The default type constraint is Mu, with a default of Any (everything
is of type Mu, and most are of type Any)

You shouldn't be able to change the type constraint of a scalar
container (used for rw variables)

Changing the type of a value, of course makes no sense. (a Str is
always a Str, even when you use it as a number)

Basically no you can't change the type, but you didn't do that anyway.

On Wed, Mar 22, 2017 at 12:59 AM, ToddAndMargo <toddandma...@zoho.com> wrote:
> Hi All,
>
> Yes, I know, Perl is "lexiconical".
>
> $ perl6 -e 'my $x="abc"; $x=1E23; print "$x\n";'
> 1e+23
>
> $ perl6 -e 'my Str $x="abc"; $x=1E23; print "$x\n";'
> Type check failed in assignment to $x; expected Str
> but got Num (1e+23) in block <unit> at -e line 1
>
> So, unless I specifically declare a variable as a
> particular type, I can change its "type" on the fly.
> Is that correct?
>
>
> Many thanks,
> -T
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Serious error.
> All shortcuts have disappeared.
> Screen. Mind. Both are blank.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to