🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | 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 8 June 2022.
Xliff Can I reset the current position in a regex? 00:51
Or a grammar?
leont What do you mean with reset? 01:23
Xliff I want to set the regex current position back a few characters after a specific match 01:25
leont I think the answer is yes, but I forgot the details 01:27
I think it involves adding a method that returns a Match whose position is where you want to be, and then calling that as a rule 01:31
But I probably got some detail wrong there
Someone has written a blogpost about this, but I can't find it back 01:32
It may have been www.codesections.com/blog/regex-de...and-trait/ 01:37
Nemokosch Haven't seen codesections around for a while 07:49
do you know anything about him?
lizmat weekly: conf.raku.org/2022/schedule 10:40
notable6 lizmat, Noted! (weekly)
Nemokosch 🥁 10:47
leont For some reason «my sub signal(int32 $signal, long $func) is native { * }» doesn't work on Windows. I'm pretty sure windows has a signal function even if it's only half functional. 11:16
Do I have to use an explicit library for functions from the Universal C Runtime? That would be counter-intuitive. 11:18
lizmat leont: how does Perl handle signal on Windows ? 11:33
leont Though the signal function. I've seen it used. I've seen it documented (docs.microsoft.com/en-us/cpp/c-run...msvc-170). I don't get what I'm doing wrong. 11:38
[Coke] (Terminal spinners) so today I tried again, basically the same code, but with stdout bufferring disabled (which I had it disabled at some point in previous testing), and it seems to JFW. 13:31
[Coke] realizes that "WJF" is a friendly anagram of "JFW" 13:32
[Coke] ends up with a progress bar that he can define chunks of percentages for, and either mark each chunk as done, or set its size and add a count of elements towards that size. so now he has a setup chunk, the main processing chunk, and a finalize chunk, where the middle one has more fine grained control. whee. 14:56
the intermediate info being stored in a simple AoA, but all hidden behind the class so no one has to see me cheating.
Nemokosch PR when? 14:59
[Coke] Is that to me? I'm not going to submit this against Terminal::Spinners - right now it's a wrapper, though I could make it standalone - but also, I developed it on work time for a work project. 15:00
Nemokosch I don't see how that should hold you back tbh 15:05
[Coke] Don't want to violate my employment contract. 15:49
For many folks, if you develop something on work time, without special arrangement, it's the intellectual property of the company. If you then release that software without consent or attribution, you can face legal consequences and/or job termination. 15:50
If this were a big thing, I'd have thought if I wanted it to be OSS before starting and clearing it with legal, or maybe specifically working on this small part off hours.
this is small enough that it's just not worth it.
(conversely: it's also small enough that: would my employer care? probably not. I don't care to find out the hard way) 15:53
Nemokosch flexible working time be like 15:55
[Coke] Yup, could probably argue it. 15:56
[Coke] I have a nested data structure. if one of the points is already a Hash, I can call .push: <some other hash> and it incorporates the hash key/values at the right spot. if the original hash doesn't exist yet and I .push, it autovivifies as an array instead. Is there a one liner to force the .push to autoviv a hash in that case, or do I need to (as I am now) explicitly viv the hash first? 16:57
gfldex [Coke]: did you try a SemiList to be precise about them multi-dim-key? (If I got what you want to do.) 17:11
Voldenet m: my %h; %h<y>.push({a => 2, b => 3, c => 4}); say %h 17:14
camelia {y => [{a => 2, b => 3, c => 4}]}
Voldenet m: my %h; (%h<y> //= {}).push({a => 2, b => 3, c => 4}); say %h 17:15
camelia {y => {a => 2, b => 3, c => 4}}
Voldenet [Coke]: ^
Nahita IIUC (probably not) `@arr[$pos] .= Hash.push: %g;` is my attempt. `@arr[$pos]` could become `%h{$key}`
Voldenet .Hash wil generate new hash every time 17:17
…I think
m: my @d; @d[0].Hash.push({a => 2, b => 3, c => 4}); say @d; 17:18
camelia []
Voldenet m: my @d; (@d[0].=Hash).push({a => 2, b => 3, c => 4}); say @d; 17:19
camelia [{a => 2, b => 3, c => 4}]
Voldenet works
Nahita for `%h`, i get `Hash|140736539238528` when `.WHICH`'ing itself and `.Hash` of it; that means no new hash or does it? 17:20
ok, i tested with `=:=` to get True 17:22
Voldenet .Hash only is simply coercing invocant to hash
s/only/
/
leont Apparently, NativeCall doesn't check if symbols exist until you call them, this is making life more difficult than I had expected 17:24
[Coke] I can't golf this, but I have a loop {}; if an array is empty, I last out of the loop. at the end of the array, I am setting the array to the remaining list of work. With debug output, I am seeing that I set the array to [], zero elements. repeat the loop. somehow this array now has a single Any, in it. wtf. 17:25
aha. Just had to explain it here to see the truth. all set. :P 17:27
(the truth: that loop {} was in a for loop; first time through worked fine, second time through had the weird data, not the first.)
[Coke] MoarVM oops: MVM_str_hash_fetch_nocheck called with a hashtable pointer that turned stale 18:27
reran the program, no error 18:28
lizmat [Coke]: that indicates multi-thread access to a hash to me 19:16
while (at least) one of them is making changes
jdv thats mr clark territorry, no? 19:47
lizmat yeah, Nicholas has done a lot of work in that area 19:49