🦋 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:00 reportable6 left 00:03 reportable6 joined, TieUpYourCamel joined 00:25 jpn joined 00:30 jpn left 01:19 jpn joined 01:25 jpn left
guifa_ tbrowder you could always write a wrapper 01:32
m: use Test; &is.wrap: anon sub is ($expected, $got) { nextwith $got, $expected }; is 'expected', 'got';
camelia not ok 1 -
# Failed test at SETTING::src/core.c/control.pm6 line 146
# expected: 'expected'
# got: 'got'
01:51 Zymurgy is now known as Sauvin, Sauvin left, Sauvin joined 01:52 derpydoo joined 02:20 teatwo joined 02:24 tea3po left
tonyo rf: any way to just route _all_ errors in hummingbird through one handler rather than specifying the type or would i use advice and inspect the request for something? 03:07
03:08 jpn joined 03:13 jpn left 03:35 teatwo left 04:35 squashable6 left, reportable6 left, benchable6 left, bisectable6 left, sourceable6 left, committable6 left, statisfiable6 left, releasable6 left, tellable6 left, greppable6 left, nativecallable6 left, squashable6 joined, reportable6 joined 04:36 statisfiable6 joined, committable6 joined, greppable6 joined, nativecallable6 joined, benchable6 joined 04:37 releasable6 joined, sourceable6 joined, bisectable6 joined, tellable6 joined 04:56 jpn joined 05:01 jpn left 05:24 teatime joined 05:58 derpydoo left 06:00 reportable6 left 06:02 reportable6 joined 06:14 leohoo_sdu[m] joined, leohoo_sdu[m] left 06:59 dustinm` left 07:00 Sgeo left 07:07 jpn joined 07:11 dustinm` joined 07:22 abraxxa joined 07:29 sena_kun joined 07:30 jpn left 07:35 rf_ joined 07:37 rf left 07:43 rf joined, Manifest0 joined 07:45 rf_ left 07:50 rf_ joined 07:52 rf left 07:54 rf joined 07:55 rf_ left 08:03 rf_ joined 08:06 rf left 08:15 rf joined 08:16 rf_ left 08:29 jpn joined 08:34 rf_ joined 08:35 rf left 08:36 jpn left 08:38 abraxxa left 08:40 jpn joined 08:49 rf joined 08:51 rf_ left 09:00 rf_ joined 09:02 rf left 09:18 rf_ left 09:37 euandreh joined 09:40 euandreh left 09:42 euandreh joined
tbrowder__ guifa: thanks, but i'm too lazy fo that... 09:56
lizmat tbrowder_: FWIW, you *don't* have to use Test in your tests 10:01
as long as your test files produce TAP, you should be fine 10:02
guifa_ lizmat: what do you mean by "produce TAP" ? 10:11
lizmat TAP output
ok 1 - foo
guifa_ ah. I was figuring it was the exit code that was used based on the END block 10:14
tbrowder__ hm, a good idea when all else fails! 10:29
lizmat e.g. many of the files in t/01-sanity do not use Test 10:30
tbrowder__ but, basically, at the moment my failures are being caused by testing hash/list structures with is-deeply, so i need Test 10:31
specifically the test that fails at the moment is from module Font::AFM where there is a structure hash .BBox keyed by character names, with values a 4-item list of numbers. 10:34
the "got" part is taking that has and multiplying each number by the same constant value (scale factor) to produce a new, replacement list 10:36
sorry, that is the "expected" entry 10:38
the "got" part is the equivalent .BBox from my module 10:39
i used a short cut from [Coke] and moritz to update the lists in one go by $newlist = $oldlist >>*>> $scalefactor 10:41
10:42 linkable6 left, evalable6 left
tbrowder__ the values work fine, but in one case i have a list and the other it's an array, and that causes is-deeply to fail 10:42
i haven't yet been able to zero in on a fix
(the failure msg is long due to the size of the hash) 10:43
10:43 evalable6 joined 10:44 linkable6 joined
tbrowder__ i can pass the test by completely unpacking the structure and rebuilding, but using >>*>> would be so much better 10:44
i't 10:45
lizmat maybe coerce the expected or gotten to .List ?
before giving it to is-deeply ? 10:46
tbrowder__ i tried that once with no success when applying it to the "got" part. ibut i may try again--that's where the confusion comes with Test got vs expected 10:48
give me a few... 10:49
i'm going back to my side of the test and see why it's an array. i used the >>*>> on that side, too. thnx for being a good sounding board 11:12
lizmat yw :-) 11:15
tbrowder__ ah, my side is using $newhash = $oldhash>>.map({$_ * $factor}) 11:18
that somehow produces an array. i'll fiddle with that... 11:19
lizmat that'd be multiplying a Pair ? 11:20
which feels.... suboptimal?
tbrowder__ ?
lizmat m: my %h = :42a, :666b; say %h>>.map(&dd) # TIL that >>. on a hash produces values 11:22
camelia 42
{a => (Nil), b => (Nil)}
lizmat or maybe re-learned :-) 11:23
tbrowder__ m: my $h = 'a' => (1,2); say %h>>.map({$_ * 2}) 11:26
camelia ===SORRY!=== Error while compiling <tmp>
Variable '%h' is not declared. Did you mean '$h'?
at <tmp>:1
------> my $h = 'a' => (1,2); say ⏏%h>>.map({$_ * 2})
Nemokosch I used that semi-regularly 11:27
tbrowder__ m: $h = a => 1,2; say $h>>.map({$_ * 2 }) 11:28
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$h' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> <BOL>⏏$h = a => 1,2; say $h>>.map({$_ * 2 })
Nemokosch for a long time I wondered, why something like deepmap exists in the first place, and there you go: it doesn't make a lot of sense for arrays but it makes great sense for deeply nested maps/hashes
where it's not only common but pretty good design to put the actual values in the nodes
tbrowder__ m: my $h = a => 1,2; say $h>>.map({$_ * 2}) 11:29
camelia WARNINGS for <tmp>:
Useless use of constant integer 2 in sink context (lines 1, 1)
Cannot resolve caller new(Pair:D: ); none of these signatures matches:
(Pair: Str:D $key, Mu \value, *%_)
(Pair: Mu \key, Mu \value, *%_)
(Pair: M…
tbrowder__ think i need parens 11:33
m: $h=a=>(1,2); say $h>>.map({$_*2}) 11:34
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$h' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> <BOL>⏏$h=a=>(1,2); say $h>>.map({$_*2})
tbrowder__ jeepers! 11:35
Nemokosch anyway, no, not parens
brackets around the RHS, or even better: %() around the RHS 11:36
tbrowder__ m: my $h=a=>(1,2); say $h>>.map({$_*2})
camelia Cannot resolve caller new(Pair:D: ); none of these signatures matches:
(Pair: Str:D $key, Mu \value, *%_)
(Pair: Mu \key, Mu \value, *%_)
(Pair: Mu :$key!, Mu :$value!, *%_)
in block <unit> at <tmp> line 1
tbrowder__ m: my $h=a=(1,2); say "{$h>>.map({$_*2})}" 11:40
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
a used at line 1
Nemokosch m: my $h = { a => (1, 2) }; say $h>>.map({$_ * 2}) 11:41
Raku eval {a => (2 4)}
tbrowder__ forgot > this time,
thnx, but why Raku eval? 11:42
gotta try my way... 11:43
11:44 linkable6 left, evalable6 left 11:45 linkable6 joined 11:47 evalable6 joined 12:00 reportable6 left 12:02 reportable6 joined
Nemokosch because there is no camelia on discord 12:03
12:15 squashable6 left 12:16 squashable6 joined 12:52 john212 joined 12:56 john212 left
tbrowder__ m: my $h 12:57
camelia ( no output )
tbrowder__ ah, got it 12:59
okey dokey, [Coke]'s advice was correct, i just confirmed old rule that copy/pasta may not be the answer. he said, regarding map, that the ({$_ * X}) was the most flexible, and i used it in this work. 13:37
*however*, i failed to change that part to accurately model the actual structure. when i did, i get good results. 13:38
for a hash of %h<key> = 1,2,3,4 i needed %h>>.map({$_ >>*>>}) 13:41
duh: >>*>> $f}) 13:42
13:56 linkable6 left, evalable6 left 13:57 linkable6 joined 13:59 evalable6 joined 14:01 rf joined 14:16 teatime left 14:17 teatime joined
leont What's the right syntax to alias a type from another module to my own module? 14:22
14:22 teatwo joined
leont «my ::Foo = Other::Foo;» doesn't seem to DWIM 14:23
14:23 teatwo left, teatwo joined
rf tonyo: You can use a stash + middleware 14:25
Requests and Responses have stashes
14:25 teatime left
[Coke] leont: I don't have a place to test this, but: bind, instead? 14:26
:= ?
leont Nope, but apparently getting rid of the my did the trick.
Or apparently it didn't, it just compiled 14:27
14:28 teatwo left, teatwo joined
leont I'm entirely stuck on this? :-( 14:45
14:58 Sgeo joined
tbrowder__ my $t = $Foo::bar.foo 15:02
15:04 swaggboi left
vrurg Why a type capture would be needed if there is `my \Foo = Other::Foo;` ? 15:04
15:18 swaggboi joined 16:07 xinming left 16:09 xinming joined 16:58 merp left, merp joined 17:02 Sauvin left 17:10 Sauvin joined
tonyo rf: hummingbird seems to not parse query string correctly, whether i give it `?email=test@test.com` or `?email=test%40test.com`, in the .query('email') i get back `test` 17:43
also kills the server by running siege with the default configuration against it 17:49
18:00 reportable6 left 18:02 reportable6 joined 18:33 jpn left 18:35 jpn joined 18:46 notna joined 18:51 jpn left 18:53 jpn joined 19:06 MasterDuke left 19:10 jpn left 19:11 jpn joined
rf tonyo: Query params have been a real pain, would you mind filing an issue. I thought I fixed this. 19:14
What's also odd is that it died with Siege, I've hit it with siege before and it seems to do okay 19:15
Ahh @tonyo I see the bug, I'll fix it up right away! 19:18
19:21 jpn left 19:23 jpn joined 19:25 MasterDuke joined 19:32 notna left 19:41 jpn left
rf tonyo: github.com/rawleyfowler/Humming-Bird/pull/55 Just waiting on CI and it'll be released as 2.1.4 19:42
19:47 jpn joined
rf I must have been drunk when I wrote the query param decoding originally :X 19:56
20:01 jpn left
tonyo hahaha 20:12
rf: i've narrowed the error down to the `error(` function + using siege 20:13
rf++ query is coming in nicely now 20:16
ugexe github.com/rawleyfowler/Humming-Bi...kumod#L588 20:17
dunno if that function needs to be thread safe, but it isnt
a wild guess is the reads and writes to that hash should be protected 20:19
tbrowder__ tonyo: is hummingbird usable with yr pdf https guide with all its bells and whistles? 20:31
rf tonyo: Great! Let me know if you find other issues 20:32
Humming bird is single threaded
tonyo tbrowder__: let me double check 20:33
rf To my knowledge lol, although i'm not entirely sure how raku does async stuff under the hood
tonyo tbrowder__: it is, the Cro parts would change slightly and i'd probably use this for templating: raku.land/zef:tony-o/Ryml 20:34
rf I use Ryml in production right now tonyo :)
Internal stuff but still it's excellent! 20:35
20:38 jpn joined
rf Also ugexe that call should typically only be called when setting up the server, thought there may be a case for calling it if you wish to dynamically handle new exception types at run time 20:39
21:27 cm left 21:32 cm joined 21:42 sena_kun left 21:50 jpn left 21:55 euandreh left 21:57 rf left 22:05 euandreh joined 22:06 jpn joined
ugexe delegate-route isn’t thread safe either 22:47
I do get that normally that shouldn’t be a problem though
easy enough to fix too 22:58
23:00 xinming left, xinming joined
ugexe there are modules like Concurrent::Trie, but I usually just writer a getter/setter function for each hash, a global lock for each getter/setter pair, and then using $!the-lock.protect: { use-the-hash-here } 23:00
23:23 jpn left 23:25 xinming left 23:26 jpn joined 23:28 xinming joined