16 вер. 2018 р. о 22:11 Curt Tilmes <c...@tilmes.org <mailto:c...@tilmes.org>> написав(ла):

It isn't changing anything.

You've still got a box ('container') that can only hold something 'Real'.

You just happen to have a value in that box that is a 'Rat'.

It is perfectly fine to put a Rat value in a Real box, because a Rat is also a Real (does the 'Real' role).

You can still stick some other Real in the box, and you still can't stick anything that isn't a Real in the box.



On Sun, Sep 16, 2018 at 10:07 PM ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote:

    On 09/16/2018 06:50 PM, Curt Tilmes wrote:
    > 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".
    >
    >

    Why is it changing thing on the fly when I tell it not to?
    I claim foul !!!!!!    AAAAAA HHHHHHH !!!


Best regards,
Vadim Belman


On 09/16/2018 07:18 PM, Vadim Belman wrote:
I would add on top of Curt's explanation. Try assigning Nil to $x and then ask for its type. You'll get your Real back!




I am see it but I am not seeing your point:

$ p6 'my Real $x= Nil; dd $x;'
Real $x = Real

$ p6 'my Real $x= Nil; $x = 3.1415; dd $x;'
Rat $x = 3.1415

Why is it changing the type on the fly after
I defined it?

Reply via email to