🦋 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 inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
00:00 reportable6 left, reportable6 joined 00:04 MasterDuke left 00:12 japhb left 00:13 japhb joined 01:13 nativecallable6 left, reportable6 left, quotable6 left, bloatable6 left, squashable6 left, greppable6 left, bisectable6 left, coverable6 left, evalable6 left, statisfiable6 left, unicodable6 left, sourceable6 left, notable6 left, committable6 left, linkable6 left, shareable6 left, benchable6 left, releasable6 left, squashable6 joined, committable6 joined 01:14 bloatable6 joined, evalable6 joined, greppable6 joined, benchable6 joined 01:15 bisectable6 joined, reportable6 joined, unicodable6 joined, releasable6 joined 01:16 shareable6 joined 01:28 razetime joined 02:14 nativecallable6 joined 02:15 statisfiable6 joined 02:16 linkable6 joined, SqrtNegInf left 02:42 razetime left 03:02 nine left, m_athias left, nine joined 03:03 m_athias joined 03:04 razetime joined 03:14 coverable6 joined, quotable6 joined 03:15 notable6 joined 03:49 razetime left 03:51 ocomport left 04:01 amenonsen left 04:09 amenonsen joined 04:14 xinming left 04:15 sourceable6 joined 04:21 razetime joined 04:47 xinming joined 05:16 tejr left, tejr joined 05:52 djerius left, tejr left 05:57 djerius joined 05:59 tejr joined 06:00 reportable6 left 06:07 djerius left, djerius joined 06:08 tejr left, Sgeo left 06:09 tejr joined 06:10 tejr left 06:39 perlmaros left 06:44 perlmaros joined 07:26 Summer left, Summer joined 07:32 tejr joined 07:55 frost joined 08:02 frost left 08:17 abraxxa-home joined 08:22 abraxxa-home left 08:24 abraxxa-home joined 08:26 razetime left 08:34 MasterDuke joined 08:36 jjido joined 08:37 razetime joined 08:46 razetime left 08:47 razetime joined 09:29 jjido left 09:59 sena_kun left 10:00 reportable6 joined 10:01 sena_kun joined 10:05 MasterDuke left
tbrowder hi, all 10:13
lizmat tbrowder o/ 10:15
Nemokosch 👋 10:16
tbrowder i need to dynamically use a class' attributes. i know it can be done (moritz demoed it) but i cannot remember the syntax. say i have a class Foo with attribute a is rw, i would like to do something like my $attr = "a". my $o = Foo.new; $o.{$attr} = 5; 10:18
lizmat: hi
lizmat $o.attr = 5 10:19
m: class Foo { has $.a is rw }; my $f = Foo.new; $f.a = 42; dd $f
camelia Foo $f = Foo.new(a => 42)
tbrowder yes, that's known, but how can i have an external scalar define the attribute name and use it with the class object? 10:23
in perl one could separate the object's arrow with whitespace and use a var for the attribute name 10:24
moritz docs.raku.org/routine/get_value 10:25
also set_value
lizmat m: class A { has $.foo = 42 }; my $a = A.new; my $b = "foo"; $a."$b"() 10:26
camelia ( no output )
lizmat m: class A { has $.foo = 42 }; my $a = A.new; my $b = "foo"; say $a."$b"()
camelia 42
tbrowder i'm not explaining this very well
10:26 frost joined
tbrowder ah, my george that's it! thnx! 10:27
*by
Nemokosch my george? xD
10:27 Xliff joined
lizmat it's a euphemism for "by Jove" I believe :-) 10:27
Xliff \o
tbrowder "by george" a mild epithet
Xliff gist.github.com/Xliff/74ffdc15f4c2...49240c5e78
tbrowder yes, same as by jove 10:28
Nemokosch I think you explained it well - that is, if you really meant this $a."$b"()
10:29 MasterDuke joined
this is too advanced language use for me o.O 10:29
tbrowder yes. that may be in docs but i can't find it. it is probably in one of our raku/perl books 10:30
10:36 frost left
Xliff Could someone take a look at that gist and see if I am missing something obvious which would account for the referenced error message? 10:39
TIA
lizmat Xliff: please provide a full stacktrace with the gist 10:42
Xliff --ll-exception? 10:43
lizmat yup
Xliff One sec
Done 10:44
lizmat and t/10-raw-hashtable.t ? 10:45
Xliff That's the listing in the gist. 10:46
Added a header to make that clear.
lizmat where is g_hash_table_insert defined ? 10:47
Xliff In the listing to t/10-raw-hashtable.t 10:48
It's the... 2nd sub definition
lizmat ack
Xliff :)
I made this as self-contained as possible! 10:49
My golfs tend to be an entire course. 10:50
lizmat why are you using := on the guint and gboolean definition ?
could you make that "=" ?
Xliff No particular reason. That's very old code.
Yes, I can.
Do you think that would make a difference
?
lizmat the "uint32" makes it suspect to me, as that has recently had changes 10:51
internally
Xliff Nah. No diff.
Oh, hey! My uints are actually unsigned, now! 10:54
nine++\ 10:55
lizmat { * } perhaps {*} ?
Xliff That has caught me before, but never on NC stubs. Attempting.
Nope. 10:56
lizmat then I'm out of ideas :-(
Xliff I am legit confused, because I don't know where in that code a Whatever could be injected.
I thought like you did and couldn't fix it. 10:57
It's weird because much of my other code works and they all use "{ * }"
So why these particular routines?!
lizmat: So... bug it?
lizmat guess so... it looks like a golf people could work with 10:58
tbrowder ref dynamic attr help: i think that's the last piece needed to port a very ugly Perl module to a much more attractive Raku module. thanks again, lizmat (and moritz)!
Xliff OK
tbrowder this time i did as todd does and saved it in a README keeper 10:59
Xliff #4820 11:04
lizmat yeah, just saw it coming in :-)
Xliff lizmat: Thanks for taking a look. 11:06
Now off to $dayJob.
11:31 razetime left 11:34 razetime joined 11:37 perlbot_ joined, perlbot left 11:38 perlbot_ is now known as perlbot 11:51 Altai-man joined 12:00 reportable6 left 12:02 reportable6 joined 12:08 Altai-man left 12:11 Altai-man joined
Xliff Has anyone used raku to successfully send commands to mysql? 12:48
lizmat DBish supports MySQL, doesn't it ? 12:52
Xliff Yes, but for reasons... I need to go through the client. 13:11
I've tried using run(:in), but it doesn't seem to work. 13:12
13:39 jjido joined 14:24 jjido left 14:25 mjgardner left 14:27 jjido joined, mjgardner joined 14:33 razetime left 14:34 razetime joined 14:35 razetime left, razetime joined
moritz how does it not work? 14:55
MasterDuke moritz: have you seen github.com/rakudo/rakudo/pull/4807 ? 15:05
15:10 jjido left
Voldenet Xliff: mysql (well, mariadb in this case) works for me ix.io/3SKU 15:10
15:11 Util left
Voldenet I needed libmysqlclient, because DB::MySQL installs just fine even without it 15:11
Xliff Voldenet++ 15:13
Ah, but that is not through the client. 15:14
No matter. I think I've worked around most of it.
Thanks for looking, though.
Voldenet Oh right, I missed the /through the client/ part
Xliff :)
moritz MasterDuke: I have, but I'm allergic to these low-level builtins, so not commenting on the PR 15:16
the part in the actions is cool though
MasterDuke ha. well, fwiw, the one commit where i really had a question is just github.com/rakudo/rakudo/pull/4807...fa2b5e4531 15:17
15:24 discord-raku-bot left 15:25 discord-raku-bot joined
Voldenet Xliff: ix.io/3SKY actually it wasn't that complicated fortunately 15:25
i'm sure it'd be even better with –defaults-file instead of stdin password 15:28
(i just wrote this for the sake of finishing what I started)
btw, I'm quite surprised that this way of providing password works, I wouldn't have expected that 15:35
15:36 Sgeo joined 16:34 djerius left, djerius joined
Xliff Voldenet: Huh! And here I was using run()! 16:44
16:46 bdju left 16:48 bdju joined 16:59 razetime left 17:15 Kaiepi left
Xliff So. 17:23
It turns out that if you have a NativeCall stub ala: sub malloc (uint64 $size) returns pointer is native { * }
You CANNOT use &malloc as a function pointer. 17:24
Not directly. It must be surrounded by an anonymous sub.
Otherwise Rakudo will used the subs defined block, and ignore the NativeCall traits.
This is the root cause of #4820
18:02 Kaiepi joined 18:08 reportable6 left 18:10 Altai-man left, reportable6 joined 18:17 jjido joined 18:32 donpdonp- joined 18:34 donpdonp|z_ left 18:55 jjido left 19:25 p6steve joined 20:25 dg left 20:32 Util joined 21:25 discord-raku-bot left, discord-raku-bot joined 21:53 jmcgnh left 22:01 jmcgnh joined 22:04 abraxxa-home left 22:07 p6steve left 22:19 p6steve joined 22:23 p6steve left 22:36 p6steve joined 22:40 p6steve left 22:53 p6steve joined 22:57 p6steve left, colemanx joined 23:10 p6steve joined 23:14 p6steve left 23:25 jjido joined 23:29 p6steve joined 23:31 ismustachio joined 23:55 dg joined