Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes. Set by lizmat on 24 May 2021. |
|||
09:11
sena_kun joined
11:04
rypervenche left
16:35
sena_kun left
16:57
sena_kun joined
20:49
xinming left
20:51
xinming joined
|
|||
SmokeMachine | Hi! does anyone know what I'm doing wrong here? gist.github.com/FCO/e08b717af87627...8147c08b7e | 22:02 | |
it seems my request finds the correct route, executes it but continues trying to execute the other routes and then breaks... | 22:07 | ||
This a smaller version of this (github.com/FCO/HTML-Component/blob...r.rakumod) where I got this error | 22:14 | ||
lizmat: any idea? | 22:15 | ||
lizmat | nothing jumps out :-( | 22:56 | |
jnthn | SmokeMachine: `where` blocks are not closures; they're traits attached at runtime, so there's one static where block | 22:58 | |
SmokeMachine | But when I print inside of it, it prints the right values… 🤔 | 23:00 | |
gist.github.com/FCO/e08b717af87627...-output-L1 | 23:01 | ||
jnthn: 👆 | |||
jnthn | Try a `print` inside of the `where` | ||
The block is a closure, but a signature is not copied per closure | 23:02 | ||
SmokeMachine | That’s a say inside the when… gist.github.com/FCO/e08b717af87627...ile-cli-L9 | ||
And it continues trying even after a True result… | 23:03 | ||
On my original implementation I had made the test a block and passed the block to the where: github.com/FCO/HTML-Component/blob...akumod#L35 | 23:07 | ||
jnthn: 👆 | 23:09 | ||
jnthn: I tried doing `my &where = -> Int $i, Int $actual { say "$actual == $i -> { $actual == $i }"; $actual == $i }` and used it on when like: `post -> Int $a where &where.assuming: $i {...}` | 23:18 | ||
I 'm still getting: www.irccloud.com/pastebin/bBAmBlLc/ | 23:19 | ||
is there a way to do that inside a loop? | 23:21 | ||
or the only solution is have a single route and do the validation inside of it? | 23:23 | ||
jnthn | Nol the `where` block is not a closure. You can try requesting /0 and /1 and probably observe it always compares against the same RHS | ||
It's either that or something EVAL-y | 23:24 | ||
SmokeMachine | ok, I'll try that...thanks | 23:25 | |
jnthn | You can completely golf Cro out of it, fwiw | 23:26 | |
raku -e 'my @x; ^3.map: -> $i { @x.push(-> $ where { say $i; $_ == $i } { say $i }) }; @x[0](0)' | |||
SmokeMachine | yes... | 23:31 | |
m: my @x; ^3 .map: -> $i { @x.push(-> $ where { say $i; $_ == $i } { say $i }) }; @x[0](2) | |||
oh, sorry... no camelia... :( | |||
23:45
sena_kun left
|