This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
zacque Hi, what does the `\SELF:` stands for in the doc: `multi method map(\SELF: █; :$label, :$item)`? Where can I look it up? 03:22
MasterDuke that's the invocant 03:27
zacque Thanks, can you elaborate further what it does? I've searched and read through the docs but still couldn't figure out what `\SELF:` meant 03:40
elcaro By default, the invocant of a method is `self` and you don't need to declare it... but you can if you like, eg. 03:41
```
has $.attribute;
method (\this: $arg) { this.attribute + $arg }
```
you could say... all methods have an implicit first argument of `\self:` 03:42
I guess docs are referring to this multi here 03:49
github.com/rakudo/rakudo/blob/af31...s.pm6#L913
What I don't know... is why the named invocant `SELF` is used here, instead of relying on the default `self`.
... but I'm sure there's probably a reason why. Maybe some underlying reason because it's passing the invocant to another function?
zacque Ah, I see. I'll play around to see how it works. Thanks! 04:01
lizmat elcaro: "self" is always decontainerized 08:32
by specifying an explicit invocant with \, e.g. \SELF you get the invocant that is *not* decontainerized 08:33
m: class A { method b(\SELF:) { SELF = 42 } }; my $b = A.new; dd $b; $b.b; dd $b 08:34
camelia A $b = A.new
Int $b = 42
lizmat ^^ a weird example, but I hope it gets the message across :-) 08:35
Nemokosch lizmat: how can you specify "always decont" in general? 08:51
lizmat well, that's the default when passing parameters 08:52
so you don't have to
Nemokosch So $param? Because @param is kinda tricky again. 08:58
lizmat yeah 09:03
zacque lizmat: I see, thanks for the example! 09:22
guifa_ a few reasons to note use self: (1) you'll be inserting an anonymous method some that requires use of self. One of the two will need to have a different name given. (2) you want to make the object mutable, e.g. method foo ($self is rw:) { $self = somethingTotallyDifferent } 10:02
that latter one is ALSO a way to check if an object is in a writable container. You can multi with a plain method and the is rw will be called if writable, and the plain one if not. 10:03
polarbearX What is right raku's idiomatic way to replace perl' s : while(<>) { s/A/B/ ; ; print } # ? ? ? 17:37
lizmat I'd say: 18:23
m: .subst(/A/, "B").say for lines
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Bm Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
lizmat m: .subst(/W/, "B").say for lines 18:23
camelia »Bann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
lakmatiol sth like 21:09
```
print S/A/B/ for lines
``` should work
sth like 21:11
```
put S/A/B/ for lines
``` should work
Kaiepi it does, just i'm surprised `$_` is mutable
Nemokosch $_ is raw by default iirc 21:13
so it really aliases what it refers to
Kaiepi yeah 21:15
there's a container involved somewhere
not sure it hurts in this case
Nemokosch what are you referring to, by the way?
Kaiepi the `S/A/B/` part in particular 21:19
which doesn't seem to assign
which doesn't seem to reassign
so it's w/e
Nemokosch that's right, uppercase S doesn't mutate
Kaiepi oh UPPERCASE
i got them reversed
paranoid about containers from lists ig 21:21
Nemokosch oh okay 😄