The code tried to do the same with `dd` as with `say`. There are two differences:

 * `dd`, as a kind of debug tool, doesn't assign any special meaning to
   named arguments so it's more than willing to give a Pair back with a
   colon syntax representation even if was understood as a named argument.
 * there is no `dd` method. I think nowhere in the core but at least
   not in the interface of a Pair.

By the way, I don't think the underscore has any special significance in these examples. It would be all the same with `:foobar`, `dd :foobar`, `dd foobar`, `dd :foobar:`

Hope this helps ^^

On 2023. 09. 26. 23:02, William Michels wrote:
Hi Marton, Thanks for the reply.

Below last example (in the REPL), does `dd` not work on Pairs?
Or is this Indirect Object Notation at work?


[3] > :_
_ => True
[4] > dd :_
:_
Nil
[5] > dd _
===SORRY!=== Error while compiling:
Undeclared name:
    _ used at line 1

[5] > dd :_:
No such method 'dd' for invocant of type 'Pair'
  in block <unit> at <unknown file> line 1




On Sep 24, 2023, at 23:40, Polgár Márton <polgar.mar...@windowslive.com> wrote:

Hi Bill,

:_ is a Pair with the colon syntax that stands for "_" => True. In the first case, it got passed as a named argument and say ignored it. The second case was a method call using the colon syntax - the syntax lizmat challenged not so long ago. https://github.com/Raku/problem-solving/issues/384 so, ultimately, it was (:_).say, a normal say method call on a Pair.

Cheers



A(z) Galaxy eszközömről küldve



-------- Eredeti üzenet --------
Feladó: William Michels <w...@caa.columbia.edu>
Dátum: 2023. 09. 25. 7:15 (GMT+01:00)
Címzett: perl6-users <perl6-us...@perl.org>
Tárgy: What does `:_` and/or `:_:` signify?

Hello,

While playing around in an attempt to define new operators, I stumbled upon some curious results.

In the REPL, trying `say :_` returns a blank line.

In the REPL, trying `say :_:` returns `_ => True`.

What is the meaning of this?

admin@mbp ~ % raku
Welcome to Rakudo™ v2023.05.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2023.05.

To exit type 'exit' or '^D'
[0] > say _
===SORRY!=== Error while compiling:
Undeclared name:
    _ used at line 1

[0] > say :_

[0] > say :_:
_ => True
[0] >

Reply via email to