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:15 NemokoschKiwi joined
Mason I was looking for a way to say "something like this" 00:20
not to say "exactly this"
hence using `$0` is better than the workaround I was trying to do
Nemokosch it's just kinda hard to guess what makes pieces of code "alike" 00:21
jaguart any recommends on a javadoc equiv for Raku? 00:30
Nemokosch well... pod6? 00:43
jaguart lol 00:52
does pod6 include basics like signature analysis? 00:53
Nemokosch pod6 is native Raku 01:09
tbh considering that it's literally a documentation format ("plain old documentation"), I rarely hear about it in that context 01:11
01:13 NemokoschKiwi left
jaguart Javadoc is a code-analysis tool that identifies components and interfaces, and generates documentation. Like POD and POD6 a lot of (all?) of the work is manual. TBH I am really looking for something that does the manual bit and leaves me to add the 'why' rather than the 'what'. 01:49
Nemokosch Well, the Comma folks may know something about that. If not, most probably somebody could just go ahead and write something for that. 01:53
jaguart ok - I might start with this: github.com/Altai-man/docs.raku.org - is this the current docs or something new? 01:55
Nemokosch I can only welcome these ideas. I'd say the Raku mainstream doesn't deal a lot with formalized documentation methods or even type signatures. That shows on the doc site as well. At the same time, this is again a very good and imo doable idea. The inspection capabilities of Raku are awesome, sure, why not generate something from it.
This is "something new", actually it's pending on infrastructure, should be deployed as soon as possible. 01:56
jaguart ok - so is this the current: github.com/Raku/doc 01:57
Nemokosch the new site also depends on content from the doc repo
github.com/Raku/Documentable and this is the API that turns the documentation files into something digestable 01:58
jaguart nice - thanks for that :) 01:59
Nemokosch Having said that, I think this all relies on hand-written pod content 02:00
jaguart yah lol
Nemokosch github.com/raku-community-modules/...s-Sourcery something that might be interesting regarding introspection capabilities
you can give it a subroutine or a method call and it can point to the code that backs it up in Rakudo 02:01
jaguart TBH JavaDoc only has some introspection - same weakness
Nemokosch raku.land/zef:lizmat/sourcery 02:02
liz created a general-purpose version on any local codebase; I have to admit I haven't taken the effort to actually understand how to use it
the original sourcery is a big favorite of mine though so knowing liz, the general variant can be pretty badass 02:03
jaguart disappears down a magic rabbit hole 02:04
I always knew lizmat was magic
Mason is it possible to dispatch multis off of regexs? 02:47
``` 02:48
multi method sim (/^'v '(\w+)/, *@b) { @.l.push($0) }
multi method sim ('v %%', *@b) { @.l.pop() }
multi method sim ('v !', *@b) { @.l = ("",) }
```
notably that first one
Nemokosch I doubt it works like this, however a `where` clause might suffixe 02:50
I doubt it works like this, however a `where` clause might suffice
$blah where /^'v '(\w+)/
02:50 razetime joined
Mason works great 02:51
Nemokosch even with the regex literal or with the where clause?
Mason the where clause a syou wrote it 02:52
the where clause as you wrote it
Nemokosch nice - what I wasn't sure of is the precedence of multi candidates 02:53
that's a bit obscure
Mason ach well I'm not there yet
will know in a min
04:55 Heptite left 05:08 ToddAndMargo joined
ToddAndMargo On my sub declarations, I like to use "returns" 05:08
    sub abc() returns Str {...}
because it makes the sub easier to figure out at a glance when I go to maintain it.
Two exports I have not figured out are
   1) an array,
   2) an object created from a custom class.
jaguart maybe you mean: sub abc() returns Array {...} 05:09
maybe you mean: sub abc() returns MyCustomClass {...}
ToddAndMargo that was right under my nose! 05:12
[1] sub abc() returns Array { my @x = (0x44, 0x55); return @x;}
&abc
[2] > say abc
[68 85]
thank you!
jaguart m: sub abc() returns Array { my @x = (0x44, 0x55); return @x;}; say abc() 05:13
camelia [68 85]
jaguart Note this: docs.raku.org/type/Signature#index...type_arrow 05:14
m: sub abc( --> Array ) { my @x = (0x44, 0x55); return @x;}; say abc()
camelia [68 85]
jaguart IMHO it's nice sugar because your signature is all inside the brackets - i.e. ( Int $a, Str $y --> Array ) 05:15
ToddAndMargo Love it!  Thank you! 05:17
05:18 ToddAndMargo left
jaguart beginner inheritance question: in a subclass, how to I set default values for parent-classes attributes? 06:32
m: class A { has $.foo; }; class B is A { submethod TWEAK ( :$foo = 'baa' ) { } }; say B.new.foo;
camelia (Any)
jaguart so that B.ff is 'baa'
kjp $!foo = 'baa' ? 06:33
jaguart knows he's going to have to slap his head, doh
m: class A { has $.foo; }; class B is A { submethod TWEAK () { $!foo='baa';} }; say B.new.foo; 06:35
camelia ===SORRY!=== Error while compiling <tmp>
Attribute $!foo not declared in class B
at <tmp>:1
------> A { submethod TWEAK () { $!foo='baa';} }⏏; say B.new.foo;
expecting any of:
horizontal whitespace
postfi…
jaguart You cant reach your super's attributes directly (and rightly so), I really just want a build-args and cascade UP 06:36
and I dont want to modfify the parent class to make the attribute rw 06:37
m: class A { has $.foo; }; class B is A { multi method new ( *%attr ) { %attr<foo> = 'baa'; self.bless( |%attr ) } }; say B.new.foo; 06:53
camelia baa
jaguart that was harder to work out than I though :o 06:54
I often (sometimes) wish for simpler examples in the documentation, I do read it a lot, and spot occasional grammar errors. If one of the doc-gods is listening, and feels like a quick mentor session on the process, I would be keen on patching docs. 07:05
07:30 razetime_ joined 08:25 avuserow joined
Nemokosch "God" might be an overstatement but what is your wish? 08:45
08:54 razetime_ left 09:10 dakkar joined
guifa jaguart: ti's a semi-known issue, because we have a bimodal distribution of users: extremely experienced, and beginners. There's not a whole lot of people in the middle, who tend to be better about not over complicating examples 12:22
13:39 frost joined 13:54 frost left 15:37 Heptite joined 16:04 NemokoschKiwi joined 16:06 NemokoschKiwi left 16:24 Kaiepi left 16:31 Kaiepi joined 17:30 dakkar left 18:19 razetime left
yabobay m: 20:42
```
my $x = (1, 2, 3);
.say for $x;
```
m:
my $x = (1, 2, 3);
.say for $x;
why isn't it printing each element in a new line?
ohhh i realised 20:46
wrong sigil
Nemokosch accurate 21:13