[00:38] *** ismustachio joined
[00:43] *** ismustachio left
[01:55] *** ismustachio joined
[01:59] *** ismustachio left
[02:33] *** ismustachio joined
[02:37] *** ismustachio left
[03:27] *** discord-raku-bot left
[03:27] *** discord-raku-bot joined
[03:31] *** tirnanog left
[05:05] *** ismustachio joined
[05:10] *** ismustachio left
[06:22] <discord-raku-bot> <Jaguart#5082> Can anyone please point me to some decent examples of pod6 - have not been able to track down a style guide, and am finding things like =LICENCE missing from HTML but present in Markdown etc.

[06:32] *** frost joined
[06:54] <jaguart> Im coming to the conclusion that pod6 has diverged quite a lot from the original intent. I can't find docs on the intent for each semantic block - the list is different from Perl.

[06:56] <jaguart> Even the basics don't seem to work as I assume they used to - I found this is well pod6'd: https://modules.raku.org/dist/Linux::Cpuinfo:cpan:JSTOWE

[06:57] <jaguart> but a raku --doc=HTML on the code in this repo looks broken

[07:04] <jaguart> I'm starting to worry - I feel that I am missing something fundamental in Raku. The language is mind-blowing - cool, fun, rich - wow! I love it. But I feel I will really struggle to get Raku adopted in an actual working environment because basics like system-wide doc generation, packaging etc. are still works-in-progress. Have I just missed something that describes the basics for using 

[07:04] <jaguart> Raku at work?

[07:12] *** guifa left
[07:33] *** ismustachio joined
[07:38] *** ismustachio left
[08:12] *** tirnanog joined
[08:45] <CIAvash> jaguart: The module you mentioned doesn't contain `=LICENCE` in its POD, the "Licence" part is just in the `README.md` file.

[09:07] <discord-raku-bot> <Jaguart#5082> Yeah - but if I have an =LICENCE block it shows in Markdown but not in HTML

[09:08] <discord-raku-bot> <Jaguart#5082> so I see that people have moved away from semantic-blocks and are just using head1, head2 blocks etc.

[09:09] <discord-raku-bot> <Jaguart#5082> which kind of implies that there is no consistent recognition of the semantic blocks, and rather than use half semantic and half descriptive, you may as well use all descriptive

[09:23] <jaguart> With a large code base - something like javadoc just seems easier to use - I haven't found the pod6 equivs for @param @return @see etc. Happy to be corrected though :pray:

[09:23] <CIAvash> it shows in HTML for me, what module and version of it are you using for `Pod::To::HTML`? But yeah I think the state of POD converters is not good. Here is one of my PODs: https://github.com/CIAvash/PatternMatching/blob/main/lib/PatternMatching.rakumod

[09:26] <CIAvash> jaguart: for that you should use POD declarator blocks(also for parameters), and if your code is typed, POD renderers show that information: https://docs.raku.org/language/pod#Declarator_blocks

[09:33] <jaguart> So far, my experiments with those look pretty naff - e.g. can't seem to get ``#| B<strong> - lightly roasted`` or control papa spacing etc etc etc. 

[09:34] <jaguart> s/papa/para/

[09:35] <CIAvash> That is because Rakudo hasn't implemented them, I think

[09:37] <jaguart> FWIW I'm using ``Pod::To::HTML:ver<0.8.1>:auth<github:Raku>`` - says v0.8.1 but I see that the git release version is  0.3.4 - havent checked to see if there is an embedded POD version... ¯\_(ツ)_/¯ 

[09:39] <jaguart> lol - there is actually no pod in Pod::To::HTML.pm6

[09:41] <jaguart> @CIAVash - I see you have put a lot of effort into your pod, and you have used semantic blocks - though they are not the old CPANish ones... do you have a style-guide/standard?

[09:44] <CIAvash> I just mixed the Perl POD style guide with the new POD6 features: https://perldoc.perl.org/perlpodstyle

[09:48] <jaguart> My rusty Perl-pod has the semantics as: TITLE, NAME, SYNOPSIS, DESCRIPTION, OPTIONS, ERRORS, CAVEATS, BUGS, AUTHOR, VERSION, COPYRIGHT, LICENCE

[09:52] <jaguart> oh - I clearly pruned my list - RETURN VALUE, DIAGNOSTICS, EXAMPLES, ENVIRONMENT, FILES, RESTRICTIONS, NOTES, HISTORY, SEE ALSO

[10:02] <CIAvash> FWIW there is also a `Pod::To::HTML2` module provided by `Raku::Pod::Render`

[10:03] *** ismustachio joined
[10:05] <jaguart> Thanks I will check it out. Seems I will have to write something custom to render POD across a code-base. The big thing apparently missing is the per-entity semantics - @param @return @see etc. I guess I could add that to my ``#| comments`` using a render of the javadoc standard.

[10:06] <jaguart> Incidentally, Pod::To::HTML seems to just treat formatting like C<xxx> etc. in ``#|`` as literals

[10:07] <jaguart> and if I dump $=pod - the #| entries are not there... hmm

[10:08] *** ismustachio left
[10:17] *** frost left
[10:27] *** frost joined
[12:43] *** ismustachio joined
[13:04] <MasterDuke> jaguart: tbrowder, codesections, and maybe moritz are probably the best people to ask about pod6. i don't know who/if zag (https://github.com/podlite/podlite-desktop) is on irc

[13:25] *** MasterDuke left
[13:25] *** frost left
[14:22] *** ismustachio left
[14:29] *** frost joined
[14:34] *** ismustachio joined
[14:35] *** ismustachio left
[14:50] *** frost left
[14:52] *** discord-raku-bot left
[14:56] *** discord-raku-bot joined
[15:09] *** guifa joined
[15:21] *** jgaz joined
[16:25] *** Util left
[16:55] *** MasterDuke joined
[17:15] *** jgaz left
[18:19] <guifa> jaguart: not sure if anyone answered (I seem to have been disconnected), but I think POD6 hasn't reached the level of usage to develop a good feel for style / depth / content, etc.  I'm slowly trying to for myself, and there are some new stuff like Comma's new support for it and the Podlite app that hopefully will push more adoption

[18:20] <guifa> right now most people are justing using Markdown for Github (likely because GH didn't/doesn't have support for POD6 rendering, and that's where the ecosystem had historically lived)

[18:26] *** discord-raku-bot left
[18:30] *** discord-raku-bot joined
[20:12] <discord-raku-bot> <klebs#2209> hi folks! is there some way to match a grammar rule against the text in a file with an actions class, and return a list of all matches made?

[20:23] <guifa> klebs: the .parse method returns a match object (you call .made on it to get the result of the actions)

[20:24] <guifa> you can use .parsefile to run it on a file 

[20:30] <guifa> If the grammar should be matching multiple times over in a single file (e.g. you would have called the regex with :global or :exhausting, etc), you'll want to package the grammar into an umbrella grammar.  There was a lot of talk about different ways to do that over the past week or two on Raku's subreddit, actually 

[20:31] <discord-raku-bot> <klebs#2209> in my case i know in advance there are multiple matches in the file -- i am starting with something like this: 

[20:31] <discord-raku-bot> <klebs#2209> https://termbin.com/yi01

[20:31] <discord-raku-bot> <klebs#2209> thanks for the help 🙂

[20:32] <discord-raku-bot> <klebs#2209> basically in my example, i have a bunch of generated files in which i accidentally forgot :g while converting snake case to kebab case

[20:32] <discord-raku-bot> <klebs#2209> now am realizing it later

[20:33] <discord-raku-bot> <klebs#2209> so i want something that can globally search and replace kebab-snake-case to plain kebab-case

[20:33] <discord-raku-bot> <klebs#2209> i think i might almost have it -- i didn't realize I could access a grammar's token scoped inside <> like `$in ~~ m:g/<KebabSnake::TOP>/;`

[20:34] <discord-raku-bot> <klebs#2209> but now i suppose my question is: how do I write *almost* exactly this except *including* the actions?

[20:34] <discord-raku-bot> <klebs#2209> is it possible to `$in ~~ m:g/<rule>/` with an actions class?

[20:35] <discord-raku-bot> <klebs#2209> output of the script as-is, is something like: https://termbin.com/4o03

[20:36] <guifa> The actions can only be attached via the .parse method.  Personally, I'd adjust TOP to handle the global scope using something like

[20:36] <discord-raku-bot> <klebs#2209> maybe there is a way to apply an actions object after the fact?

[20:36] <guifa> token TOP { <stuff-not-interested-in> %% <old-TOP> }

[20:37] <discord-raku-bot> <klebs#2209> ohh that's a nice trick 🙂

[20:37] <discord-raku-bot> <klebs#2209> wow

[20:37] <discord-raku-bot> <klebs#2209> never thought of that

[20:37] <discord-raku-bot> <klebs#2209> but that seems mega useful

[20:37] <discord-raku-bot> <klebs#2209> so, could <stuff-not-interested-in> be .*

[20:37] <discord-raku-bot> <klebs#2209> ?

[20:38] <discord-raku-bot> <klebs#2209> is that the way to specify anything my old-top doesn't care about?

[20:38] <guifa> thinking off the top of my head

[20:41] <discord-raku-bot> <klebs#2209> i am trying it now -- i think i am missing something

[20:43] <discord-raku-bot> <klebs#2209> token TOP { [.*]+ %% <kebab-snake> } just matches the whole file

[20:43] <discord-raku-bot> <klebs#2209> `token TOP { [.*]+ %% <kebab-snake> }` just matches the whole file

[20:44] <guifa> right, because .* is greedy

[20:44] <discord-raku-bot> <klebs#2209> the problem is that i dont want to specify in advance <stuff-not-interested-in>  other than the fact that it is anything which does not match <kebab-case>

[20:45] <guifa> you might try

[20:46] <discord-raku-bot> <klebs#2209> if I do `token TOP { [.*?]+ %% <kebab-snake> } `i get Nil

[20:48] <discord-raku-bot> <klebs#2209> i could actually just use the matches returned from `$in ~~ m:g/<rule>/` to find start and end points and then substitute using them and the results of a regular grammar parse -- but then i have to parse the file twice

[20:48] <discord-raku-bot> <klebs#2209> or once, plus N small parses

[20:48] <discord-raku-bot> <klebs#2209> it seems like this is common enough that there might be a clean pattern for this

[20:50] <guifa> eh my regex fu is failing me right now

[20:50] <guifa> but I think you'd be easiest with

[20:58] <guifa> https://tio.run/##XVDBaoNAED27XzEEQY2taRLoQVNpT7kU2kNvIchGJ1HiqrgbSgn@S7@lP2ZndaWhyw7Lmzfvzew02JaPfX9quRC8hS1cGdBR9Rkr@Hh7h@vP9yZ8vd8l@9iHnZM48Af3PnSsY2nJpYSXVBV1JY2BQJXX2eDg2gtP2wh@RpjN7cV8NsiY@AJbqraoTvAEznK1pgv8kCYUYGCGx/@QwokGcVNLUj4M4FlwleYoI/aZFyWO5GZqEKQ5b/VsltYNpaTcBvJyaIhA19TdQaiF9PDxO675ludFzCqOk5aMrKlj0FxkHhqGqiwz15gIVE25DrCUqLegSX/cG5P8du5bFMeB4BlGff8L

[20:58] <guifa> sorry for long URL

[21:03] <guifa> in fact

[21:03] <guifa> even easier

[21:04] <guifa> make this role, and attach it to you grammar

[21:04] <discord-raku-bot> <klebs#2209> nice! this works pretty well! but then my next question would be: in general how do i update the original string? i know what i'd do if each replacement text is the same length as the text it replaces

[21:04] <discord-raku-bot> <klebs#2209> in this case, it is

[21:05] <discord-raku-bot> <klebs#2209> but supposing in the future i want something like this again, but the result of .made is a different length from the match -- what would i do then? it is like some sort of splicing operation

[21:06] <guifa> https://tio.run/##bVBLCsIwEF3HU8wiC4tSXLnwA@48gCdI69gUpk3JpIhIz16TMQUXLgKZN@/HDOhpP8/eEcKVXGXoNlaD8YzwXqkOg3V34AytNQff9s0WDtrUoXU9x28jsrVuiiJplMcw@h5qQ8SmQxh7QmbQzTEuuxfowTGcYZfHS2dCbZHT@LRt7CGEE@SwsrYxW5xFLfSoZ6RH@a9ZVP8ULJKvah@LUHzUEloOI9tD3glT5XpfqAxO0AmQ0kmk22YDUwTTW3xWcZrm@QM

[21:06] <guifa> ^^ this is reusable.  just say "grammar Foo does GlobalSubparse" and now you can add the :g option to subparse

[21:06] <discord-raku-bot> <klebs#2209> oh nice. that is wizard!

[21:06] <discord-raku-bot> <klebs#2209> thank u so much for that 🙂

[21:07] <guifa> grammars in and of themselves aren't designed to do substitutions

[21:07] <guifa> but what you can then do is

[21:08] <guifa> $orig.substr-rw( .from, .to - .from ) = .made.whatever-your-make-generated for @matches

[21:09] <guifa> the length of the replacement won't matter 

[21:09] * guifa has to go afk, but hopefully that helps a bit

[21:10] <discord-raku-bot> <klebs#2209> ah, i wasnt aware of that last part

[21:10] <discord-raku-bot> <klebs#2209> that is great!

[21:10] <discord-raku-bot> <klebs#2209> i think i can handle it from here -- thank you! although now i am getting a failed match when i try the role

[21:12] <discord-raku-bot> <klebs#2209> https://termbin.com/6c04

[21:12] <discord-raku-bot> <klebs#2209> that now gives failed match on the same input

[21:13] <discord-raku-bot> <klebs#2209> ah wait i think i fixed it

[21:13] <discord-raku-bot> <klebs#2209> https://termbin.com/vvd4

[21:14] <discord-raku-bot> <klebs#2209> i changed the role: ```raku

[21:14] <discord-raku-bot> <klebs#2209> role GlobalSubparse {

[21:14] <discord-raku-bot> <klebs#2209>     method global_subparse($string, :$actions) {

[21:14] <discord-raku-bot> <klebs#2209>         my $pos = 0;

[21:14] <discord-raku-bot> <klebs#2209>         my @matches;

[21:14] <discord-raku-bot> <klebs#2209>         while $pos < $string.chars {

[21:14] <discord-raku-bot> <klebs#2209>             my $match = self.subparse($string, :$pos, :$actions);

[21:14] <discord-raku-bot> <klebs#2209>             if $match {

[21:14] <discord-raku-bot> <klebs#2209>                 @matches.push: $match;

[21:14] <discord-raku-bot> <klebs#2209>                 $pos = $match.to;

[21:14] <discord-raku-bot> <klebs#2209>             } else { $pos++ }

[21:15] <discord-raku-bot> <klebs#2209>         }

[21:15] <discord-raku-bot> <klebs#2209>         @matches

[21:15] <discord-raku-bot> <klebs#2209>     }

[21:17] <discord-raku-bot> <klebs#2209> oh, i can write :global instead of :g and now it works again

[21:17] <discord-raku-bot> <klebs#2209> sorry, this area of raku is a bit new to me

[21:17] <discord-raku-bot> <klebs#2209> i wrote :global(:$g) in the signature and now it is again working for me

[21:19] <discord-raku-bot> <klebs#2209> oh! but if i write `$orig.substr-rw(.from, .to - .from) = .made` in a loop then doesn't it update the indices of `$orig`? ie, if the sizes change wont .from and .to of the next call be incorrect?

[21:19] <discord-raku-bot> <klebs#2209> ~~i think i can handle it from here~~ -- thank you! although now i am getting a failed match when i try the role

[21:21] <discord-raku-bot> <klebs#2209> i wrote :global(:$g) in the signature and now specifying `:g` is again working for me

[21:23] <discord-raku-bot> <klebs#2209> i suppose in this case with the kebab-snake business it is correct behavior anyway! so no worries!

[21:25] <discord-raku-bot> <klebs#2209> in general, i am curious though (last question) how to batch update a string with substr-rw where the indices might change between items in a batch

[21:29] <discord-raku-bot> <klebs#2209> i suppose it is kind of like applying a patch in git

[22:55] *** jgaz joined
[23:06] <guifa> klebs: actually, just apply the replaces in reverse

[23:07] <guifa> that way previous changes don't affect offsets

[23:08] <discord-raku-bot> <Nemokosch#9980> not gonna lie, it almost hurts returning to doing generic algorithmic stuff in Javascript after Raku

[23:08] <discord-raku-bot> <Nemokosch#9980> and mind you, I rather like Javascript

[23:10] *** tirnanog left
[23:11] <guifa> I found most other languages are pretty painful after Raku haha.  In generally, if there's something I don't like about how Raku works by default, I can change iit

