🦋 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.
rf Does anyone know if DBIish does transactions 01:42
I just want to run a huge SQL script with DBIish 01:43
tonyo github.com/raku-community-modules/...test#L1742 01:46
postgres and oracle both work too
Geth ¦ doc: cfa self-assigned Document trap: `use lib` with a huge directory is super slow github.com/Raku/doc/issues/2199 01:52
Geth ¦ doc: coke self-assigned Change document extension from .pod6 to .rakudoc github.com/Raku/doc/issues/3785 03:11
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
04:33
¦ 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
SmokeMachine rf: yes, DBIish does transactions 07:32
tellable6 SmokeMachine, I'll pass your message to rf 07:33
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
lizmat github.com/rakudo/rakudo/pull/5223 10:56
tadzik ^^ 11:00
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
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
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
*thing
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
12:36
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
ugexe fwiw there is always a cost of having something in the core 12:46
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
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
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
ugexe at least from a naming perspective one solution is to not hummanize things that may not really need it 12:57
huffmanize^
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
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
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
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
Geth rakudoc: pheix++ created pull request #23:
Migrate to Pod::Utils
15:45
tonyo m: use Rat::Precise; 16:54
camelia ===SORRY!=== Error while compiling <tmp>
Could not find Rat::Precise in:
/home/camelia/.raku
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakudo-m-inst-2/…
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
17:23
doc: finanalyst++ created pull request #4226:
Update community.pod6
17:24
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
17:29
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:34
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.
17:42
doc: finanalyst++ created pull request #4228:
Update modules.pod6
17:43
doc/finanalyst-patch-4: a80750c26d | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Language/modules-extra.pod6
Update modules-extra.pod6
17:44
doc: finanalyst++ created pull request #4229:
Update modules-extra.pod6
17:45
doc/finanalyst-patch-5: f5b68eb63f | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Type/DateTime.pod6
Update DateTime.pod6
17:54
doc: finanalyst++ created pull request #4230:
Update DateTime.pod6
17:55
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.
18:29
doc: cfa++ created pull request #4231:
Document potential performance penalties for filesystem repos (#2199)
18:34
Geth doc/main: 160b0cfd87 | cfa++ (committed using GitHub Web editor) | 2 files
Document potential performance penalties for filesystem repos (#4231)

Closes #2199.
18:40
Geth doc: cfa++ created pull request #4232:
Clarify the role of META6.json in filesystem repos
19:34
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:44
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
TestTestTest
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
BLEAH!
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
BLEAH!
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
Nemokosch Could you give an example? 22:49
rf Template6.new.process('my-template', foo => { bar => 'baz' }); 22:53
How would I access bar in the template
Nemokosch hold up... 22:58
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
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
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
23:36
doc/main: 0f59e32295 | (Will Coleda)++ | 2 files
pass 'make xtest'
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
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