🦋 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:23 arkiuat joined 00:28 arkiuat left 00:46 markong left 00:52 deoac left 00:53 arkiuat joined 00:59 arkiuat left 01:24 arkiuat joined 01:28 arkiuat left 01:41 kylese left, kylese joined 01:58 arkiuat joined 02:03 arkiuat left 02:15 kylese left, kylese joined 02:25 arkiuat joined 02:30 arkiuat left 02:48 arkiuat joined 02:53 arkiuat left 03:28 arkiuat joined 03:30 lichtkind_ joined 03:33 lichtkind left 03:37 arkiuat left 03:45 kylese left 03:46 arkiuat joined 03:47 guifa left 03:48 kylese joined
Voldenet hm, one link in weekly (to htmx-ws) doesn't work: dev.to/fco/cromponent-new-features-3bhf 04:14
well, not in weekly, but in blog that weekly links to 04:16
SmokeMachine: link to htmx-ws is wrong in dev.to/fco/cromponent-new-features-3bhf
05:32 Aedil joined 06:30 Sgeo left 06:41 oodani left 06:42 oodani joined
SmokeMachine Voldenet: thanks for letting me know! Fixed! 07:00
07:26 lichtkind joined 07:28 lichtkind left 07:30 jjido joined 07:35 Guest86 joined 07:42 arkiuat left 07:58 wayland joined 08:01 arkiuat joined 08:05 Guest86 left 08:07 arkiuat left 08:08 jjido left 08:10 dakkar joined 08:36 arkiuat joined 08:41 arkiuat left 09:09 arkiuat joined 09:13 arkiuat left
ab5tract Voldenet: please take another look at the andthen/orelse PR when you have a chance 09:18
Voldenet ab5tract: hmm, idk if nested ternary op is a good thing (the thing in synchronous), also I still don't get why you use `$!result` and `self.cause` - use `self.result` and `self.cause` or `$!result` everywhere 09:37
otherwise it's some weird mixed style where you get some values directly and some not 09:38
$!result will contain cause or result depending on the $!status 09:39
09:39 arkiuat joined
Voldenet so I'd say to do `if $synchronous { …ternary… } else { …another ternary }` 09:42
09:45 arkiuat left, wayland76 joined, wayland left
Voldenet I'll copy those points to github too 09:49
10:12 arkiuat joined
ab5tract Voldenet: thanks. We tend to nest pretty heavily inside of core so I'm used to the style 10:13
I switched back and forth while updating the PR 10:14
Voldenet > github.com/rakudo/rakudo/pull/5917...3019588031 10:16
I hate nested ifs, but nested ternaries are even worse
10:17 arkiuat left
Voldenet but if you use both, suddenly they're not nested, so that's my obviously preferred stlye :> 10:18
style*
El_Che wtf 10:19
tellable6 2025-06-27T21:58:34Z #raku-dev <jdv> El_Che the 2025.06 release happened
2025-06-30T19:10:39Z #raku-dev <jdv> El_Che 2025.06.1 point release done
El_Che (sorry lucky mistype)
ab5tract Well there is the benefit of avoiding a new scope and other setups, which is why we often go that route
I do agree that there is should be a line. And I was definitely wondering whether this was a case of crossing it 10:20
Voldenet Yes, there is the benefit of avoiding a new scope _now_, but once it get optimized to certain point, it should only be style difference 10:21
and I'm always thinking that readability > clever performance tricks
or rather, usercode shouldn't really consider the performance of syntax, but theoretical performance of underlying code 10:23
especially when `?? !!` and `if else` could be optimized to exactly the same form
Oh, and I think synchronous now should work as designed 10:24
ab5tract I am not against changing them 10:26
I'm explaining why I chose them
And why you will see them nested quite deep in RakuAST code, etc 10:27
Voldenet Maybe one thing that's mind-boggling to me that I haven't said, couldn't this be used for all awaitables? `self.then({ final-result }, :$synchronous)
10:27 guifa joined
ab5tract the same approach of providing result/cause, you mean? 10:28
Voldenet well, currently Promise has this `has $!result; method cause { $!result }; method result { $!result }` 10:29
…so this code is pretty weird: `{ $!status == Kept ?? $vow.keep($!result) !! do { …code(self.cause) }` 10:30
10:31 librasteve_ joined
Voldenet either do this: `{ $!status == Kept ?? $vow.keep($!result) !! do { …code($!result) }` or `{ $!status == Kept ?? $vow.keep(self.result) !! do { …code(self.cause) }` 10:31
`?? $vow.keep(self.then({ final-result }, :synchronous))` 10:33
Isn't this code, like… wrong?
final-result returns Promise, so then the Promise gets propagated instead of the result
`?? final-result.then( -> $p { $vow.keep($p.result) }, :synchronous)` 10:34
that would attach a continuation to the final-result
erm, a scheduled then, not a continuation 10:35
I'll add more comments after all 10:36
10:40 arkiuat joined 10:45 arkiuat left
Voldenet ab5tract: So, I've figured out what :synchronous is expected to do - it's just sufficiently weird 10:52
m: sub huh { Promise.kept(1).then({ $^p.result + 42 }, :synchronous) }; huh.say
camelia 43
Voldenet m: sub huh { Promise.kept(1).then({ $^p.result + 42 }) }; huh.say # non-synchronous 10:53
camelia Promise.new(scheduler => ThreadPoolScheduler.new(uncaught_handler => Callable), status => PromiseStatus::Planned)
Voldenet so it's not expected to execute synchronously, just that result should not be wrapped in the Promise
and to be honest, this seems like a bad idea, ngl 10:54
11:00 guifa left 11:11 tjr joined 11:15 arkiuat joined 11:19 lichtkind_ left 11:21 arkiuat left 11:27 lichtkind joined 11:35 markong joined 11:42 arkiuat joined 11:47 arkiuat left 12:15 arkiuat joined 12:18 guifa joined 12:20 arkiuat left 12:44 arkiuat joined 12:51 arkiuat left 13:06 poisNada joined
disbot3 <melezhik.> o/ 13:07
13:17 arkiuat joined
ab5tract Voldenet: this is the code for Promise.cause github.com/rakudo/rakudo/blob/f52c...kumod#L209 13:18
it's quite a bit more complex than $!result
And also weren't you the one who suggested the `then`? 13:19
13:22 poisNada left, arkiuat left 13:26 poisNada joined
Voldenet ab5tract: Promise.result is also a bit more complex than $! result, that's what I'm going on about - either use raw value, or use checked everywhere 13:45
13:45 arkiuat joined
Voldenet ab5tract: and yes, I did suggest using .then - but before I thought it's about performing the scheduled thens synchronously on the same thread, I didn't know it completely changed the result :/ 13:47
I mean, the whole :synchronous is very similar to simply doing the `.&await` later
ab5tract Voldenet: the original implementations used $!result, so I went with that 13:48
Voldenet so… maybe it's just a silly api or some hyperoptimization
13:48 poisNada97 joined
ab5tract Anyway, it's irrelevant now 13:48
I'm sorry but I don't have the tuits to worry about the ternaries
feel free to adjust that PR however you prefer 13:49
Voldenet np, it's just a style suggestion, I have no strong feelings about it
I'll see the code tomorrow, and I'll test those :synchronous cases, because auto-awaiting makes the code for it surprisingly complex (especially error handling) 13:50
13:50 arkiuat left 13:52 poisNada left
ab5tract Voldenet++ 13:54
14:05 poisNada97 left 14:14 arkiuat joined 14:19 markong left, poisNada joined, arkiuat left 14:35 arkiuat joined 14:40 arkiuat left 15:01 arkiuat joined 15:06 arkiuat left 15:21 poisNada left 15:29 arkiuat joined 15:34 arkiuat left 15:38 arkiuat joined 16:01 jgaz joined 16:02 jgaz left, Some-body_ joined, DarthGandalf left 16:03 gfldex left, jgaz joined 16:05 gfldex joined, Some-body_ is now known as DarthGandalf 16:37 dakkar left 17:55 broquaint left 17:56 broquaint joined 18:07 arkiuat left 18:08 arkiuat joined 18:53 nicole left 19:18 wayland76 left 19:19 wayland76 joined 21:28 jjido joined 21:39 arkiuat left 21:48 arkiuat joined 21:53 arkiuat left 22:07 arkiuat joined
Geth ¦ problem-solving: lizmat assigned to codesections Issue Add a "use-targets" item to META6.json github.com/Raku/problem-solving/issues/485 22:12
¦ problem-solving: lizmat unassigned from codesections Issue Add a "use-targets" item to META6.json github.com/Raku/problem-solving/issues/485
22:30 librasteve_ left 22:36 jjido left 22:38 jjido joined 22:39 swaggboi left 22:42 swaggboi joined
tonyo . 22:48
22:49 lichtkind left 22:51 Sgeo joined 23:24 jjido left 23:26 wayland76 left, nicole joined 23:28 kaskal- joined, kaskal left