This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
stevied if you are coming from perl `||` is the same as `|`. On raku, `|` is longest match. Can be very confusing. 00:05
So back to my earlier question about too many open file handles. I got this: 00:09
```
for dir($path, test => { "$path/$_".IO.f } ) -> $file {
try {
my $r := Libarchive::Read.new($file);
for $r -> $entry {
$count++;
put $entry.pathname if $entry.is-file;
}
$r.close;
}
}
```
so this code works perfectly. But if I change the `$r :=` bit from a binding to a regular assignment, I run into the too many open file handles problem. I have no idea why this is so. Can someone clue me in? 00:10
jaguart what do I need to ger REPL up-arrow working again? 00:11
stevied I think linenoise 00:12
Nemokosch yes, Linenoise, Readline or Terminal::LineEditor. They are all a little different.
<@563790557831495691> not going to lie, this seems so mysterious that it could even be a resource leak type of problem by me 00:14
stevied yeah, I can't figure it out. I close it with `$r.close` so I'd think it wouldn't make a difference 00:15
jaguart `zef install Readline` -> another `===> Testing [FAIL]: Readline:ver<0.1.6>:auth<cpan:fooist>` 00:16
stevied I think you need the OS package readline. not sure, though 00:18
I think you need the OS package for readline. not sure, though 00:19
jaguart thing is it worked before uninstall/reinstall rakudo-pkg
so I doubt an os thing
Nemokosch yes, that's right, it's a huge heap of native stuff
stevied on a mac: formulae.brew.sh/formula/readline 00:20
jaguart heres the failure message: gist.github.com/jaguart/8ace1402c0...4704f30cd1
stevied apt-get on debian
Nemokosch well, if you have this many problems with the rakudo package, you could try to hit El_Che up
stevied raku readline module installed for me on my mac 00:22
what kind of machine are you on? 00:23
jaguart Debian stable, i7-9700, 32G RAM 00:24
Nemokosch <@563790557831495691> by the way... don't forget that a NativeCall library can be really troublesome if it's not done right šŸ˜…
stevied you follow the instructions at raku.land/cpan:FOOIST/Readline? 00:27
jaguart Hmm: Parse errors: Subtest 5 expected 3 but contains 2 tests
stevied you have to install the libreadline7 package
jaguart I already have libreadline8:amd64 8.1-1 GNU readline and history libraries, run-time libraries 00:28
I found the issue
Nemokosch Do share šŸ™‚ 00:29
jaguart 02-base.t: some tests have been commented out - see above
Nemokosch hm, and this wasn't a problem before? 00:30
jaguart I think there are so many zef failures I was installing without tests - this time round I am being more careful
Nemokosch this is a good thing - it would be great to "unbreak" these tests 00:33
jaguart with this: t/02-base.t (Wstat: 0 Tests: 17 Failed: 0) Parse errors: Subtest 5 expected 3 but contains 2 tests 00:34
are the subtests numbered from 1?
if so I think it's the 'state' test line 68: github.com/lathropd/perl6-readline...base.t#L21 00:35
but that only has one test - and how does it know it wanted 3 - no plan 3; ? 00:36
Nemokosch same thoughts... 00:37
jaguart hmmm maybe its 'terminal' and not 'state' 00:40
Nemokosch I just cloned github.com/lathropd/perl6-readline.git and zef test . passed... 00:43
it installed well, too
on Ubuntu 20.04 in WSL
jaguart this test is the problem: github.com/lathropd/perl6-readline...base.t#L58 00:45
It's not counted by the test harness, even though it emits success
Nemokosch is this a TAP issue, then? 00:46
--/tap-harness can turn it off iirc
jaguart yeah - that gets the tests to pass 00:47
I will add that to the list of things to try when installs fail 00:48
Nemokosch also, if you have enough data about it, consider opening an issue github.com/Raku/tap-harness6/issues here 00:50
leont is about the most consistent module author, I would say. It wouldn't be in vain if there is actually a problem.
anyways, I'm off to sleep now šŸ’¤ 00:52
jaguart thank you :) 00:55
01:09 Manifest0 left 01:17 saint- joined
jaguart stevied: I saw this and thought of you - gitlab.com/raku-land/raku-land/-/t...master/bin - it's how Raku.land gets all the META info etc. 01:21
rf How can I write a function that takes an "symbol" argument I think is what it's called, ie: 'h e l l o'.split(/\s/, :skip-empty); 02:01
MasterDuke that's a named argument 02:03
m: sub foo(:$bar) { say "bar is $bar" }; foo(:4bar) 02:04
camelia bar is 4
MasterDuke m: sub foo(:$bar) { say "bar is $bar" }; foo(:bar)Ā  # if you don't them them an explicit type (or pass a value), they default to Bool and True 02:05
camelia bar is True
rf Hmm, that is how I implemented it but I am seeing a parameter error, must be somewhere else. Thanks!
stevied looks like the raku.land website 02:31
thanks. I actually just figured out a surefire way to find modules that need upgrading. I just go through REA and looks at the listings of each tar.gz file and look for files with .t, .pm or .pm6 extensions 02:33
jaguart yeah - in particular though they grab all the meta - which can have a few different names, and exist in different places in the tarballs etc. in effect they maintain a local ecosystem
oh - that sounds faster šŸ™‚
stevied yeah, takes only a few seconds 02:34
there's 1451 modules that have old extensions. that's like 70%. 02:36
jaguart I thought there were only about 850ish distinct modules in the ecosystem? 02:38
stevied over 2000 02:39
though some of them might have multiple authors
so probably more like 1900
is catching a warning different than catching an exception? I can't seem to catch a warning 02:56
this is what I have:
```
try {
ver($file.Str).Version; 02:57
CATCH { default { say $file.Str } };
}
```
sometimes I get a "Use of Nil in string context" and I'm trying to figure out which file is causing it
rf Typically you can't catch warnings. Instead if you have some sort of warning or side-effect to relay use a promise or channel. 03:00
stevied hmm, I don't know anything about those
I just found this: docs.raku.org/routine/warn but not sure how it can help me 03:01
rf In your case what sort of warning?
jaguart can you replace the global warn sub?
rf Huh I've never seen that caught before, but the docs seem to imply it can be caught
stevied see my post right below the code
jaguart you could add a backtrace... 03:02
stevied I only want to trigger the backtrace when there's a warning
i'm trying to figure out which out of thousands of files is triggering this error
or warning
jaguart eah - can you replace the global warn with a backtrace... 03:03
stevied I don't 'know. not sure how I would replace the global warn
jaguart dos say: To override this behavior, catch the warn exception in a CONTROL block 03:04
docs.raku.org/language/phasers#ind...OL-CONTROL
so you can catch the warning and add a backtrace in a CONTROL phaser 03:05
rf Nice find, there are some really cool Phasers out there
stevied oh interesting. didn't know phasers applied to errors/warnings 03:06
rf Yeah you can omit the try as well I believe 03:08
stevied oh nice, it worked. cool
thanks
i see the problem now. the file has an empty ver<> number in it. nice 03:09
03:16 rf left
got another edge case: 03:20
```
CONTROL {
when CX::Warn { say $newest_file; .resume };
}
my $r := Libarchive::Read.new($newest_file);
```
so one of the modules has utf8 characters in it: `Acme::ą² _ą² :ver<0.0.1>:auth<cpan:ELIZABETH>` 03:21
i guess that's a pair of eyes with eyebrows
anyway, it's causing the `my $r := Libarchive::Read.new($newest_file);` line to choke 03:22
error is: `Pathname can't be converted from UTF-8 to current locale.` 03:23
jaguart what locale are you using?
stevied I don't know. not much of a shell guy 03:24
is it in an ENV variable?
jaguart `locale` -> LANG=en_AU.UTF-8 for me 03:25
stevied is that a shell env variable?
jaguart `which locale` -> `/usr/bin/locale` - but you can probably `env | grep LANG` 03:27
stevied ok, got this:
```
> $ locale [Ā±main ā—]
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8" 03:28
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
```
so that looks good
ok, got this:
```
> $ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
```
jaguart maybe you need to let Libarchive know your locale
stevied yeah, let me check the docs for the module. I forgot to do taht 03:29
hmm, module only talks about utf-8 when extracting content from files 03:30
lemme check the source code of the module 03:31
error happens here, line 228: github.com/CurtTilmes/perl6-libarc...d.pm6#L228 03:32
can't really make heads or tails of that 03:36
archive_read_next_header2 is probably a native call
jaguart try this in your shell first? `export LC_ALL=en_US.utf8` 03:41
stevied thanks. no luck, though 03:42
jaguart this bug: github.com/libarchive/libarchive/issues/587
stevied oh interesting 03:43
the output of the `locale` command is the same when run from within the raku script. 04:09
jaguart yeah - I couldn't find the equiv of a native Raku setlocale() either - probably just expect you to manipulate your %*ENV 04:11
You could try `%*ENV<LC_ALL> = 'en_US.utf8'` 04:13
stevied this person says something about setting a global locale: stackoverflow.com/a/27311895/1641112
jaguart have you tried directly getting the specific archive details on the command line? 04:14
e.g. `tar -ztvf my-data.tar.gz` 04:15
stevied yes
it worked
jaguart so sounds like the libarchive library is not checking ENV for locale - grepped the Raku interface code and no occurrence of 'locale' - also didnt see that dist on raku.land -> do that one by hand? 04:19
stevied yeah, I could do it by hand. just curious at this point how this might be fixed. 04:20
jaguart libarchive v4?
stevied just a chance to learn something (and then forget about 2 weeks later)
jaguart or a setlocale() call in the Raku binding?
stevied this is the archive here: github.com/Raku/REA/tree/main/arch.../Acme::ą² _ą²  04:21
macos brew only has libarchive3, as far as I can tell 04:22
jaguart yeah - reported in 2015 -> went in the utf-8-is-hard bucket šŸ™‚ 04:23
stevied not seeing anything about setlocale for raku. how do I do that? 04:27
is that for c?
jaguart I like the module: `use Acme::ą² _ą²  ; ą² _ą²  'you did what!?';`
yeah - there might be a call on libarchive that you can make to set the locale 04:28
This module should def be on zef and in raku.land - it's purpose is a test of unicode module names 04:29
stevied the acme one? 04:30
alright, spent enough time on this. going to post a question about this to SO and how the genii can buzz in and help my sorry ass out 04:37
stackoverflow.com/questions/751548...h-libarchi 04:53
alright, thanks for the help <@975405607513366631>. have a good night 04:54
or morning šŸ™‚
05:40 Heptite left
Logomachist say "hello-test failed; \n timestamp = " ~ $<timestamp> ~ " name = " ~ $<name>; # Previous should have 06:04
07:00 Heptite joined 07:54 discord-raku-bot left, discord-raku-bot joined
Sparkill Hi, help me install Pop? 08:20
It tells me that I need dependencies but I can't install those versions.
``` zef install Pop
===> Searching for missing dependencies: Color:ver<1.002008>, TOML::Thumb:ver<0.1>:auth<zef:JRaspass>
===> Failed to find dependencies: Color:ver<1.002008>
Failed to resolve some missing dependencies (use e.g. --exclude="Color" to skip)```
08:23 discord-raku-bot left, discord-raku-bot joined 09:05 dakkar joined
Nahita hi <@346152867532505089> it seems like the module has `use Color;` in one place (gitlab.com/jjatria/pop/-/blob/mast...r.rakumod) and it's to extend the Color class with some handy coercers. So that specific version doesn't seem critical and it doesn't seem to exist anyway perhaps the author should change it 09:14
so you can first install the Color module separately
then install Pop with --exclude="Color" as it says
09:15 Heptite left 09:18 ab5tract joined
actually it should be --exclude='Color:ver<1.002008>' 09:19
yeah it installed that way 09:22
and if you have SDL2 it should be all fine i think after that point 09:23
Nemokosch the situation will get better from now on: that version dates back to the p6c days where versioning wasn't really solved 09:25
09:32 Manifest0 joined
Sparkill hi <@836605577400549436> Thank you very much it worked! šŸ™‚ 09:34
Nahita oh cool! 09:39
Nemokosch can :e & :!f work for "this path object exists and it isn't a file"? 12:10
as a smartmatch
CIAvash yes? 12:47
Nemokosch well, I hope so 12:58
not sure how this works tbh šŸ˜„
jaguart I have a headful of questions about module :ver :api and :auth - when a module is installed, where does this come from? the META6? the code? 13:05
jaguart META6 has a 'provides' hash of module => compunit - can the module-key have :ver :api and :auth parts? 13:07
Nemokosch At this point, I think you have a broader picture of this than I do
I'm gonna try to look up a post from Nick 13:08
jaguart Do folks use any tooling to help manage this? and the flip `use xxx` ? 13:09
lizmat I use App::Mi6 for module development 13:10
it basically does everything apart from writing code and tests and documentation :-)
jaguart Yeah - I like mi6 - have submitted a pull-request to add customisable scaffolding, fingers crossed 13:11
Where do you put your :ver :api - in the META6 or in each compunit?
or is it automatic from the mi6 version bump? 13:12
Nemokosch well, at least you have some success with PR's for mi6 šŸ˜… 13:13
perl6advent.wordpress.com/2016/12/...ained-ish/ I found something for you, by the way
jaguart grabs his reading specs 13:14
Nemokosch the TAP harness does kind of obfuscate errors apparently 13:16
jaguart my assumption is that the VT100.prepterminal test is emitting a control-char that confuses TAP's recognition of the OK. 13:27
The article indicates that :ver :api and :auth are all driven by META6 - which makes me wonder what happens when you put them actually inside the code :o 13:28
Thanks for that - it gives me a handle on setting up some testing to see what happens. 13:29
Nemokosch I'm trying to update the XML module and unless I turn the tap harness off, I can't really see the actual error even with --verbose on 13:30
not sure if that's a feature
jaguart yeah - I've learnt to use `raku -Ilib t/...` to see what's going on. 13:35
13:41 jgaz joined
jaguart so on :ver :api and :auth - zef install ALWAYS uses the META6 fields. 14:01
:ver and :version -> uses :ver
embeded :ver in the provides? -> ignored
:ver in the actual compunit -> ignored 14:02
oh - and :version but no :ver -> uses :version
so that's nice and easy - DONT put any :ver :api or :auth on classes / modules you create - its just confusing. 14:04
instead use them on your USE statements
ok - and mi6 - only checks the META6 :version -> it doesn't recognise :ver :( 14:16
14:20 saint- left
jaguart the docs all use `:version` with one main exception - they use `:ver<>` when specifying dependency information in the META6 14:22
stevied I wrote a little helper script that tweaks the module after mi6 sets it up on my local drive
jaguart interested - please share :)
stevied it's just an ugly perl script. doesn't do too much, but I can add to it if I need to. 14:23
jaguart I'm interested to know if you tweak the same bits that I do :) 14:24
stevied yeah, one sec. debian paste bin is down. i'll paste to github
gist.github.com/sdondley/5831d2c1c...15791b561b 14:26
so it sets up an xt folder with a test in it, sets up github for me, etc. 14:27
jaguart nice - I do the same changes to .gitignore, tweak the test.yml because of the Windows-TAP-install problem, fix the 'blah blah blah' in both main-module and meta6. 14:29
I tend to create the github repo via the web and then set the remote origin - `mi6` will update the META6 source-url automatically during build 14:31
only other comment is that you might want to add your Test::Output to your META6 test-depends - maybe :) 14:34
stevied I use comma IDE so it adds it in for me easily enough 14:35
this script probably could use some tweaks because I wrote it a while ago and not sure I know what I'm doing.
jaguart I struggle a but with Comma - I retry every now and then, just a week ago for example - but my fingers remember by fav editor better, and the auto reformatting drives me batty, and it seems to have a tanty if your desktop is windows but your rakudo is wsl. 14:37
stevied I can't use vim because it is way too slow with syntax highlighting turned on for any code above 75 lines 14:38
I turned off code wrapping in comma 14:39
and i use the ideavim plugin so I can still use vim keystrokes 14:41
jaguart Does comma have a c-tags equiv for Raku? i.e. backlink / nav to definition source? 14:42
stevied I'm almost sure it does but I never use ctags. I think I did play with it once 14:43
jaguart the Project thing is a pita - I work with several 'projects' at once and dislike having two windows instead of alt-tabbing
the file / Folder selection dialogs are a pain too - first thing I did was accidentally set the root of a 4TB disk as my project root - Comma went looking through a lot of files. 14:45
stevied yeah, the file explorer/finder seems broken. it never opens up where I want it to 14:47
you on linux gui? I'm sure there must be a way to cycle through open windows in the same application using the keyboard 14:54
14:59 rf joined
i just looked and comma has a shortcut for cycling between project windows 15:02
but anyway, all these tools have a pretty steep learning curve before you feel comfortable with them. easier to stick with what you know. 15:08
16:38 Heptite joined 16:44 NemokoschKiwi joined 17:36 dakkar left
p6steve my preference is to stick with vi and tab around (this is reinforced by my preference to install/run raku in a unbuntu VM) ... but, since I started to dig around in Comma, I have had a good look at IntelliJ Idea and now subscribe to and increasing use that for $day-job (because of ftp, git, html, css, js, php and so on) ... so I suspect that I will gradually pick up on Comma Plugin for IntelliJ and keep tr 17:53
IntelliJ Remote Gateway and/or Docker look quite interesting ... so I can combine the client editor goodness with the backend either in a Docker VM or in an (eg) AWS x86 instance ... BUT the combo of IntelliJ + vftools VM + remote gateway service is thrashing in my lowly MBA M1 8GB RAM ... maybe I will try again with AWS x86 clarge just for fun $$$ 17:58
17:59 NemokoschKiwi left
stevied how are you finding vim with raku? If I have more than 75 lines with a few nested loops, vim gets super slow and unusable? 18:05
how are you finding vim with raku? If I have more than 75 lines with a few nested loops, vim gets super slow and unusable
I have to turn off syntax highlighting, but syntax highlighting is a big crutch for me, especially with raku
Nemokosch tenor.com/view/you-guys-are-gettin...f-20686662 18:13
"you have syntax highlight for Raku?"
stevied yeah 18:23
rf Do you use treesitter? 19:31
p6steve I really don't like syntax highlighting - maybe all those years in the 80s staring a C 19:49
at
stevied no. fzf 20:48
I started on a green screen, apple //e. You could barely tell the difference between the number "1" and a lower case "l". I lost hours hunting that bug down one time. 20:50
the syntax highlighting gives you instant feedback when you are missing a delimiter or have some other kind of typo. I like it. 20:51
I guess the colors drive some people crazy.
the syntax highlighting gives you instant feedback when you are missing a delimiter or have some other kind of typo or syntax error. I like it. 20:52
someone must have done a productivity study on syntax highlighting 20:53
firstclassthoughts.co.uk/Articles/...de-folding 20:55
I've never seen some of these features. Stick scrolling?
I've never seen some of these features. Sticky scrolling?
gist.github.com/sdondley/e804292fb...d5417321a1 21:09
Nahita wow 21:12
stevied did a litle more analysis. So 1347 modules still use the ".t", 241 use ".pm" and 869 use ".pm6" 21:48
so it's not quite as bad as it seems
www.reddit.com/r/rakulang/comments..._outdated/ 22:06
rf stevied: I use neovim, I find it pretty snappy with 2-3k line files open 22:23
I can put my configuration on Git if you'd like as well 22:24
stevied I use that too 22:30
Do you do syntax highlighting?
Nemokosch does the bridge even get this sort of response across? 22:32
btw I thought ".t" can stay... 22:33
perhaps mi6 itself generates ".t" files
stevied dunno. i'll look into it 22:45
yeah looks like .t is not frowned upon: docs.raku.org/language/modules#___top 23:17
I don't know. I'm still trying to figure that out 23:18
guess i should log into irc and find out
Nemokosch the logs might do 23:20
irclogs.raku.org/raku-beginner/live.html
23:24 stevied_test joined 23:30 stevied_test left, stevied_test joined
stevied_test test 23:30
stevied does this notify me?
<@563790557831495691>_test 23:31
/stevied_test 23:32
ok, that actually works
23:32 jgaz left
/stevied_test this is another notification 23:32
/stevied_test or maybe not 23:33
ok, it does work
/stevied_test again 23:37