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.
00:02 [Coke]__ left 00:06 [Coke]_ joined 00:22 guifa_ joined 00:24 guifa left 00:31 [Coke]__ joined 00:33 [Coke]_ left 00:59 Oshawott left 01:36 [Coke]__ left 01:38 [Coke] joined 02:08 [Coke]__ joined 02:10 [Coke] left, archenoth joined 02:16 [Coke]_ joined 02:18 [Coke]__ left 02:24 frost joined
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
03:48 [Coke]_ left
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?
03:50 [Coke]_ joined
zacque Ah, I see. I'll play around to see how it works. Thanks! 04:01
05:24 [Coke]___ joined 05:26 [Coke]_ left 05:30 [Coke] joined 05:32 [Coke]___ left 07:01 [Coke]___ joined 07:04 [Coke] left 08:09 dakkar joined 08:11 archenoth left
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
08:38 [Coke] joined 08:40 [Coke]___ left 08:46 [Coke]__ joined 08:47 [Coke] left
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
10:10 archenoth joined 10:16 [Coke] joined 10:18 [Coke]__ left 11:47 frost left 11:53 [Coke]__ joined 11:55 [Coke] left 12:01 [Coke] joined 12:03 [Coke]__ left 12:05 Kaiepi left 12:33 Kaiepi joined 12:58 Kaiepi left 13:46 Kaiepi joined 14:01 discord-raku-bot left, discord-raku-bot joined 14:05 razetime joined 16:36 dakkar left 17:14 razetime left 17:29 jetchisel joined 17:37 polarbearX joined
polarbearX What is right raku's idiomatic way to replace perl' s : while(<>) { s/A/B/ ; ; print } # ? ? ? 17:37
18:11 polarbearX left
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.…
18:23 discord-raku-bot left
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.…
18:23 discord-raku-bot joined 18:27 discord-raku-bot left 18:28 discord-raku-bot joined
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 😄
22:44 _4d47 joined 22:45 _4d47 left