Note that an object that is a Rat also does Real (see
https://docs.perl6.org/type/Rat#Type_Graph)

say Rat ~~ Real

True

Your're making a box that takes a Real, then putting a Rat (that also
does Real) into that box.

It then says "yes, you've got a Rat in there".



On Sun, Sep 16, 2018 at 9:35 PM ToddAndMargo <toddandma...@zoho.com> wrote:

> On 09/16/2018 05:52 PM, ToddAndMargo wrote:
> > Hi All,
> >
> > I am confused, again:
> >
> >
> > $ p6 'my $x=3; dd $x'
> > Int $x = 3
> > Makes sense
> >
> >
> > $ p6 'my $x; dd $x'
> > Any $x = Any
> > Makes Sense
> >
> > $ p6 'my Real $x; dd $x'
> > Real $x = Real
> > makes sense
> >
> > $ p6 'my Real $x = 3; dd $x'
> > Int $x = 3
> > What ???? Integer ?????  Did I or did I not just tell it
> > is was a "Real" ?????
> >
> > :'(
> >
> > -T
>
>
> The plot thickens:
>
> $ p6 'my Real $x; $x = "abc"; dd $x'
> Type check failed in assignment to $x; expected Real but got Str ("abc")
>    in block <unit> at -e line 1
>
> This is what I expected
>
>
> $ p6 'my Real $x; $x = 3; dd $x; say $x.perl'
> Int $x = 3
> 3
>
> Not what I expected
>
>
> $ p6 'my Real $x; $x = 3.1415; dd $x; say $x.perl'
> Rat $x = 3.1415
> 3.1415
>
> Huh?  Now is it a "Rational number".
>
>
> AAAAAAAAAA HHHHHHHHHHHHH !!!!!!
>

Reply via email to