'Why can't pass a manually created Pair to method without a slip?

:5hours is a Pair, hours => 5 is also a Pair:

> DateTime.now.truncated-to('day').later(:5hours)
2022-02-14T05:00:00+08:00
> :5hours.WHAT
(Pair)

> DateTime.now.truncated-to('day').later(hours => 5)
2022-02-14T05:00:00+08:00
> (hours => 5).WHAT
(Pair)

However, when I create a Pair manually, it doesn't match the signatures of later:

> DateTime.now.truncated-to('day').later(Pair.new('hours', 5))
Cannot resolve caller later(DateTime:D: Pair:D); none of these signatures match:
    (Dateish:D: *%unit --> Dateish:D)
    (Dateish:D: @pairs, *%_)
  in block <unit> at <unknown file> line 1

But use a vertical before the Pair parameter is ok:

> DateTime.now.truncated-to('day').later(|Pair.new('hours', 5))
2022-02-14T05:00:00+08:00

So what's the difference between :5hours, Pair.new('hours', 5) and hours => 5? Why can't pass a manually created Pair such as Pair.new('hours', 5) to later method?

Aren't the following two the same thing, right?

> :5hours === Pair.new('hours', 5) === hours => 5
True
> :5hours eqv Pair.new('hours', 5) eqv hours => 5
True

> my $pair1 = Pair.new('hours', 5); dd $pair1; # Pair $pair1 = :hours(5)
> my $pair2 = :5hours; dd $pair2;              # Pair $pair2 = :hours(5)
> my $pair3 = hours => 5; dd $pair3;           # Pair $pair3 = :hours(5)
> my $pair4 = 'hours' => 5; dd $pair4;         # Pair $pair4 = :hours(5)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source