🦋 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.
00:01 gugod joined 00:05 MasterDuke left 00:06 Kaipei is now known as Kaiepi 00:07 reportable6 left 00:09 reportable6 joined
Voldenet regarding improving camelia: consider handling discord-raku-bot's `m:` statement 00:41
otherwise it's minor pain for people using discord 00:42
(I'm not sure where would I suggest this) 00:43
01:00 markmarkmark left, summerisle left 01:01 summerisle joined 01:14 markmarkmark joined 02:14 evalable6 left, linkable6 left, evalable6 joined 02:16 linkable6 joined 02:58 summerisle left, Util left 03:02 summerisle joined 03:26 frost joined 04:26 reportable6 left, bisectable6 left, sourceable6 left, benchable6 left, statisfiable6 left, linkable6 left, evalable6 left, quotable6 left, releasable6 left, nativecallable6 left, tellable6 left, committable6 left, coverable6 left, bloatable6 left, notable6 left, greppable6 left, unicodable6 left, shareable6 left 04:27 bloatable6 joined, benchable6 joined, evalable6 joined, quotable6 joined, statisfiable6 joined, committable6 joined, bisectable6 joined 04:28 shareable6 joined, linkable6 joined, releasable6 joined 04:29 reportable6 joined, nativecallable6 joined, unicodable6 joined, sourceable6 joined, greppable6 joined, tellable6 joined, notable6 joined, coverable6 joined 05:08 frost left 05:23 frost joined 06:04 silug5 joined, silug left, silug5 is now known as silug 06:07 reportable6 left 06:09 abraxxa joined 06:10 reportable6 joined 06:13 nort joined 06:16 abraxxa left, abraxxa joined 06:24 nort left 06:47 p6steve left 06:52 nort joined 06:57 lichtkind__ joined 07:11 frost left 07:14 frost joined 07:37 _________ left 07:53 Sgeo left 08:05 discord-raku-bot left, discord-raku-bot joined 08:10 dakkar joined 08:23 MasterDuke joined 08:38 mexen joined 08:40 Xliff joined 09:06 abraxxa left, abraxxa joined 09:15 lichtkind_ joined 09:18 lichtkind__ left 09:58 frost left
kawaii method mint(UInt $value) { 10:01
if !self.is-frozen {
Transaction.^create(batch => UUID.new, :$value, from-account => 'mint', to-account => self.account, termination-point => 'system');
say "✓ minted $value tokens for account: $!account";
} else {
CATCH { when X::Mint::Account::IsFrozen { .resume } }
ah why did that paste directly
I think I have some misconception about Exceptions in Raku, I want to both display the error message from the exception to the user, without also killing the program?
try/CATCH both seem to swallow the .message from my exception however 10:02
I seem to either only be able to have my exception print it's .message in the console and kill the program, or not kill the program but provide no output :( 10:03
moritz m: sub dangerous { die "oh noez"} ; try dangerous(); say $! if $!; say "I'm still standing" 10:07
camelia oh noez
in sub dangerous at <tmp> line 1
in block <unit> at <tmp> line 1

I'm still standing
moritz kawaii: ^^ something like that?
I think in your sample code the .resume is wrong
just print it there? or do nothing 10:08
kawaii moritz: so you're right in the sense that doing this works `CATCH { when X::Mint::Account::IsFrozen { say("✗ account '$!account' is frozen and thus immutable") } }` but it makes me wonder why I would bother to have any error message in the Exception itself at all `class X::Mint::Account::IsFrozen is Exception { has $.account; has $.message = "✗ account '$!account' is frozen and thus immutable"; }` 10:12
10:24 frost joined
moritz kawaii: the point is that as the author of the code that raises the exception, you cannot be sure it'll only be called in context where it is specifically caught 10:31
so you give it a good message in case it's raised and not caught, and also makes debugging easier 10:32
or maybe somebody catches many possible exception classes, logs the error
Voldenet Error message in Exception is not necessary in any language 10:35
but a lot of times you define exceptions that aren't this precise 10:36
moritz in python, anytime any value is slightly unexpected, it's a ValueError. Easy to remember, hard to distinguish between different ValueErrors 10:38
it's tradeoffs all the way down :D 10:39
kawaii I think I understand a little better now, thanks for the explanations
moritz you're welcome 10:44
11:05 jmcgnh left 11:11 jmcgnh joined 11:26 frost left
Xliff Does anyone know if you can create a derivative Signature from another Signature? 11:48
12:07 reportable6 left 12:09 reportable6 joined
Xliff m: sub a ("a", "b", $c, :$d) { }; Signature.new( params => &a.signature.params[1..*] ).gist.say 12:13
camelia ("b", Any $c, Any :$d --> Mu)
Xliff That looks promising.
&a.signature.head.say 12:14
m: &a.signature.head.say
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
a used at line 1
Xliff m: sub a ("a", "b", $c, :$d) { }; &a.signature.head.say 12:15
camelia ("a", "b", $c, :$d)
Xliff m: sub a ("a", "b", $c, :$d) { }; &a.signature.params.head.say
camelia "a"
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/06/14/2022-...ence-2022/ 12:20
sienet_ja_LSD[m] nice, nice
Xliff How many tests are currently in roast? 12:24
12:27 [Coke] left 12:28 [Coke] joined
lizmat Files=1353, Tests=116312 12:29
Xliff Oh. 900 files left for RakuAST. Nice round number! ;) 12:33
12:52 Util joined 13:03 morte_ joined
sienet_ja_LSD[m] how do I coerce a scalar (that could be either Int or Rat) to uint8? there's no method like .Int 13:07
lizmat m: my uint $a = $value.Int 13:09
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$value' is not declared. Did you mean '&values'?
at <tmp>:1
------> my uint $a = ⏏$value.Int
lizmat m: my uint $a = 4.5.Int
camelia ( no output )
lizmat m: my uint $a = 255.5.Int; say $a
camelia 255
lizmat m: my uint $a = 256.5.Int; say $a
camelia 256
lizmat m: my uint8 $a = 256.5.Int; say $a
camelia 0
lizmat sienet_ja_LSD[m] ^^ 13:10
sienet_ja_LSD[m] alright, that should do it. thank you
13:16 jgaz joined 13:26 Sankalp left 13:27 Sankalp joined 13:29 jgaz left 13:32 Sankalp left 13:37 Sankalp joined
[Coke] m: my uint $a = 121; dd $a.WHAT 14:00
camelia Int
[Coke] m: my uint $a = 121; put $a.WHAT 14:01
camelia Use of uninitialized value of type Int in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.

in block <unit> at <tmp> line 1
[Coke] If I do $a.WHAT in the REPL, I get Cannot invoke object of type 'NQPMu' 14:02
m: my uint $a = 121; say $a.WHAT
camelia (Int)
[Coke] I can't seem to get it to explode here
uzl[m] patrickb: The "Think X" series is more CS and programming basics than language-centric per se. I think Laurent Rosenfeld did a great job at both teaching the CS concepts discussed in the book through a Raku lense 14:06
lizmat++ for the weekly! 14:07
14:12 Sgeo joined 14:25 _________ joined
Xliff If I have a parameter that is constant. How can I pull out that value? 14:50
I am speaking in terms of the Parameter class.
14:51 peder left
Xliff So in "sub a ("b") { ... }", I can get the parameter by "$p = &a.signature.params[0]", but how do I get $p to print "b"? 14:51
moritz it's in .constraints 14:52
MasterDuke m: sub a ("b") { ... }; my $p = &a.signature.params[0]; say $p.constraints
camelia all(b)
MasterDuke m: sub a ("b") { ... }; my $p = &a.signature.params[0]; say $p.constraint_list 14:53
camelia (b)
moritz m: sub a ("b") { ... }; my $p = &a.signature.params[0]; say $p.constraint_list[0]
camelia b
Xliff Ah, thanks! 14:54
Geth ecosystem/add-raku-mint-module: 4ed73776d4 | (Keyn Valentayn)++ (committed using GitHub Web editor) | META.list
Add Mint module to ecosystem

ecosystem: kawaii++ created pull request #605:
Add Mint module to ecosystem
14:57 peder joined
Voldenet m: sub a ("b") { … }; my $str; { my $*OUT = class :: { method print($b) { $str = $b.trim; } }.new; say &a.signature.params[0]; }; say $str 15:03
camelia "b"
Voldenet Does the job in this case, otherwise entirely useless
i found it funny though 15:05
Geth ecosystem: 4ed73776d4 | (Keyn Valentayn)++ (committed using GitHub Web editor) | META.list
Add Mint module to ecosystem

ecosystem: ca2ca916ea | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Merge pull request #605 from Raku/add-raku-mint-module

Add Mint module to ecosystem
15:25 lichtkind_ left 15:33 dakkar left
uzl[m] m: say 0 max False 15:34
camelia 0
uzl[m] m: say False max 0 15:35
camelia False
Geth doc: uzluisf++ created pull request #4084:
Make &[max] and &[min] return LHS for ties
[Coke] uzl[m]++ 15:50
I may have a small edit on that to specifically call out Rakudo version, but otherwise seems fine.
(we have a long standing request about having a specific way to mark items that deal with specific versions but we don't have to solve that before applying this commit.) 15:51
16:00 Colere left 16:06 Colere joined 16:08 Furor joined 16:10 Lemniscate joined 16:11 Colere left 16:14 Furor left, Colere joined 16:17 Lemniscate left 16:23 perlbot left 16:25 perlbot joined 17:18 abraxxa left
uzl[m] [Coke]: That sounds fine to me 👍️ 17:34
Note there's a small discrepancy between my commit message and the one is documenting, namely the "return [LHS|RHS] for ties" part. Probably codesections made a typo there, and used RHS instead of LHS 17:36
<uzl[m]> "codesections: Do you mind..." <- ^ I asked codesections for clarification but he's not around apparently... However from the behavior described and the example, it seems LHS is the right terminology here 17:38
18:06 reportable6 left 18:09 reportable6 joined 18:10 samcv joined 18:13 __________ joined, jrjsmrtn_ joined 18:16 _________ left, __________ left 18:17 timo1 joined, _________ joined 18:18 [Coke] left, lizmat left, timo left, corwin left, samcv_ left, dustinm` left, thowe left, jrjsmrtn left, donpdonp- left 18:20 [Coke] joined 18:21 thowe joined 18:22 __________ joined, donpdonp- joined, _________ left, __________ left 18:23 thowe left, _________ joined 18:24 corwin joined 18:29 thowe joined 18:31 kaskal- joined, kaskal left 18:53 n1to joined 18:55 morte_ left
lizmat [Coke]: anything with natives in the REPL will fail like that 18:58
19:14 Sgeo_ joined 19:15 jargan joined 19:16 samebchase3 joined 19:19 destroycomputer- joined, perryprog_ joined, tobs` joined, bartolin_ joined, xkr47_ joined, sivoais joined, zmoment_ joined 19:22 Tirifto_ joined 19:24 Sgeo left, jmcgnh left, discord-raku-bot left, jjatria left, phogg left, Tirifto left, zmoment left, xkr47 left, sivoais_ left, bd3i left, gfldex left, ilogger2 left, samebchase left, bartolin left, destroycomputers left, perryprog left, jast left, tobs left, jdv left, xkr47_ is now known as xkr47, samebchase3 is now known as samebchase, tobs` is now known as tobs 19:25 jdv joined, gfldex joined, discord-raku-bot joined, phogg joined 19:27 jmcgnh joined 19:28 perryprog_ is now known as perryprog 19:30 bd3i joined 19:31 ilogger2 joined, jjatria joined 20:04 morte_ joined 20:06 Util left 20:14 lichtkind_ joined 20:18 morte_ left 20:21 morte_`` joined 20:23 Kaipei joined 20:26 morte_`` left 20:27 morte_ joined, Kaiepi left 20:42 [Coke] left 20:43 [Coke] joined 20:44 summerisle is now known as eof 20:50 Util joined 20:57 morte_` joined 20:59 morte_ left 21:03 morte_`` joined 21:04 [Coke] left, morte_` left 21:09 [Coke] joined 21:30 morte_`` left 21:32 [Coke] left, tirnanog joined 21:37 [Coke] joined 21:59 n1to left 22:09 jargan is now known as jast 22:42 melezhik joined
melezhik .tell jjatria I am having problem with running HTTP::Tiny put method 22:42
tellable6 melezhik, I'll pass your message to jjatria 22:43
melezhik I've create ticket on gitlab
gitlab.com/jjatria/http-tiny/-/issues/14 22:45
22:46 melezhik left 22:57 kaskal joined 22:58 kaskal- left
jjatria .tell melezhik interesting! I'll take a look. Thanks for the report! 23:14
tellable6 jjatria, I'll pass your message to melezhik
23:17 lichtkind_ left 23:26 melezhik joined 23:27 melezhik left