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, discord-raku-bot joined 03:31 tirnanog left 05:05 ismustachio joined 05:10 ismustachio left
Jaguart 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:22
06:32 frost joined
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:54
Even the basics don't seem to work as I assume they used to - I found this is well pod6'd: modules.raku.org/dist/Linux::Cpuin...pan:JSTOWE 06:56
but a raku --doc=HTML on the code in this repo looks broken 06:57
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
Raku at work?
07:12 guifa left 07:33 ismustachio joined 07:38 ismustachio left 08:12 tirnanog joined
CIAvash jaguart: The module you mentioned doesn't contain `=LICENCE` in its POD, the "Licence" part is just in the `README.md` file. 08:45
Jaguart Yeah - but if I have an =LICENCE block it shows in Markdown but not in HTML 09:07
so I see that people have moved away from semantic-blocks and are just using head1, head2 blocks etc. 09:08
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:09
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: github.com/CIAvash/PatternMatching...ng.rakumod
jaguart: for that you should use POD declarator blocks(also for parameters), and if your code is typed, POD renderers show that information: docs.raku.org/language/pod#Declarator_blocks 09:26
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:33
s/papa/para/ 09:34
CIAvash That is because Rakudo hasn't implemented them, I think 09:35
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:37
lol - there is actually no pod in Pod::To::HTML.pm6 09:39
@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:41
CIAvash I just mixed the Perl POD style guide with the new POD6 features: perldoc.perl.org/perlpodstyle 09:44
jaguart My rusty Perl-pod has the semantics as: TITLE, NAME, SYNOPSIS, DESCRIPTION, OPTIONS, ERRORS, CAVEATS, BUGS, AUTHOR, VERSION, COPYRIGHT, LICENCE 09:48
oh - I clearly pruned my list - RETURN VALUE, DIAGNOSTICS, EXAMPLES, ENVIRONMENT, FILES, RESTRICTIONS, NOTES, HISTORY, SEE ALSO 09:52
CIAvash FWIW there is also a `Pod::To::HTML2` module provided by `Raku::Pod::Render` 10:02
10:03 ismustachio joined
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:05
Incidentally, Pod::To::HTML seems to just treat formatting like C<xxx> etc. in ``#|`` as literals 10:06
and if I dump $=pod - the #| entries are not there... hmm 10:07
10:08 ismustachio left 10:17 frost left 10:27 frost joined 12:43 ismustachio joined
MasterDuke jaguart: tbrowder, codesections, and maybe moritz are probably the best people to ask about pod6. i don't know who/if zag (github.com/podlite/podlite-desktop) is on irc 13:04
13:25 MasterDuke left, 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
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:19
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:20
18:26 discord-raku-bot left 18:30 discord-raku-bot joined
klebs 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:12
guifa klebs: the .parse method returns a match object (you call .made on it to get the result of the actions) 20:23
you can use .parsefile to run it on a file 20:24
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:30
klebs in my case i know in advance there are multiple matches in the file -- i am starting with something like this: 20:31
termbin.com/yi01
thanks for the help 🙂
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
now am realizing it later
so i want something that can globally search and replace kebab-snake-case to plain kebab-case 20:33
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>/;`
but now i suppose my question is: how do I write *almost* exactly this except *including* the actions? 20:34
is it possible to `$in ~~ m:g/<rule>/` with an actions class?
output of the script as-is, is something like: termbin.com/4o03 20:35
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
klebs maybe there is a way to apply an actions object after the fact?
guifa token TOP { <stuff-not-interested-in> %% <old-TOP> }
klebs ohh that's a nice trick 🙂 20:37
wow
never thought of that
but that seems mega useful
so, could <stuff-not-interested-in> be .*
?
is that the way to specify anything my old-top doesn't care about? 20:38
guifa thinking off the top of my head
klebs i am trying it now -- i think i am missing something 20:41
token TOP { [.*]+ %% <kebab-snake> } just matches the whole file 20:43
`token TOP { [.*]+ %% <kebab-snake> }` just matches the whole file
guifa right, because .* is greedy 20:44
klebs 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>
guifa you might try 20:45
klebs if I do `token TOP { [.*?]+ %% <kebab-snake> } `i get Nil 20:46
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
or once, plus N small parses
it seems like this is common enough that there might be a clean pattern for this
guifa eh my regex fu is failing me right now 20:50
but I think you'd be easiest with
tio.run/##XVDBaoNAED27XzEEQY2taRLo...eB4BlGff8L 20:58
sorry for long URL
in fact 21:03
even easier
make this role, and attach it to you grammar 21:04
klebs 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
in this case, it is
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:05
guifa tio.run/##bVBLCsIwEF3HU8wiC4tSXLnw...3xWcZrm@QM 21:06
^^ this is reusable. just say "grammar Foo does GlobalSubparse" and now you can add the :g option to subparse
klebs oh nice. that is wizard!
thank u so much for that 🙂
guifa grammars in and of themselves aren't designed to do substitutions 21:07
but what you can then do is
$orig.substr-rw( .from, .to - .from ) = .made.whatever-your-make-generated for @matches 21:08
the length of the replacement won't matter 21:09
guifa has to go afk, but hopefully that helps a bit
klebs ah, i wasnt aware of that last part 21:10
that is great!
i think i can handle it from here -- thank you! although now i am getting a failed match when i try the role
termbin.com/6c04 21:12
that now gives failed match on the same input
ah wait i think i fixed it 21:13
termbin.com/vvd4
i changed the role: ```raku 21:14
role GlobalSubparse {
method global_subparse($string, :$actions) {
my $pos = 0;
my @matches;
while $pos < $string.chars {
my $match = self.subparse($string, :$pos, :$actions);
if $match {
@matches.push: $match;
$pos = $match.to;
} else { $pos++ }
} 21:15
@matches
}
oh, i can write :global instead of :g and now it works again 21:17
sorry, this area of raku is a bit new to me
i wrote :global(:$g) in the signature and now it is again working for me
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
~~i think i can handle it from here~~ -- thank you! although now i am getting a failed match when i try the role
i wrote :global(:$g) in the signature and now specifying `:g` is again working for me 21:21
i suppose in this case with the kebab-snake business it is correct behavior anyway! so no worries! 21:23
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:25
i suppose it is kind of like applying a patch in git 21:29
22:55 jgaz joined
guifa klebs: actually, just apply the replaces in reverse 23:06
that way previous changes don't affect offsets 23:07
Nemokosch not gonna lie, it almost hurts returning to doing generic algorithmic stuff in Javascript after Raku 23:08
and mind you, I rather like Javascript
23:10 tirnanog left
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 23:11