🦋 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 00:05 jpn joined 00:07 deoac joined 00:10 jpn left 00:34 NemokoschKiwi left 00:48 jpn joined 00:49 rakuuser left 00:53 jpn left 00:58 AlexDaniel left 01:03 xinming left 01:06 xinming joined 01:41 jpn joined
rf Does anyone know if DBIish does transactions 01:42
I just want to run a huge SQL script with DBIish 01:43
01:45 systems joined
tonyo github.com/raku-community-modules/...test#L1742 01:46
postgres and oracle both work too
01:46 jpn left
Geth ¦ doc: cfa self-assigned Document trap: `use lib` with a huge directory is super slow github.com/Raku/doc/issues/2199 01:52
02:12 Guest5682 joined, deoac left, Guest5682 is now known as tg57 02:29 tg57 left 02:33 rf left 02:45 jgaz left 02:56 snonux left 02:57 snonux joined, samebchase2 joined 02:58 samebchase left, samebchase2 is now known as samebchase 03:09 tg57 joined, tg57 left
Geth ¦ doc: coke self-assigned Change document extension from .pod6 to .rakudoc github.com/Raku/doc/issues/3785 03:11
03:29 jpn joined 03:34 jpn left 03:55 systems left 03:58 razetime joined 04:18 razetime left
Geth doc/main: 7a54ae3f3f | (Will Coleda)++ | 5 files
remove unused utils

add comments to remaining items so we know what they're for.
Closes #3906
¦ doc: coke assigned to codesections Issue util/list-missing-methods failure github.com/Raku/doc/issues/4223 04:36
¦ doc: coke unassigned from taboege Issue Checklist for 2019.03 github.com/Raku/doc/issues/2673 04:38
doc/main: a6f46aeffc | (Daniel Green)++ | CREDITS
Add myself to the credits
05:10 razetime joined 05:18 jpn joined 05:21 oodani left 05:22 oodani joined, jpn left 05:32 melezhik joined 05:41 melezhik left 05:43 melezhik joined 06:00 reportable6 left, melezhik left 06:01 reportable6 joined 06:31 razetime left 06:49 squashable6 left 06:52 squashable6 joined 07:01 jpn joined 07:05 jpn left
SmokeMachine rf: yes, DBIish does transactions 07:32
tellable6 SmokeMachine, I'll pass your message to rf 07:33
07:50 abraxxa joined, silug left 07:51 silug joined 07:55 abraxxa left, abraxxa joined 08:12 Sgeo left 08:15 abraxxa left 08:19 abraxxa joined 08:23 abraxxa left, abraxxa joined 08:49 jpn joined 08:54 jpn left 09:01 jpn joined 09:10 sena_kun joined 09:16 sftp left, sftp_ joined, sftp_ is now known as sftp 09:50 sena_kun left 10:03 razetime joined 10:14 sena_kun joined 10:18 sena_kun left
tadzik I've stumbled upon this mastodon.social/@alexkalopsia/1099...9695818290 and I wonder how to reproduce it in Raku – it feels like it should give you nice numbers like that easily, but I can't get it right 10:19
tellable6 2020-03-25T22:48:00Z #raku-dev <patrickb> tadzik: Rakubrew is (slowly) getting to the point of working reliably. What's your stance wrt rakudobrew? Should it officially be deprecated?
tadzik wow, I've been missing some messages 10:20
m: say 1/998.001 # sad
camelia 0.001002
lizmat m: printf("%.300f",(1 / 998.001).FatRat) 10:23
camelia 0.001002003004005006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000…
tadzik FatRat! That's it, thanks :)
lizmat nah, it isn't ?
tadzik hum, indeed 10:24
Nemokosch the conversion should happen earlier, right?
this is a situation where an adverb might be nice
lizmat the size of the printf format should be enough 10:25
Nemokosch isn't (1 / 998.001) evaluated too early for that?
tadzik m: printf("%.300f",1 / 998.001.FatRat) # doesn't help 10:26
camelia 0.001002003004005006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000…
Nemokosch oh okay, the precision isn't lost here, it's just not displayed well... 10:28
tadzik it seems to me like it does get lost
m: printf("%.30f", (1 / 998.001.FatRat) * 100000) 10:29
camelia 100.200300400500600000000000000000
Nemokosch m: (1 / 998.001).FatRat * 100000 andthen .raku.say
Raku eval FatRat.new(100000000, 998001)
Nemokosch seems accurate 10:30
lizmat PR to introduce Rat.Str(:digits) coming up 10:46
10:47 razetime left 10:55 sena_kun joined
lizmat github.com/rakudo/rakudo/pull/5223 10:56
tadzik ^^ 11:00
11:38 rakuuser joined 11:53 codesections left 12:00 reportable6 left 12:01 reportable6 joined 12:11 thundergnat joined
thundergnat Rat.Str(:digits) Huh. That's pretty much what my Rat::Precise module does. github.com/thundergnat/Rat-Precise Which, oddly enough isn't showing up on raku.land :-( 12:13
It also has a :z flag to preserve trailing zeros, if desired
12:14 thundergnat left
lizmat TIL 12:15
Nemokosch it doesn't hurt to have something like this in the core, though, does it 12:19
lizmat nope
el m:perl dd &say.WHAT 12:25
Raku eval Sub
el a Sub containing native code?
m:perl dd &say
Raku eval Sub say = proto sub say (|) {*}
lizmat why the perl there ? 12:26
Nemokosch it gives highlighting (and there is no Raku highlighting on Discord)
lizmat ah, ok
but yeah, "say" is an ordinary multi sub 12:27
el so a sub can contain both moarvm code and native code 12:29
lizmat what makes you think that? 12:30
a sub is just a Block with a name and a "return" target
12:31 jpn left
lizmat a Block is a scope with a signature and a list of statements 12:32
that ultimately results in bytecode to be executed by whatever backend is in use
if you run on MoarVM, then it will be moarvm bytecode
on JVM, it will be JVM bytecode 12:33
Nemokosch does multiple dispatch work on sheer Blocks?
lizmat nope, dispatch is a Sub / Method thikng
Nemokosch 👍
el - is native - i thought say is in native code because i assume builtins are written in C and compiled to native code 12:35
it is not
Geth doc: tbrowder++ created pull request #4224:
Correct the intended zero-width index entries
lizmat nope: *NONE* of the core is written in C
it is *all* Raku bytecode
afk for a bit&
el really is raku fast enough that writing the core in raku is no longer a liability 12:38
Nemokosch The truth is, a significant t of the core has been rewritten in NQP 12:40
.s/t/part/ 12:41
NQP is pretty darn fast and completely interoperable with "vanilla" Raku 12:43
12:43 rakuuser left, jdv left 12:44 jdv joined
ugexe fwiw there is always a cost of having something in the core 12:46
12:46 Woodi_ joined
ugexe if that implementation ends up being wrong in some way that isn't immediately apparent you end up with a php like language where a bunch of the built in functions have "safe" or legit alternatives 12:46
12:48 xkr47_ joined
ugexe also writing the core in something other than raku could been seen as a liability since rakudo can optimize raku, and in the future probably enough so as to be faster than e.g. nqp 12:50
Nemokosch PHP has also come a long way since the five 🙂 12:51
ugexe that being said we're obviously not there yet, but porting between nqp <-> raku isn't *that* hard
sure, and they still has to have stuff like sql safe or whatever 12:52
bug compatibility is a real thing 12:53
to pick on .Str(:digits) for a moment: one might argue it should be a count of *all* digits, one might argue it should only be digits after the decimal 12:55
its called digits afterall
12:56 silug left, xinming left, epony left, linkable6 left, samcv left, perlbot left, Scotteh left, nativecallable6 left, tellable6 left, benchable6 left, sourceable6 left, bloatable6 left, unicodable6 left, statisfiable6 left, tinita left, energizer left, bartolin_ left, tobs left, japhb left, jjatria left, sivoais left, corwin left, ecocode_ left, xkr47 left, polettix_ left, destroycomputers left, Ulti_ left, Woodi left, nicole left, nebuchadnezzar left, gordonfish left, hexology left, xkr47_ is now known as xkr47, hexology joined
ugexe eventually someone will want the other variant, yet the original name that implies both will only apply to one while the other has some name detached from other variants argument/parameter/whatever 12:56
12:56 energizer joined
ugexe at least from a naming perspective one solution is to not hummanize things that may not really need it 12:57
12:57 jpn joined
ugexe .Str(:trailing-digits) for instance 12:57
I don't really have any strong feels on .Str(:digits) fwiw, i'm just using it as an exmaple because it just came up 12:59
13:01 epony joined, silug joined, xinming joined, linkable6 joined, samcv joined, perlbot joined, Scotteh joined, nativecallable6 joined, tellable6 joined, benchable6 joined, sourceable6 joined, bloatable6 joined, unicodable6 joined, statisfiable6 joined, tinita joined, bartolin_ joined, tobs joined, japhb joined, jjatria joined, sivoais joined, corwin joined, ecocode_ joined, polettix_ joined, destroycomputers joined, Ulti_ joined, nicole joined, nebuchadnezzar joined, gordonfish joined 13:04 epony left, perlbot left 13:05 epony joined 13:07 jpn left
ugexe but like in regex ① is a digit so theoretically things like FatRat.new(①).Str(...) should be considered (my guess is this already just works because raku is good like that, but it should still have been considered) 13:07
13:08 perlbot joined
ugexe then again i typically paralyze myself when considering all this stuff :P 13:09
lizmat well, thundergnat showed Rat::Precise, and I think that would make an excellent addition to the core 13:14
Nemokosch again there are very different attitudes to this stuff, bug compatibility and all
I tend to agree that even something that is arguably a bugfix could in theory mess something up somewhere else, and if it hasn't been specified either way, it's just as much a breaking change as it is a fix 13:15
ugexe i mean people also say zef would make a good addition to the core, which i would also disagree with
lizmat I can see that: you want to be able to update zef without needing to update the core 13:17
ugexe well, we need the raku programs that we leave behind e.g. previous workplaces to keep working hopefully without anyone having to fix it and get a bad impression. if it wasn't for that i'd mostly be all for not considering bug-compatibility at all
well the not just that, but like zef is also things like invoking curl/wget/tar etc in a OS dependant way 13:18
lizmat ack 13:19
13:20 jpn joined, epony left 13:25 euandreh left 13:29 jpn left 13:30 nebuchad` joined 13:31 nebuchadnezzar left 13:32 jpn joined 13:53 epony joined
Geth ¦ doc: coke unassigned from Scimon Issue Proc::Async Example needs to be modified to run on Windows 10 github.com/Raku/doc/issues/1453 14:12
¦ doc: coke self-assigned Proc::Async Example needs to be modified to run on Windows 10 github.com/Raku/doc/issues/1453
¦ doc: coke assigned to tbrowder Issue update humorous subtitle github.com/Raku/doc/issues/4202 14:18
el rakudo -> nqp -> C thats 2 levels of abstraction 14:20
Geth ¦ doc: coke self-assigned Differentiate clearly "version" and "release" github.com/Raku/doc/issues/3843 14:21
el is that only possible with JITing rakudo hasn't come to that level yet
14:43 Altai-man joined 14:44 sena_kun left 14:47 jgaz joined 15:26 rf joined 15:38 Sgeo joined
Geth rakudoc: pheix++ created pull request #23:
Migrate to Pod::Utils
15:52 epony left 15:53 epony joined 16:23 razetime joined 16:44 abraxxa left 16:51 euandreh joined
tonyo m: use Rat::Precise; 16:54
camelia ===SORRY!=== Error while compiling <tmp>
Could not find Rat::Precise in:
17:07 simcop2387 left, perlbot left 17:09 simcop2387 joined 17:10 perlbot joined 17:17 razetime left
Geth doc/finanalyst-patch-1: 1da99fc750 | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Language/community.pod6
Update community.pod6

Remove reference to perl.meetup.com as it no longer exists
doc: finanalyst++ created pull request #4226:
Update community.pod6
doc/main: ade0e7f024 | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Language/community.pod6
Update community.pod6 (#4226)

Remove reference to perl.meetup.com as it no longer exists
doc/finanalyst-patch-3: ec9a23baad | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Language/faq.pod6
Update faq.pod6

edit the zef url so that it is recognised by modules.raku.org remove reference to p6doc, which is not being found there,
17:41 QhpAptyj9hj0RQwM joined
Geth doc/finanalyst-patch-1: 2147d8e975 | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Language/modules.pod6
Update modules.pod6

The example changed. So make the link work.
doc: finanalyst++ created pull request #4228:
Update modules.pod6
doc/finanalyst-patch-4: a80750c26d | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Language/modules-extra.pod6
Update modules-extra.pod6
doc: finanalyst++ created pull request #4229:
Update modules-extra.pod6
doc/finanalyst-patch-5: f5b68eb63f | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Type/DateTime.pod6
Update DateTime.pod6
doc: finanalyst++ created pull request #4230:
Update DateTime.pod6
18:00 reportable6 left 18:02 reportable6 joined 18:10 TieUpYourCamel left, Altai-man left
Geth doc/main: a575049cda | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Language/modules.pod6
Update modules.pod6 (#4228)

The example changed. So make the link work.
doc: cfa++ created pull request #4231:
Document potential performance penalties for filesystem repos (#2199)
18:35 linkable6 left 18:38 linkable6 joined
Geth doc/main: 160b0cfd87 | cfa++ (committed using GitHub Web editor) | 2 files
Document potential performance penalties for filesystem repos (#4231)

Closes #2199.
19:02 dustinm`_ left 19:08 linkable6 left 19:10 linkable6 joined 19:17 sena_kun joined 19:18 archenoth joined 19:21 Oshawott left 19:23 dustinm` joined
Geth doc: cfa++ created pull request #4232:
Clarify the role of META6.json in filesystem repos
19:39 jpn left
Geth doc/main: 60c752d207 | cfa++ (committed using GitHub Web editor) | doc/Language/traps.pod6
Clarify the role of META6.json in filesystem repos (#4232)

Relates to #2199 and comments on #4231.
19:51 jpn joined 20:01 jpn left 20:09 jpn joined 20:36 amenonsen left, jpn left 20:40 lichtkind joined 20:50 jpn joined 20:54 jgaz left 21:05 sftp left 21:06 sftp joined 21:07 jpn left 21:23 vrurg left 21:24 vrurg joined 21:45 Xliff joined
Xliff \o 21:46
m: "test".IO.spurt("TestTestTest"); given "test".IO.open(:rw) { .seek(0, SeekFromBeginning); .spurt("BLEAH!"); .close; "test".IO.slurp.say }
camelia Failed to open file /home/camelia/test: Is a directory
in block <unit> at <tmp> line 1
Xliff m: "/tmp/test".IO.spurt("TestTestTest"); given "/tmp/test".IO.open(:rw) { .seek(0, SeekFromBeginning); .spurt("BLEAH!"); .close; "/tmp/test".IO.slurp.say }
camelia BLEAH!stTest
Xliff ^^ Isn't that a bug?
If not, how can I correct it so the output doesn't contain the results of the previous .spurt? 21:47
m: "use NativeCall; sub ftruncate(int32, uint64) is native(*); /tmp/test".IO.spurt("TestTestTest"); given "/tmp/test".IO.open(:rw) { .seek(0, SeekFromBeginning); .spurt("BLEAH!"); .ftruncate(.native-descriptor, 6); close; "/tmp/test".IO.slurp.say } 21:50
camelia ===SORRY!=== Error while compiling <tmp>
Calling close() will never work with signature of the proto ($, *%)
at <tmp>:1
------> "); .ftruncate(.native-descriptor, 6); ⏏close; "/tmp/test".IO.slurp.say }
Xliff m: "use NativeCall; sub ftruncate(int32, uint64) is native(*); /tmp/test".IO.spurt("TestTestTest"); given "/tmp/test".IO.open(:rw) { .seek(0, SeekFromBeginning); .spurt("BLEAH!"); ftruncate(.native-descriptor, 6); close; "/tmp/test".IO.slurp.say }
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
ftruncate used at line 1. Did you mean 'truncate'?
rf I'm not sure what would be the bug here 21:53
tellable6 2023-03-01T07:33:01Z #raku <SmokeMachine> rf: yes, DBIish does transactions
ugexe open with :truncate?
Xliff m: "/tmp/test".IO.spurt("TestTestTest"); given "/tmp/test".IO.open(:rw) { .seek(0, SeekFromBeginning); .spurt("BLEAH!"); .close; "/tmp/test".IO.slurp.say }
camelia BLEAH!stTest
Xliff ugexe: I don't want to clear the contents of the file before I can read them. 21:54
I also would rather not have to open the file twice.
rf I think this is just a side-effect of buffered IO 21:55
But I could be wrong
Xliff Right. so the big question is how can I truncate the extra "stTest"
rf You want that to be removed?
Xliff Yep.
File should end at "!" 21:56
m: "/tmp/test".IO.spurt("TestTestTest"); given "/tmp/test".IO.open(:rw) { my $c = .slurp; .seek(0, SeekFromBeginning); .spurt("BLEAH!"); .close; "/tmp/test".IO.slurp.say; $c.say }; 21:57
camelia BLEAH!stTest
21:57 jpn joined
Xliff m: "/tmp/test".IO.spurt("TestTestTest"); given "/tmp/test".IO.open(:rw, :truncate) { my $c = .slurp; .seek(0, SeekFromBeginning); .spurt("BLEAH!"); .close; "/tmp/test".IO.slurp.say; $c.say }; 21:57
camelia BLEAH!
rf m: "test".IO.spurt("TestTestTest"); say "test".IO.slurp; "test".IO.spurt("BLEAH!"); say "test".IO.slurp;
camelia Failed to open file /home/camelia/test: Is a directory
in block <unit> at <tmp> line 1
Xliff Note that opening with :truncate leaves the last "TestTestTest" empty. That is not what I want.
rf m: "/tmp/test".IO.spurt("TestTestTest"); say "/tmp/test".IO.slurp; "/tmp/test".IO.spurt("BLEAH!"); say "/tmp/test".IO.slurp; 21:58
camelia TestTestTest
rf I think there's a way just to clobber the file
with spurt
ugexe spurt has some other options that open() does, maybe it makes sense for it to have :truncate
rf m: "/tmp/test".IO.spurt("TestTestTest"); say "/tmp/test".IO.slurp; spurt "/tmp/test", "BLEAH!"; say "/tmp/test".IO.slurp; 21:59
camelia TestTestTest
22:00 ToddAndMargo joined
Xliff rf: *sigh* --- Did I mention that the opened file must be locked? Which is why I do not want to perform several file ops. 22:01
Sorry if I didn't.
Xliff headdesks
ugexe: No, :truncate erases the contents of the file. I need to read that out before the .spurt.
IO::Handle.spurt only has :close 22:02
ugexe you would call spurt after you read it obviously 22:03
and i suggested adding a :truncate option to spurt, not that exists
not that it exists^
rf Maybe using a filehandle is the right approach here 22:04
ugexe yeah it has to be a file handle if you want to do multiple actions on it 22:05
without reopening it that is
Xliff Yeah, but there is no .truncate for IO::Handle. 22:06
No joy using spurt(:truncate) 22:07
ugexe i know, again, i'm *suggesting* it might make sense to have it -- "maybe it makes sense for it to have :truncate"
Xliff Oh. Yes. Definitely! 22:08
This... WORKS!
m: use NativeCall; sub ftruncate (int32, uint64) is native {*}; "/tmp/test".IO.spurt("TestTestTest"); given "/tmp/test".IO.open(:rw) { .seek(0, SeekFromBeginning); .spurt("BLEAH"); ftruncate(.native-descriptor, 5); .close; }; "/tmp/test".IO.slurp.say
camelia BLEAH
rf In Template6 how can I access a map within a map? 22:29
22:36 jpn left
Nemokosch Could you give an example? 22:49
22:52 amenonsen joined
rf Template6.new.process('my-template', foo => { bar => 'baz' }); 22:53
How would I access bar in the template
Nemokosch hold up... 22:58
22:58 archenoth left 23:00 kjp left 23:04 kjp joined
you know, I mangled with that module a couple of months ago, but I keep forgetting... 23:05
have you tried foo<bar>, by the way? 23:12
ugexe normally in template toolkit (dunno about template6) you would just call .key-name 23:13
i.e. foo.bar
23:14 sena_kun left
Nemokosch my first (well, at least third first, lol) impression is that the vast majority of behavior really just comes from EVAL 23:16
so I'd try the most naive way 23:17
of course it would be better to rewrite it with proper RakuAST code generation but for the time being, I might rewrite the generated pieces of code to heredoc strings at least, it's really convoluted here and there 23:20
23:33 jpn joined, derpydoo joined 23:34 amenonsen left
rf I tried foo<bar> but I get an error 23:35
Geth doc/main: 68ea242952 | (Will Coleda)++ | 2 files
run duplicate check on more files.

  ... fix the bug that prompted this
doc/main: 0f59e32295 | (Will Coleda)++ | 2 files
pass 'make xtest'
23:38 jpn left
Nemokosch what is the error, if I may 23:38
rf [% if meta<description> %] this is the call 23:39
coleman I'm trying to find a compact equivalent of `awk '/foo/ {print $1}'`
Here's a pastebin envs.sh/5y
I'm doing this wrong. Lmk if you can help :) 23:40
rf @Nemokosch Undeclared routine: meta used at line 15
ugexe maybe it would parse meta.<description> better 23:41
if you can call any existing method you could use AT-KEY 23:42
rf coleman: Try /catalog.+\s/
ugexe i.e. meta.AT-KEY("description")
Nemokosch m: say '.' ~~ / \w / 23:44
Raku eval Nil
Nemokosch hmmm
anyway, seems like meta<description> went to the generated code verbatim 23:45
rf coleman: This worked for me /<('catalog'\w+)>/; 23:46
coleman oof
Nemokosch or at least this is how I can reproduce the behavior by reading the logic
for the catalog stuff - if the whole thing is one string, you could just ignore the original logic, break up the whole thing into words and grep on that, no? 23:47
coleman rf: thank you very much :) 23:48
Nemokosch that wouldn't be an equivalent for sure but it would get the job done
cfa wouldn't the actual equvalent be .lines on the slurp, then grepping for a pattern?
m: "catalog-6987bf74cc-xhfnq 2/2 Running 0 136m\n controlensemble-0 3/3 Running 2 (27h ago) 28h\n dashboard-dff795cdc-cg5jg 2/2 Running 0 134m\n edge-7894f45d6b-2kzdt 1/1 Running 0 28h\n greymatter-datastore-0 2/2 Running 0 136m\n".lines.grep(/catalog/).say 23:49
camelia (catalog-6987bf74cc-xhfnq 2/2 Running 0 136m)
coleman lines would be closer to awk, which defaults to splitting on lines... 23:51
rf Hmm, Nemo it seems like it wants meta to be a sub rather than a map 23:52
coleman i'll report back if i find something succinct
23:53 derpydoo left
Nemokosch rf: yes, that's not surprising on one hand... on the other hand, I'm afraid %meta<description> won't magically fix that 23:53
because the generated functions have their own "stash" 23:54
cfa i guess /^^.*catalog.*?$$/
might do the job too
match a line with catalog in it
for all matches you'd need m:g/^^.*catalog.*?$$/ 23:55
rf I guess I may need to do some hacking on Template6 23:57