On 2019-12-31 01:17, Todd Chester via perl6-users wrote:
On 2019-12-30 23:14, Veesh Goldman wrote:
Method declares a method as opposed to a function. The difference is
that in a method, the first argument passed to the function is bound
to `self`, which represents the object the call was made on.
In traditional perl style, when you call a method on an object
`your.face('scrambled eggs')`, it actually calls `face(your,
'scrambled eggs')`. At least that's the semantics in Perl.
Hi Veesh,
I spaced on method for a moment. I use them all
the time. I don't think I had ever seen their
definitions written and thought I was looking
at something new. Doesn't help that I can't write one
myself.
Thank you!
-T
Hi Veesh,
This is the way I am use to seeing methods:
multi method contains(Str:D: Cool:D $needle --> Bool:D)
This way made me space and think I was dealing with
something else.
method query(Str $stmt) { Foo_query(self, $stmt); }
-T