01:11 sibl joined 01:22 sibl left 01:33 sibl joined 01:42 sibl left 01:51 hulk joined 01:52 kylese left 01:54 wayland joined 02:01 sibl joined 02:04 annamalai left 02:15 hulk left, kylese joined 02:17 annamalai joined 02:55 sibl left, sibl joined 03:05 lichtkind__ joined 03:07 lichtkind_ left 03:24 kurahaupo joined 04:16 sibl left 05:18 sibl joined 05:52 wayland left 05:54 sibl left 05:56 sibl joined 06:00 sibl left 06:20 Aedil joined 06:31 sibl joined 06:38 abraxxa joined 06:39 topnep left 06:40 topnep joined 06:41 soverysour joined, soverysour left, soverysour joined 07:07 Sgeo left 07:12 soverysour left 07:14 soverysour joined, soverysour left, soverysour joined 07:33 soverysour left 08:01 ShimmerFairy left, rnddim joined 08:44 topnep left 08:46 topnep joined 08:54 Aedil left
SmokeMachine apogee_ntv: hi! I sent you an issue on your MCP::Server module to know if you would like an DSL around it as an PR, or you do not want that an I should do a new module for that. I also created an new issue to your jinja2 module asking if you are wanting to keep that module following only to the jinja2 specs or if you would like to add more features to that. 10:00
10:18 sibl left 10:50 topnep left 10:51 topnep joined
apogee_ntv Hi SmokeMachine, will take a look at those now. Jinja2 is really supposed to be limited to the spec. 10:56
10:57 Aedil joined
apogee_ntv I do like the DSL idea for MCP::Server, I'd welcome that with tests. 10:59
10:59 abraxxa left 11:05 sorenson_ joined, sorenson left, sorenson_ is now known as sorenson 11:31 librasteve_ joined, sibl joined
librasteve_ .seen: tonyo 11:32
seen: tonyo
tellable6 librasteve_, I saw tonyo 2026-04-13T01:45:33Z in #raku: <tonyo> .
12:42 sibl left 13:32 soverysour joined, soverysour left, soverysour joined 13:36 merp left 13:38 merp joined
disbot2 <simon_sibl> I’m wondering, since I really prefer error as value over exception, if there is a way to have that kind of setup with Raku ? Since the language is very malleable (not sure if it has the same meaning in English as it has in French, but I mean easy customizable at runtime and all) would it be possible to have a kind of “no exception” pragma that would check all “die” and make it into an error that is returned or something and the compiler 13:47
would tell us if we handle it or not ?
ugexe its a different api, you cant have a pragma that changes the api of almost all functions 13:50
you can write your own code to return Failures or exceptions directly, but you've then designed your api around that
{ my $!; try some-core-function(); if $! { #`handle error here` } } 13:53
you can do that but you need to scope $! appropriately since it is a global and thus not thread safe 13:54
which is sort-of acceptable because it doesn't change the api of some-core-function, i.e. it doesn't change the return signature of some-core-function() 13:55
disbot2 <simon_sibl> The issue here is that I can’t easily know if a function can throw exception since it’s not in its signature What I believe could be possible with the magic pragma I talked earlier is that if a function has a die, it would wrap the return value in an option or something and then the compiler would check and force the dev to handle it correctly 13:56
ugexe checked exceptions from java
languages have moved away from those though 13:57
disbot2 <simon_sibl> I want to avoid calling a function like file.open without knowing it can throw exception and have production fail because of something like this (I am not really a dev, I am not using Raku for a big project, I am just wondering in case someday I wanna work on a big project, I know tests exist, just I like error as value and I can’t wrap my head around exceptions)
<simon_sibl> I’ll check those checked exception from Java
<simon_sibl> Never did Java xD
Voldenet checked excepions are awful 13:59
disbot2 <simon_sibl> Why ?
Voldenet the code starts getting all about exceptional situations and not about what it does
disbot2 <simon_sibl> I like knowing I handle every error 14:00
<simon_sibl> I don’t know not knowing where my program can fail
Voldenet so, 20 out of 100 lines handle actual 99% of cases
disbot2 <simon_sibl> I don’t like*
ugexe yeah it sounds good on paper but in practice it is verbose to the point of detriment
Voldenet and at some point you no longer know what the code is even supposed to do
ugexe i agree it would be nice to be able to have something to introspect the true api of a given function though so you could know what exceptions can be thrown by a function 14:01
Voldenet the question is: do you want to _really_ handle all errors?
disbot2 <simon_sibl> Actually simply a way to ask the Raku compiler to let me know my current code has any path that can trigger an exception that I don’t handle with a try or something would be amazing already 14:02
<simon_sibl> I wanna handle as much as I can at least, I want to be the one deciding if I should handle it or not, but I need to know everywhere my program can fail
Voldenet something similar to `try { write("current time is " + now) } catch (TapeSeekingFailed) { … } catch (UserHasNoMonitor) { … } catch (LeapSecond) { … }` 14:03
Yes, it's sometimes nice to handle all of these 14:04
disbot2 <simon_sibl> I love zig error handling, golang is fine (minus runtime exception the language doesnt let you handle)
<simon_sibl> I don’t mean Raku error handling is ugly or what, just I wish there is at least a way to tell me where there can be an error that I don’t check
<simon_sibl> For example opening a file 14:05
Voldenet `CATCH { default { } }` exists for cases where you don't care about specifics of the error
disbot2 <simon_sibl> For a basic script, I don’t care, but if that’s something professional I don’t want to throw a trace back to my customer xD
Voldenet it's a misconception, in professional envs you usually just log the whole message on error and return 500 error to the user 14:06
disbot2 <simon_sibl> Well to be fair, in the company I work we do throw traceback at the face of the client xD 14:07
<simon_sibl> But in a pretty way !
<simon_sibl> If you just return 500 the client has no idea what happened 14:08
<simon_sibl> I want people to know what happened
Voldenet Yes, you can do that
some systems just get most important and likely exceptions and give user "properly translated message", other exceptions get some kind of ids assigned, log the exception and then give the user id, date and 500 error (with no message) 14:10
in C# webdev exception filters are a thing, which set handlers for errors globally 14:14
either way, decoupling error handling from "what program does" clears up a lot 14:15
because when you want to do `transaction({ set("id", get("id") + 1) })`, you don't want to deal with network and infrastructure errors at all - any failure basically means that the code fails 14:17
and in case you do want to handle it, you can: `transaction({ try { id = get("id"); } catch (NotFound) { id = 0 }; set("id", id + 1) })` 14:19
but imagine having to handle "physical medium disconnected during transaction" everywhere you want to do something db-related 14:20
disbot2 <simon_sibl> I didn’t mean to handle every error possible of a statement, but to be aware that statement can raise error and if I handle it to at least not make the whole program blow up 14:23
<simon_sibl> Here I don’t want that if one client’s transaction fails the whole server crashes 14:24
Voldenet that's why the pattern similar to `fn run_method(context, name, args) { try { find_method(name).run(context, args) } catch (Anything e) { log(e); context.error(unknown) } }` is used 14:27
so methods don't care, and handling error becomes the golden path of error handling 14:28
I don't really enjoy the way golang forces you to handle errors 14:30
it's kinda like `try { result = a() } catch (error) { … }; try { result2 = b(result) } catch (error) { … }` code
it can even be useful to do, but it'd be hard to maintain 14:34
rust does something similar to golang (can return Result<T, Error> type), but has `?` macro that says "forward the error" – the problem is that it doesn't store stack traces 14:39
so when you get something like `std::io::Error` from `copy_file` you may not know if that's the problem with destination or the source 14:41
which is obvious, when stack trace shows exception originating from `Read(…)` 14:42
you could also emit CopyError that would include that information, but in case of exceptions you simply don't care at all 14:45
14:46 soverysour left, soverysour joined, soverysour left, soverysour joined
Voldenet and if you're lucky, you might even know what kind of error it is (due to stack trace including `read_network_packet`) without even knowing that you support reading the files from network shares 14:51
disbot2 <simon_sibl> Something in the same vein, is there a way to get a warning on unused function argument ? 😅 14:59
15:00 soverysour left
disbot2 <simon_sibl> I wish there would be a way to have something similar in Raku, anyway I’m just not a fan of exceptions that’s all xD 15:09
apogee_ntv simon_sibl you could catch all the exceptions and use my Monad package, it has Either which is basically Result :P
You can put errors in left, success response in right, if you just want a Result style response in your own code. 15:14
raku.land/zef:apogee/Monad#monadeither
But your deps probably throw exceptions so you need to handle those and wrap them. 15:15
15:30 soverysour joined 15:35 soverysour left 15:40 soverysour joined, soverysour left, soverysour joined 15:41 librasteve_ left
disbot2 <holmdunc> IIRC Swift has an interesting approach where a) Whether a function can throw at all IS part of its type signature, and b) When calling such a function you must precede the call with the try keyword, but that keyword does not actually do anything and is just a visual indicator for someone reading the code that a throw might happen at that callsite 16:07
16:08 soverysour left 16:10 soverysour joined
disbot2 <simon_sibl> I’ll check your Monad package ! 16:15
<simon_sibl> That’s interesting, although weird to have a try keyword that doesn’t actually..try 😅
16:17 annamalai left 16:18 annamalai joined
disbot2 <holmdunc> There are details here about how they can actually be handled, or converted into the errors-as-values realm like you mentioned docs.swift.org/swift-book/document...rhandling/ 16:19
<holmdunc> Although the latter seems a bit weak because it only seems to support converting it into an Optional and not a Result that can carry info 16:24
<antononcube> Better use forward feed (==>) and andthen. 16:39
17:27 soverysour left 17:33 librasteve_ joined
Voldenet That probably means that in swift it's not even possible to handle OOM or out of bounds access 17:39
otherwise every single function would be throwing
such errors are very tricky, but I've seen "out of memory" errors in logs from running applications that were properly handled 17:41
swift does very java-like thing though (in java you can catch OOM or stack overflow, but shouldn't) 17:48
disbot2 <librasteve> i am not well versed in Exception/Monad law, but I did write a post a while back rakujourney.wordpress.com/2024/10/...-burritos/ that may be applicable 17:49
<librasteve> that used the Definitely module, though if I were you, I would use apogee_ntvs Monad::Either as mentioned 17:50
<librasteve> (I wrote that as much to get my head around "Raku in functional style" btw) 17:51
librasteve_ separately I have a new question, I would like to do this: 17:52
m: my @a = 1,2,3; my @b = 2,3,4,5; my @c = (@b (-) @a).keys; say @c;
evalable6 [4 5]
librasteve_ ie - use the set `(-)` operator to give me a list of the different elems 17:53
but seems a pity to need `.keys` … is there a neater idiom for that? 17:54
17:58 soverysour joined 18:03 soverysour left 18:13 soverysour joined, soverysour left, soverysour joined
lizmat librasteve_: this has been discussed before, but .keys it is, simply for consistency with the other QuantHashse 18:29
disbot2 <librasteve> ah - OK thanks for clarifying ... mebbe we need a new prefix operator like | 18:33
<librasteve> as alias for .keys
lizmat hmmm.. maybe this: 18:35
m: sub infix:<|(-)>($a,$b) { ($a (-) $b).keys }; say (2,3,4,5) |(-) (1,2,3) 18:37
evalable6 (5 4)
lizmat or: 18:40
m: multi sub infix:<(-)>($a,$b, :$k) { ($a (-) $b).keys }; say (2,3,4,5) (-) (1,2,3) :k
evalable6 (5 4)
19:14 gabiruh left, topnep left, gabiruh joined 19:16 topnep joined
[Coke] heh. I just had to write this and remembered before running it that I needed keys 19:41
20:11 librasteve_ left 20:19 Aedil left 20:20 soverysour left
disbot2 <librasteve> that's very cool - tx! 20:23
20:24 soverysour joined, soverysour left, soverysour joined 20:35 soverysour left 20:38 soverysour joined
ugexe i have to break off a couple more prs, but i got `RAKUDO_RAKUAST=1 make install` working last night 21:09
[Coke] OOOH 21:19
21:20 topnep left 21:21 soverysour left 21:22 topnep joined 22:46 gabiruh left, gabiruh joined
ugexe i think it should work with #6122 #6123 #6124 23:08