🦋 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.
ugexe locate is nice in that it uses a database / index, so using something like find isn’t quite the same 00:06
That of course has its own drawbacks, namely you need to run ‘updatedb’ occasionally (usually with a cron job) 00:07
00:26 DarthGandalf left 00:28 DarthGandalf joined 01:35 hulk joined 01:36 kylese left 02:15 hulk left, kylese joined
SmokeMachine I quit from the idea to make defaults work with ValueClass and @/% attributes and just customised the error message… 02:51
03:58 Xliff left 04:47 wayland joined, wayland76 left 05:53 Xliff joined
Xliff m: SSL: { last; say 1 } 05:54
camelia ===SORRY!===
last without loop construct
Xliff m: SSL: loop { last; say 1 }
camelia ( no output )
Xliff m: SSL: loop { last if 0; say 1 }
camelia (signal XFSZ)1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1…
Xliff m: SSL: loop { last if 0; say 1; last }
camelia 1
06:34 jpn joined 06:37 GreaseMonkey left 06:38 greaser|q joined 06:40 jpn left 07:03 jpn joined 07:51 beastieboo joined, beastieboo__ left 08:05 kylese left 08:09 kylese joined 08:27 jpn left 08:31 jpn joined
holmdunc The modern macOS file indexing (i.e. what powers Spotlight) is accessible using the 'mdfind' command 08:35
metaredux.com/posts/2019/12/22/mdfind.html 08:37
08:40 sena_kun joined 08:54 soverysour joined, soverysour left, soverysour joined 09:22 jpn left 09:25 Sgeo left 09:54 jpn joined
tbrowder holmdunc: thnx. but how do you get Spotlight. is it available through brew? i just use macos on github workflows, hence the question. 10:18
10:19 soverysour left, bdju left 10:21 bdju joined 10:24 soverysour joined, soverysour left, soverysour joined
tbrowder i.e., what is the expected way to use CLI to search for files on mac 10:26
lizmat: yes, maybe i could use App::Rak…great idea 10:29
1. search for file with basename X 10:33
holmdunc tbrowder: Both Spotlight and mdfind are built into the OS - they're the GUI and CLI frontends to the same thing. Personally I have only used mdfind in basic ways (mdfind -name foo) and usually just reach for ye olde unix find. Not sure about particulars of macOS in CI, sorry! 10:34
tbrowder so: mdfind -name foo should work universally, good. thnx. 10:36
lizmat yeah, that's a good find... will use that in the next version of rak :-) 10:40
afk&
10:46 soverysour left 10:47 soverysour joined, soverysour left, soverysour joined 10:51 ttyyls left 10:52 ttyyls joined 11:00 soverysour left
tbrowder so i do have access to my wife’s new macbook now. is there a good techy book out there for me to find out the mac equiv ways for linux ppl? mac for seniors doesn’t hack it 11:16
11:16 jpn left
tbrowder maybe a mac irc chnl 11:17
mac cli for dummies?
11:32 dawids joined, dawids left 11:35 soverysour joined
holmdunc At least in terms of CLI, IMO it's not that much different, but there are some big ticket commands it's good to know about like launchctl/launchd (systemd and ~cron equivalent), diskutil, etc. And of course Homebrew. I have a few bookmarks of the following blog e.g. scriptingosx.com/2017/05/where-paths-come-from/ - Seems like a good site. 11:36
ss64.com/mac/ 11:45
11:49 soverysour left 11:56 soverysour joined, soverysour left, soverysour joined
tbrowder holmdunc: thnx, sounds like a possible link for the raku home page 12:30
so is the bash environment the default? or does the root user need to set it on a new macos host? 12:34
ss64.com is a great src, thnx! 12:42
13:01 soverysour left 13:03 jpn joined 13:08 jpn left 13:32 soverysour joined, soverysour left, soverysour joined 13:37 soverysour left 14:12 soverysour joined, soverysour left, soverysour joined 14:16 soverysour left 14:17 jpn joined 14:22 jpn left 14:31 soverysour joined, soverysour left, soverysour joined 14:35 thaewrap1 left 14:37 thaewrapt joined 14:48 soverysour left 15:16 soverysour joined 15:21 soverysour left
antononcube Graph demo in Raku teaser presentation: www.youtube.com/watch?v=0uJl9q7jIf8 15:46
15:51 soverysour joined 15:57 soverysour left 16:16 soverysour joined, soverysour left, soverysour joined 16:19 nikolaich joined
nikolaich hello people of raku 16:19
guifa o/ 16:27
nikolaich Is this appropriate place to ask nooby questions? I'm having a little trouble that i cannot seem to solve 16:28
guifa absolutely! 16:34
16:41 Sgeo joined
nikolaich Okay, so: I am having trouble with zef. I can't install any modules. I am running zef version 0.22.0, and rakudo version 2024.05.1. I am also using Windows. When i am trying to install, say, Cro(by doing zef install --/test cro) it fails with the error " ===SORRY!=== Error while compiling C:\Users\NIKOLA~1\AppData\Local\Temp\.zef\1719763597.16128\OpenSSL%3Aver%3C0.2.2%3E%3Aauth%3Cgithub%3Asergot%3E.tar.gz\openssl-main\Build.rakumod 16:46
[OpenSSL] Failed to open file C:\Users\NIKOLA~1\AppData\Local\Temp\.zef\1719763597.16128\PathTools%3Aver%3C0.2.0%3E%3Aauth%3Cgithub%3Augexe%3E.tar.gz\Raku-PathTools-main\.precomp\DF2AD89BFFFDF6FF5BE7A82D59AD6BEEACEE4E0E\95\9536DA79A6A6E91751DC0FB9841C36F546318564.repo-id.DSK9CM7VSTQPQ00XBOBTU3JZC.tmp: No such file or directory
[OpenSSL] at C:\Users\NIKOLA~1\AppData\Local\Temp\.zef\1719763597.16128\OpenSSL%3Aver%3C0.2.2%3E%3Aauth%3Cgithub%3Asergot%3E.tar.gz\openssl-main\Build.rakumod:1". And i can't seem to find any info on this error.
Directory exists 16:48
ugexe nikolaich: it is because rakudo/moarvm does not yet support windows long paths - github.com/rakudo/rakudo/issues/5252 16:52
you can probably work around it by setting `ZEF_CONFIG_TEMPDIR` to something shorter like `C:\tmp` or some such 16:53
antononcube I hope there are clear, step-by-step instructions how install Raku on different Windows versions and how to install packages. 16:55
ugexe it looks like the windows system wide temp directory is C:\Windows\Temp which might work since it is shorter
most CI setups probably run windows, and are a clear step by step instructions 16:56
but as i linked to earlier, rakudo/moarvm need windows long path support 16:57
antononcube 👍 17:05
17:15 eseyman left 17:19 manu_ joined 17:20 manu_ is now known as eseyman 17:22 jpn joined 17:29 jpn left 17:37 jpn joined 18:00 soverysour left
librasteve @nikolaich, in the short term WSL/Docker are good ways to run raku on Windows 18:02
18:06 leah2 left
antononcube Right, of course. 18:13
18:18 Sgeo left 18:19 leah2 joined 18:21 Sgeo joined
nikolaich Yeah, i thought about wsl 18:23
Changing my tempdir helped! Thanks a lot, ugexe ! 18:29
antononcube @nikolaich Please write and publish instructions document titled "Raku installation for beginers." 18:31
guifa how might I replace a parse tree in a grammar / regex if I come across a given token 18:51
basically I'm looking for a "if you hit this token, ignore the rest of the string and continue parsing based off of this new string" 18:52
antononcube I know the answer -- using RakuAST ! 18:54
guifa That actually won't work in this case: RakuAST helps *after* the parse, or in the actions phase perhaps 18:57
But I'm looking to buck around at the token phase
Xliff guifa: If you are using grammars, you'd have to parse the new string in the action for that token. 18:58
So you'll need an action class.
guifa so this is what I'm looking at
Xliff The trick is stopping the processing of the existing grammar, which I'm not so sure about. 18:59
You might need to grab the current cursor and set it to the end of the string.
guifa stopping the processing is easy : make your token end with .* 19:00
overwriting any previous matches though...
tio.run/##RY89T8NADIb3@xVv1UrhQyob...ZpRdF@j7Hw 19:01
I've tried all sorts of other things: modifying .orig and .target but there's a ton of cached data AFAICT 19:02
Xliff Yes. 19:05
First thing, break out the special token into it's own rule, rather than keeping it in TOP
Then you need to create an Actions class.
antononcube Hmm... shouldn't RakuAST help you change Raku's functionalities for parsing grammars? If yes, then you can make a special grammar interpreter for your case.
My original suggestion was a joke, BTW. (Mighty RakuAST, blah, blah...) 19:06
guifa Xliff: but how does the Actions class modify the Match object? 19:08
Xliff guifa: Getting to that in a sec... tio.run/##RY47T8NAEIT7@xUTJZJ5SKGj...ZzK7LTAMfw
19:13 abraxxa-home joined 19:14 abraxxa-home left
Xliff guifa: What is all the stuff for starting with "{$/ does Bar }" 19:14
guifa so I was trying to do things in a POST
but for some reason a standard var was losing scope 19:15
Xliff So it's not really necessary?
guifa so I went with a role to be my sentinal
Xliff sentinel for what?
19:15 abraxxa-home joined
guifa for whether we run the new parser. otherwise very easy to get into an infinite loop 19:18
if everytime in POST you're calling Foo.parse: it'll never end. So the sentinel value indicates whether we need to call again with the new string or not 19:19
Xliff OK, so it's infinite loop protection. Got that coverered, so I'll remove it.
19:23 jpn left
librasteve have you looked at before? 19:28
antononcube @guifa Somewhat inline with @librasteve 's comment, I was thinking that maybe the backtracking "prevernter" : can be applied together with regex-level actions code. 19:30
guifa so the ultimate goal is to allow a final insertion of values 19:31
so if we're parsing
<token> <token> <insert> <token> <token>
that can be expanded to
<token> <token> <newtoken> <newtoken> <newtoken> <token> <token>
but such that there may be a match like 19:32
$<a>=[<token> <token> <newtoken>] $<b>=[<newtoken> <newtoken> <token> <token>]
the only way to do that AFAICT is to rev up the parser again from scratch
Xliff guifa: Well, my attempt didn't work. Something is weird with grammars. I don't think they are properly reentrant.
tio.run/##fZCxboNAEER7vmIMSLaT6OhS...NP@vq@9/AQ 19:33
antononcube Can you make <token> <token> <insert> <token> <token> fail and then use the the FALLBACK method?
guifa antononcube: hmm, maybe but I don't think FALLBACK exists on NQP classes
the goal of this is an <insert file> token for the initial parse :) 19:34
antononcube Hence, my RakuAST remark applies!!
@guifa Meaning, you want to use to replace a token with the content of a file? 19:36
guifa correct
and parse transparently
would be the ultimate goal
tio.run/##bVHRToMwFH3vV1yRBNDJ3nxg...OpnK0JteK7
kBRZiS3sGcix5MaR8EphR3jIDQdkpxAl6YCrw3r75Y808AbxP9MhWvt1jzrn9W/TqrqBw
antononcube If yes, then you should just have a two-pass parsers.
guifa errr that's a bit big but I got it now mostly
yes but Raku is technically single pass :) 19:37
and you want to make sure your insert file works as a token and not being accidentally gobbled up as part of a string
antononcube The first pass makes the required or specified replacements, the second pass parses the "true meaning."
guifa tio.run/##bZBPb4JAEMXv@ymeqYnYP/TW...pxc8tpWf4A 19:39
antononcube @guifa "but Raku is technically single pass" -- maybe you have particular user interface in mind. Say, ReplacementGrammar.parse(...).
guifa raku -e "use Replacer; class Foo { <insertFile: 'blah'> }"
that's my goal 19:40
so that the result is the equivalent of, say, raku -e "class Foo { has $.bar; .... }"
antononcube Ok, I see. 19:41
Now, I am thinking that it is better to use grammar parameters. You specify which tokens are replaced with the what, and then that triggers the re-parsing. 19:42
guifa You can't specify parameters for the root level parse, though 19:44
by the time we've gotten to `use Replacer` we're already in the middle of parsing 19:45
I thought about a wrapper but it's too late
antononcube I see -- my grammar-parameters remark is not relevant, I understand your example better now... 19:46
If I understand correctly, you want to do code files pre-processing by just specifying use Replacer; and replacment-block indicators. 19:49
guifa Yeah. Basically this
www.youtube.com/watch?v=G2EGvw4XNvY
But of course i want to see if I can make it fancier :)
antononcube This, BTW, is a Literate Programming task, but that you assume a different type of user experience. 19:50
I have done these kind of pre-processings for the DSLs, notebook, and computational document interfaces, but they are "under the hood", not so direct. 19:53
guifa I guess actually I could add new multi tokens for all of the scope closers that are empty if and only if we've hit a file insertion point
antononcube I am not sure is the token perspective that good or fruitful. 19:54
I think it is more of a "phaser" for Raku's REPL.
Or evaluator, or whatever...
@guifa The token perspective -- can we say that you are trying to come up with slang that replaces special tokens with files' content? 19:56
guifa This would have to be a slang, yes. 19:57
19:57 sena_kun left
antononcube Please, from now on ask slang related question then.. 🙂 19:57
(Maybe to others it was obvious that those are slang questions, not to me though...) 19:58
guifa huh 20:02
I wonder how much info I can get from the file calling during a use statement
antononcube Can solve your problem for Raku’s REPL first? I.e. you start a REPL, then using special tokens in code file content is inserted, etc. 20:07
20:21 sena_kun joined
guifa I've never touched the REPL 20:22
20:23 guifa left 20:28 nikolaich left 20:55 jpn joined 21:00 jpn left
Xliff If I have 'token sectionhead' defined already, how can I use that in a positive lookahead? 21:05
antononcube token lookahead-sectionhead { <!before <sectionhead>> .* } 21:17
Xliff Did that actually work? 21:53
22:04 beanbrain joined 22:24 abraxxa-home left 22:39 sena_kun left 22:54 jpn joined 22:58 wayland left 22:59 jpn left 23:05 merp left 23:07 merp joined 23:14 Chanakan left 23:15 Chanakan joined