🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:06 lizmat_ left 00:07 lizmat joined 00:09 wbooze joined 00:16 wbooze left 00:30 Guest69 left 00:58 yewscion_ joined 01:03 yewscion_ left 01:34 yewscion_ joined
sdomi likely stupid question: how do I iterate over `Buf[uint8]<>`? i can't find a length method for it and naively throwing it onto a for doesn't do what i'd expect 01:34
hm, i guess turning it into a list and iterating over that works. still would like to hear how it is supposed to be done :) 01:36
[Coke] sdomi: .elems? 01:39
er, .elems is the lenth
length
01:39 yewscion_ left
sdomi still useful, missed that 01:39
currently i'm doing `for $payload.list -> $item {` 01:40
where $payload is the buf
[Coke] but yes, .list is fine for iterating there. 01:41
m: my $d = Buf.new(1, 2, 3); .say for $d.list 01:42
camelia 1
2
3
[Coke] m: my $d = Buf.new(1, 2, 3); .say for $d # not iterable this way 01:43
camelia Buf:0x<01 02 03>
sdomi kinda painful how most things I search for on the docs page point to the "Perl to Raku" guide which is less than helpful at times 01:50
like, searching for a list of logical operators, I find entries for "C-style Logical {And,Or}" and both of those just say Unchanged :p 01:51
[Coke] feel free to point out indiiviudal cases here or on a ticket that we can improve, sorry anout that. 01:52
01:54 yewscion_ joined
sdomi no worries, i'm just struggling a bit with figuring out really basic stuff. curse of doing something for the 1st time 01:56
02:04 yewscion_ left
sdomi tangentically related to the previous thing: how do you take a slice from a buf? given `Buf[uint8]0x<7f ff 00 00>`, i would like to access the 1st two bytes as one 16-bit number (0x7fff) 02:05
currently i'm doing `my $payload = bread($payload_length[0]*256 + $payload_length[1]);` which, I think, is atrocious 02:06
02:06 hulk joined, kylese left
[Coke] docs.raku.org/type/Buf#method_splice 02:13
that'll get you the two elements
[+] $payload_length.splice(0,2) Z* (256,1) 02:15
my $payload = [+] $payload_length.splice(0,2) Z* (256,1) 02:16
You can make the 256,1 more clever if you need it to be dynamic 02:17
that grabs the first 2 elems, multiples each by the corresponding factor in the 2nd list, then sums the resulting list.
prefix [+] is same as (...).sum 02:18
02:29 Aedil joined
kjp sdomi - you might like to check read-int16 and its friends 02:30
sdomi kjp: i've seen the read-int* but I was looking for a more general way to slice those. that 2 bytes were just an example :) 02:31
[Coke]: a bit messy but nicer than what I did 02:32
i suppose that .splice() is good for actual splicing, and if possible i should stick to the read-int*
02:44 apac left
[Coke] oops. even better, I was still doing it the hard way. :) 02:47
02:49 yewscion_ joined 02:54 yewscion_ left
sdomi heading off, didn't get as much done today as i wanted but. welp. 02:54
thanks for all the responses, it is really appreciated!!
03:00 swaggboi left 03:02 swaggboi joined 03:09 maylay left 03:12 maylay joined 03:15 hulk left, kylese joined
ugexe subbuf 03:48
docs.raku.org/routine/subbuf 03:50
There is also subbuf-rw
04:30 kylese left 04:32 kylese joined 05:23 Aedil left 05:30 kylese left, kylese joined, Aedil joined
Voldenet SmokeMachine: cool article, `My goal here is to give experienced Raku developers a clear picture of where Red is headed` - here is not needed, `your queries will behave in a more predictable manner.` `your queries will be more predictable` 06:14
no typos though, just minor edits 06:15
sdomi: more perl way of iterating would be `my $d = Buf.new(1, 2, 3); .say for @$d` 06:18
though I'd prefer just using array
m: my @d := Buf.new(1, 2, 3); .say for @d 06:19
camelia 1
2
3
Voldenet notice the := operator, but it's more idiomatic overall 06:20
thanks to that, @d is still Buf, otherwise it'd still be Array with one Buf element 06:26
06:54 maylay left 06:57 maylay joined 07:19 lichtkind joined 07:32 Sgeo left 08:09 sena_kun joined 08:14 maylay left 08:17 maylay joined
SmokeMachine Voldenet: very good points, thanks! Changed. 08:39
08:56 dakkar joined 09:07 jpn joined 09:25 synthmeat left, synthmeat joined 09:36 yewscion_ joined 09:44 sena_kun left 09:45 yewscion_ left 09:46 sena_kun joined 09:49 apac joined 09:51 sena_kun left 09:58 apac left, jpn left 10:03 jpn joined 10:27 apac joined 10:30 yewscion_ joined 10:36 yewscion_ left 10:45 apac left 11:03 Voldenet left, Voldenet joined 11:05 wbooze joined 12:35 jpn left 12:52 JimmyZhuo joined 13:20 JimmyZhuo left 13:29 yewscion_ joined 14:31 jpn joined 14:36 jpn left 14:39 jpn joined 16:05 apac joined 16:10 jgaz joined 16:39 wbooze left 16:58 apac left 17:03 yewscion_ left 17:05 apac joined 17:11 yewscion_ joined 17:36 yewscion_ left 17:42 dakkar left 17:49 apac left 17:51 yewscion_ joined
lizmat PSA: the weekly will be published tomorrow 18:47
[Coke] lizmat++
18:48 sena_kun joined 19:48 habere-et-disper joined 19:50 jpn left 20:01 apac joined 20:14 habere-et-disper left
coleman I am aware that Raku docs are down. failing over DNS now 20:16
20:21 melezhik joined
melezhik .tell grondilu: Chess build is not ok - sparky.sparrowhub.io/report/grondi...hess/24297 , you need to add dependency ? 20:21
tellable6 melezhik, I'll pass your message to grondilu
20:26 melezhik left
grondilu hi 20:37
tellable6 2025-03-22T10:15:09Z #raku <melezhik.> grondilu: are you interest in sparky badge for your Chess module ?
2025-03-24T20:21:38Z #raku <melezhik> grondilu: Chess build is not ok - sparky.sparrowhub.io/report/grondi...hess/24297 , you need to add dependency ?
grondilu tell melezhik: I'm working on this module these days. I admit I am not very careful about the tests passing before pushing. 20:38
Anyways, I'm here to ask about this:
m: class A { method !foo { "bar" }; class B { method x { A.new!foo } }; method y { B.new.x } };
camelia ===SORRY!=== Error while compiling <tmp>
No such private method '!foo' for invocant of type 'A::B'
at <tmp>:1
------> o { "bar" }; class B { method x { A.new!<HERE>foo } }; method y { B.new.x } };
grondilu ^is this specced behavior?
20:39 yewscion_ left
grondilu I mean class B is in class A, should'nt it be allowed to access its private methods? 20:39
besides it's weird that raku thinks !foo was invoked by an instance of A::B, not A. 20:40
m: class A { method !foo { "bar" }; class B { method x { A.new!foo } } }; 20:41
camelia ===SORRY!=== Error while compiling <tmp>
No such private method '!foo' for invocant of type 'A::B'
at <tmp>:1
------> o { "bar" }; class B { method x { A.new!<HERE>foo } } };
grondilu in the docs, it is said : "Methods with an exclamation mark ! before the method name are not callable from anywhere outside the defining class; such methods are private in the sense that they are not visible from outside the class that declares them." To me that could mean a class could access the private methods of an outer class it is defined in. 20:42
20:47 yewscion_ joined
grondilu .tell melezhik: I'm working on this module these days. I admit I am not very careful about the tests passing before pushing. 20:48
tellable6 grondilu, I'll pass your message to melezhik 20:49
20:54 yewscion_ left
melezhik. grondilu: that’s ok, asked just in case ) 21:10
tellable6 2025-03-24T20:48:59Z #raku <grondilu> melezhik: I'm working on this module these days. I admit I am not very careful about the tests passing before pushing.
librasteve grondilu: I would be inclined to trust the code over the docs - seems like private method scoping is not lexical in nature, but rather installs the symbol privately in the class period - can't say I'd be too bothered one way or another, but perhaps you should raise an issue on the docs site 21:21
oh - just read to the bottom of the docs, where it states "Private methods are not inherited by subclasses." --- guess that part is correct ;-) 21:24
21:32 jgaz left 21:39 Aedil left 21:45 yewscion_ joined
jdv [Coke]: did you commit a "YYYY.MM.md"? 21:47
21:52 yewscion_ left 22:03 Sgeo joined 22:10 habere-et-disper joined 22:46 habere-et-disper left 22:49 lichtkind left 23:06 sdomi left 23:07 sdomi joined 23:13 maylay left 23:15 maylay joined
[Coke] *sigh* yes 23:17
In my defense I did also commit the correct 2025.03.md :) 23:18
Probably a cut and paste o that I noticed but failed to revert.
wow, so this going smoother was just me screwing up less important things, yeesh 23:19
(noticed because I did make the right one) 23:21
23:36 sena_kun left 23:43 sdomi left, Dominika joined