in reply to Re^2: Raku: Function Signatures
in thread Raku: Function Signatures

You could also do method bark(Dog:D \dog: Int:D $x) {

Replies are listed 'Best First'.
Re^4: Raku: Function Signatures
by 7stud (Deacon) on Feb 20, 2024 at 00:24 UTC

    That seems like it might be a "good practice"? Renaming self with a constant, sigil-less variable will prevent you from losing your self?

    Well, on the other hand, it looks like $dog is readonly:

    lass Dog { has Str $.name; method bark(Dog:D $dog: Int:D $x) { say $dog.^name; say $dog.name; $dog = 'hello'; say "bark" for 1..$x; } } Dog.new.bark(3); --output:-- Dog (Str) Cannot assign to an immutable value in method bark at b.raku line 19 in block <unit> at b.raku line 24

    So is using a sigil-less variable to capture self more of a style thing? For instance, to make you notice that the variable is different from other variables?