Rules / Types, classes & roles / basic

ValueObjAt Reference

Unique identification for value types

What it is #

Examples, run three ways #

Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.

1 all-differ · 3 no-output · 1 rakupp-differs

class ValueObjAt is ObjAt { }

Not executed: the documentation states no expected output for this example.

my %h = a => 42;    # mutable Hash
say %h.WHICH.raku;  # OUTPUT: «ObjAt.new("Hash|2972851925856")␤»
Documentation
ObjAt.new("Hash|2972851925856")
Rakudo
ObjAt.new("Hash|3394746283808")
Raku++
"Hash|a\t42"

All three differ. Needs a human.

Not yet examined. Which of these is correct has not been established — do not treat either engine as settled here.

my $date = Date.new(2025,7,20);  # immutable Date
say $date.WHICH.raku;            # OUTPUT: «ValueObjAt.new("Date|60876")␤»
Documentation
ValueObjAt.new("Date|60876")
Rakudo
ValueObjAt.new("Date|60876")
Raku++
"Date|2025-07-20"

Raku++ disagrees with both the documentation and Rakudo — a defect.

class YourClass {
    has $.foo;  # note these are not mutable
    has $.bar;

Not executed: the documentation states no expected output for this example.

    method WHICH() {
        ValueObjAt.new("YourClass|$!foo|$!bar");
    }
}

Not executed: the documentation states no expected output for this example.