🦋 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:01 reportable6 joined 00:25 human_blip left 00:27 human_blip joined
avuserow blogs a bit: dev.to/avuserow/avoiding-the-end-w...ueries-1i1 00:30
00:33 human_blip left 00:34 human_blip joined 01:34 Tirifto joined 01:40 Xliff joined
uzl[m] avuserow: ++ 01:48
02:19 tea3po left, tea3po joined
leont avuserow: TBH, all the advantages you list in your first article apply to SQL::Abstract as well. 02:27
02:36 teatwo joined 02:39 tea3po left 02:41 merp left
avuserow leont: I think SQL::Builder provides an easier way to understand what SQL is generated vs SQL::Abstract. For instance, the majority of SELECT queries in my application have one join, if not more 02:58
I didn't see if Abstract supports multiple joins and subqueries, and I think the DSL gets in the way here 02:59
I do think that Abstract's DSL is way nicer for smaller queries 03:00
elcaro I mentioned before, but FYI it appears raku.land has not refreshed in 3 days 03:01
avuserow though there is an interesting gotcha with SQL::Abstract and many other query builders: blog.kazuhooku.com/2014/07/the-json...ility.html - this reflects on some Perl 5 modules but the same thing applies. 03:03
tldr: if you accept JSON input from users, and use that in your query syntax, users can influence your queries more than you'd expect. SQL::Builder avoids this in its where clause syntax 03:05
elcaro: I also mentioned this in #raku-land, hopefully they can take a look 03:07
elcaro Thanks avuserow 03:16
03:41 evalable6 left, linkable6 left, linkable6 joined, evalable6 joined
Xliff Huh! I just used ChatGPT to write some OpenGL code for me.... and it finally worked! (I've been at this all day) 03:59
04:06 closetfourtwenty joined 04:08 closetfourtwenty left 04:37 Xliff left 05:01 teatime joined 06:00 reportable6 left, reportable6 joined 07:00 greppable6 left, evalable6 left, linkable6 left, shareable6 left, committable6 left, releasable6 left, coverable6 left, statisfiable6 left, bloatable6 left, notable6 left, squashable6 left, sourceable6 left, unicodable6 left, reportable6 left, tellable6 left, bisectable6 left, nativecallable6 left, benchable6 left, quotable6 left 07:01 greppable6 joined, shareable6 joined, tellable6 joined, reportable6 joined 07:02 evalable6 joined, committable6 joined, coverable6 joined, bloatable6 joined, unicodable6 joined 07:03 sourceable6 joined, linkable6 joined, benchable6 joined, squashable6 joined, quotable6 joined, notable6 joined, nativecallable6 joined 07:04 bisectable6 joined, statisfiable6 joined, releasable6 joined
gfldex It was only a matter of time for humans to automate cargo culting. 07:19
07:33 merp joined
Nemokosch ultimately, sigilless variables bind on first assignment 07:36
that's all their peculiarity 07:37
07:51 Xliff joined 08:11 sena_kun joined 08:12 squashable6 left 08:15 squashable6 joined 08:24 Xliff left 08:48 Sgeo left 10:12 evalable6 left, linkable6 left 10:13 linkable6 joined, evalable6 joined 11:13 linkable6 left 11:14 linkable6 joined 12:00 reportable6 left 12:02 reportable6 joined
leont avuserow: it does support both multiple joins and subqueries, but you're right I don't have that well documented. 12:04
And yeah, the insertion issue is real. I'm working on a solution though. 12:05
The only overload in conditional that's reachable and potentially problematic is the Map one, so I just have to replace that 12:10
12:15 squashable6 left 12:17 squashable6 joined 12:34 teatime left, teatime joined
leont And arguably the Any:U case, but I can replace that with Nil when I eliminate the Hash case 12:43
13:34 linkable6 left, evalable6 left 13:35 evalable6 joined
SmokeMachine coleman: did you have time to take a look at github.com/FCO/nats ? Please let me know your opinions 13:36
13:37 linkable6 joined
coleman I did not yet. I can recommend you join their Slack, if you haven't already. They are quite friendly. 14:09
General advice? Focus on the "core" client protocol first: connections, pub/sub, topics/subjects. 14:13
Then auth subsystem. They are quite sophisticated with auth. But NATS is also usable without auth. 14:15
SmokeMachine coleman: thanks! Great advices! Currently my client is handling only ping, pong, pub, sub and msg. And also accepts partially info and sends connect… 14:17
coleman: I haven’t even touched auth yet…
coleman At the very end, layer on the Jetstream stuff. It should be a clean abstraction over core NATS. The core protocol has been around a while and is stable.
Good!!! 14:18
it can wait.
SmokeMachine But I think my next step will be write some tests… there are not tests yet… 14:19
14:21 tea3po joined 14:24 teatime left 14:25 teatwo left, teatime joined 14:46 Xliff joined
Xliff \o 14:47
15:00 tea3po left, teatime left
uzl[m] I'm reading this codesections's RA article (raku-advent.blog/2022/12/20/sigils/), and I'm like "the docs should have this table summarizing sigils so let me create an issue" until I go to the sigils page, and the table is already there lmao. 10/10 for foresight lol 15:01
15:01 tea3po joined, teatime joined 15:02 tea3po left, teatime left 15:03 tea3po joined, teatime joined 15:23 codesections joined
librasteve o/ 15:32
anyone know how I take a list of Str and parse in the same way as angle bracket literal like this <42 42e0 42/1 42.0> 15:34
ie. to result in a list of Allomorphs?
(trying to avoid MONKEY-SEE-NO-EVAL) 15:38
SmokeMachine m: say “42 42e0 42/ 42.0”.words.map: val * 15:43
camelia Value of type Whatever uselessly passed to val()
in block <unit> at <tmp> line 1
Cannot map a Seq using '*'
Did a * (Whatever) get absorbed by a list?
in block <unit> at <tmp> line 1
SmokeMachine m: say “42 42e0 42/ 42.0”.words.map: .&val
camelia Value of type Any uselessly passed to val()
in block <unit> at <tmp> line 1
Cannot map a Seq using 'Any'
Did a * (Whatever) get absorbed by a list?
in block <unit> at <tmp> line 1
librasteve ah - val is exactly what I need - brilliant! 15:46
SmokeMachine m: say “42 42e0 42/1 42.0”.words.map: *.&val 15:50
camelia (42 42e0 42/1 42.0)
15:53 teatime left, tea3po left
SmokeMachine m: say “42 42e0 42/1 42.0”.words.map: *.&val.^name 15:58
camelia (IntStr NumStr RatStr RatStr)
16:24 derpydoo joined 16:27 teatime joined
SmokeMachine Does anyone have a suggestion on how Nats::Server should be called? It’s not a service… but I don’t think it should be called client… any suggestions? github.com/FCO/nats/issues/1 16:28
16:36 discord-raku-bot left 16:37 discord-raku-bot left, discord-raku-bot joined
uzl[m] m: my $a := 3; say $a; $a := 'hi'; say $a; 17:36
camelia 3
hi
uzl[m] m: my \b := 3; say b; b := 'hi'; say b; 17:37
camelia ===SORRY!=== Error while compiling <tmp>
Cannot bind to 'b' because it is a term and terms cannot be rebound
at <tmp>:1
------> my \b := 3; say b; b := 'hi'⏏; say b;
uzl[m] Why can I re-bind to a sigilled variable?
17:37 linkable6 left, evalable6 left 17:38 linkable6 joined 17:39 evalable6 joined
lizmat uzl[m]: because a sigilless item is a "term", and you cannot change terms (as the error message says) 17:39
if you want to be able to re-bind, bind to a variable
m: my $a := 42; $a := 666; say $a
camelia 666
uzl[m] Got it! How is a "term" defined in Raku? There's docs.raku.org/language/terms but it doesn't provide a definition 17:44
SmokeMachine m: sub term:<bla>() { 42 }; say bla 17:45
camelia 42
Nemokosch what is this for? 17:46
uzl[m] "You can use term:<> to introduce new terms, which is handy for introducing constants that defy the rules of normal identifiers:" 17:48
Thanks, I just read this lol
18:00 reportable6 left 18:02 reportable6 joined 18:06 jpn joined
Nemokosch m: my \term:<-foo> = 12; say -foo; 18:13
Raku eval 12
Nemokosch lol, magic
18:13 derpydoo left 18:14 jpn left
lizmat appears unstoppable: dev.to/lizmat/walking-the-rakuast-tree-3fbd 18:23
avuserow lizmat++ # unstoppable blogging :) 18:26
18:31 xtallove joined 18:32 xtallove left 18:37 kitty joined 18:41 kitty is now known as xtallove 18:42 Sgeo joined 18:52 xtallove left 19:01 jpn joined 19:06 jpn left 19:55 jpn joined 20:04 jpn left 20:56 Xliff left 21:11 sena_kun left 21:14 derpydoo joined 21:18 samebchase0 joined 21:19 samebchase left, samebchase0 is now known as samebchase 21:43 coleman left, sena_kun joined 21:44 jpn joined, coleman joined 21:49 jpn left 21:50 sena_kun left 21:52 Xliff joined
Xliff Can a proto affect the multi that is used? 21:52
m: proto sub a (|c) { if (c.head % 2).not { nextwith(|c) } else { say "Bleah!" }; }; multi sub a ($b) { say "Non-bleah!" }; a(2); a("P")
camelia nextwith is not in the dynamic scope of a dispatcher
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff I'd like the proto to run first and then determine which multi is run after. 21:53
lizmat a proto can be a sub / method like anything else 21:55
you do {*} to do the dispatch
Xliff Yes, but you cannot affect the dispatched called, correct? 21:56
So I'd have to do something akin to.... 21:57
lizmat well, you can fetch the available candidates in the proto and then call them depending on something else?
Xliff How would I do that?
lizmat self.^candidates ?
Xliff Oh. use .^cando and then dispatch to the method itself?
lizmat e.g. yes
Xliff OK. I got it. 21:58
Thanks!
lizmat yw :-)
Xliff m: multi sub a (|c) { if (c.head % 2).not { samewith(|c, :int) } else { samewith(|c, :str); }; multi sub a ($b, :$int is required) { say "Non-bleah!" }; multi sub a ($b, :$str is required) { say "Bleah!" }; a(2); a("P") 22:01
camelia ===SORRY!=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> required) { say "Bleah!" }; a(2); a("P")⏏<EOL>
expecting any of:
statement end
statement modifier
statement modifier loo…
Xliff m: multi sub a (|c) { if (c.head % 2).not { samewith(|c, :int) } else { samewith(|c, :str); }; }; multi sub a ($b, :$int is required) { say "Non-bleah!" }; multi sub a ($b, :$str is required) { say "Bleah!" }; a(2); a("P")
camelia Non-bleah!
Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏P' (indicated by ⏏)
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: multi sub a (|c) { if (c.head ~~ Int && c.head % 2).not { samewith(|c, :int) } else { samewith(|c, :str); }; }; multi sub a ($b, :$int is required) { say "Non-bleah!" }; multi sub a ($b, :$str is required) { say "Bleah!" }; a(2); a("P")
camelia Non-bleah!
Non-bleah!
Xliff m: multi sub a (|c) { if (c.head ~~ Int && c.head % 2).not { samewith(|c, :int) } else { samewith(|c, :str); }; }; multi sub a ($b, :$int is required) { say "Non-bleah!" }; multi sub a ($b, :$str is required) { say "Bleah!" }; a(3); a("P") 22:02
camelia Bleah!
Non-bleah!
Xliff Something like that...
m: multi sub a (|c) { if (c.head ~~ Int && c.head % 2).not { samewith(|c, :odd) } else { samewith(|c, :str); }; }; multi sub a ($b, :$str is required) { say "Non-bleah!" }; multi sub a ($b, :$odd is required) { say "Bleah!" }; a(3); a("P") 22:03
camelia Non-bleah!
Bleah!
Xliff m: multi sub a (|c) { if (c.head ~~ Int && c.head % 2).not { samewith(|c, :str) } else { samewith(|c, :odd); }; }; multi sub a ($b, :$str is required) { say "Non-bleah!" }; multi sub a ($b, :$odd is required) { say "Bleah!" }; a(3); a("P") 22:04
camelia Bleah!
Non-bleah!
22:33 derpydoo left 23:33 jpn joined 23:38 jpn left 23:52 TieUpYourCamel left