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.
00:05 rf joined 00:46 Heptite joined
jaguart this compilation error: `Type check failed in binding to parameter '$address'; expected Str but got Any (Any)` 01:27
no `$address` in my source...
Nemokosch may I ask what your code is? 01:28
jaguart I think the error comes from rakudo\src\core.c\Distribution\Locally.pm6
code is pretty simple similar to - `class This::Thing is Other::Module::Thing {}` 01:29
Nemokosch the error message is quite clearly LTA 01:31
how do you tell the compiler where it could find your compunit? 01:32
jaguart I have `-Ilib,.,xt - and then I have links in my lib/ to ../../Other/Module/lib/Module 01:33
I will play with paths...
Nemokosch -I flag? 01:34
I'm far from educated on these matters but I think the two things here are use lib and the -I flag
I would expect links to be resolved but who knows 01:37
rf I think it's trying to bind to a parameter $address in the sub/method being called, check the line and see if the caller parameter is Nil. 01:43
01:50 deoac joined
deoac I'm trying to view theweeklychallenge.org/ but the menu (Home, About, ... Contact) takes up nearly the entire screen.  This happens in both Safari and Chrome.  I have no ad blockers enabled.  Is this happening to anyone else? 01:53
jaguart looks ok on desktop - but the menu stacks when you reduce the width down 01:54
actually there is something wrong - the top menu disappears probably ment to be behind a trigram - but you cant access it. The secondary menu is large dark buttons - this stacks pushing the content down a couple of pages 01:56
Nemokosch you mean the "hamburger menu"? 02:00
anyway, that site always worked "good enough" for me
I wonder if we'd have to settle for an O(n^2) solution for the second task 😛 02:01
jaguart so `Type check failed in binding to parameter '$address'; expected Str but got Any (Any)` happens when you have links in your lib folder to folders containing other modules, I think because it finds the compunit but is confused about which distribution it belongs in 02:08
if you remove the links and instead do everything via a long `-Ilib,../Module1/lib,../Mod2/lib` it seems to work ok 02:09
Nemokosch it would be good to note this some way 02:10
IRC, issue, StackOverflow, Reddit, I don't know 02:11
for some random reason, it seems that Jonathan Worthington is hanging out quite a lot on SO actually
jaguart maybe lots of warm Raspberry Pi 😛 02:12
deoac Reducing the width of the window did the trick.  Weird. 02:34
rf Do you have a 4k monitor by chance? 02:57
03:27 rf left 03:56 deoac left 05:31 Heptite left
jaguart m: say 3840 / 1024 05:43
camelia 3.75
05:44 Kaiepi left
jaguart arg - just spent an hour debugging why `x (1,2)` was not matching any signature - space between method-name and args -> was sending a list into `x()` 😦 06:10
09:13 dakkar joined
Nemokosch I thought this was well-known, also clearly intended 10:33
10:44 Kaiepi joined 12:59 guifa left 13:00 guifa joined 13:42 jgaz joined 15:05 rf joined
rf How can I get around 2 modules with exported functions colliding? I made my module's function our scoped, but it still is mad at me when I try to use it. 15:06
lizmat note that module exporting / loading is lexical 15:11
m: my $ok = { use Test; &ok }; $ok 1
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> my $ok = { use Test; &ok }; $ok⏏ 1
expecting any of:
infix
infix stopper
statement end
statement modifier…
lizmat m: my $ok = do { use Test; &ok }; $ok 1 15:12
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> my $ok = do { use Test; &ok }; $ok⏏ 1
expecting any of:
infix
infix stopper
statement end
statement modif…
lizmat meh
m: my $ok = do { use Test; &ok }; $ok(1)
camelia ok 1 -
lizmat this imported all of the Test subs inside the scope, and returned only &ok 15:13
m: my $ok = do { use Test; &ok }; $ok(1); plan 42
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
plan used at line 1
lizmat m: my $ok = do { use Test; &ok }; $ok(1); ok 1
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
ok used at line 1
15:25 Kaiepi left
rf Ok thanks 15:25
I think I can make it work with this
15:28 Heptite joined 15:32 Kaiepi joined
rf lizmat: That worked perfectly, thank you! 15:37
lizmat you can even make it look like a sub if you want: 15:38
m: my &ok = do { use Test; &ok }; ok 1
camelia ok 1 -
Nemokosch lizmat: does your from module not provide some sugar for this? 15:42
lizmat yup 15:48
thanks for reminding me :-)
rf Is there any way to make a class attribute completely immutable? 16:03
I want it to be not assignable, and also the type to be frozen so you can't screw with it 16:04
lizmat is it a private attribute ? 16:08
rf Sort of? I override the getter, and it's not rw 16:16
lizmat class A { my constant foo = 42; method getter { foo } } 16:20
or 16:21
class A { method getter(--> 42) { } }
17:35 dakkar left
rf m: class A { my constant foo; }; A.new(foo => 'bar'); 17:49
camelia ===SORRY!=== Error while compiling <tmp>
Missing initializer on constant declaration
at <tmp>:1
------> class A { my constant foo⏏; }; A.new(foo => 'bar');
rf m: class A { has constant $.foo; }; A.new(foo => 'bar');
camelia ===SORRY!=== Error while compiling <tmp>
Virtual method call $.foo may not be used on partially constructed object (maybe you mean $!foo for direct attribute access here?)
at <tmp>:1
------> class A { has constant $.foo⏏; }; A.new(…
stevied anyone familiar with raku.land/zef:tbrowder/Storable::Lite? 17:53
I just get error when I try to store data: `$metals.to-file('metals.raku');` gets me: `No such method 'to-file' for invocant of type 'Str'` 17:54
tbrowder stevied pls file an issue. 17:55
stevied ok
tbrowder that is a pretty naive approach and may not be worth using 17:56
stevied here you go: github.com/tbrowder/Storable-Lite/issues/1 17:58
tbrowder thnx, i will try to fix 17:59
stevied: since i created that module,i’ve been using JSON::Fast to basically do the same thing. Also, that module is heavily used, actively maintained, and has top-tier authors. 19:09
Nemokosch what is Storable::Lite for exactly? 19:12
It seems simple enough to fix, if it should be fixed
<@563790557831495691> by the way, have you checked out raku.land/zef:finanalyst/RakuConfig ? 19:15
19:33 deoac joined 19:51 deoac left
stevied it's like perl's old storable module. I'm just going to convert the data to json and save that to a file 20:12
yeah, I went with json. I am not as familiar with that format so not sure if it might break with the data in some way while I can be sure something that serializes rak directly would work. 20:14
21:47 n1to joined
so I'm using JSON::Fast with `my %raku = from-json 'metas.json'.IO.slurp;` and that line is dumping the entire data structure to the screen 21:57
no idea why this is happening
Nemokosch there must be something that we cannot see from this snippet 21:58
stevied this is how the json was saved: 22:00
```
my $json = to-json [ $metas ];
spurt 'metas.json', $json;
```
$metas is a hash
maybe that makes a difference? 22:01
Nemokosch what does spurt take?
stevied not sure what you mean. it's saving the json data 22:02
Nemokosch lines() operates on `$*IN`, I was thinking if it could be operating on `$*OUT` by sheer chance 22:05
but that doesn't seem to match the docs
stevied why not? 22:06
Nemokosch docs.raku.org/routine/spurt#(Indep..._sub_spurt
anyway, how are you running the code?
stevied in a raku script 22:09
ugh, this is why I didn't want to use json. no fucking idea what I'm doing. 22:10
Nemokosch 🤣
22:11 discord-raku-bot left, discord-raku-bot joined
stevied "Odd number of elements found where hash initializer expected: 22:11
Found 1933 (implicit) elements:"
Nemokosch which line?
by the way, I have an idea what you were doing wrong with Storage::Lite 22:14
let me install that module
stevied i tihnk the module was just buggy
hold on, i'll paste the entire code
Nemokosch I wouldn't worry too much about that 22:15
stevied holy shit, debian updated their website. hell froze over 22:16
Nemokosch oh yeah, worked for me
stevied my spagetti code: paste.debian.net/1266929/ 22:17
important bits are at the bottom
22:17 Heptite left
saves %metas to json and spit it out to file 22:18
22:18 Heptite joined
Nemokosch github.com/tbrowder/Storable-Lite/issues/1 22:21
stevied oh cool
22:21 jgaz left
wonder why that's not on the docs 22:22
Nemokosch well, what docs? this is a random module
stevied docs in the module
github.com/tbrowder/Storable-Lite/...aster/docs
Nemokosch probably simply because nobody bothered to write it down 22:23
not all published stuff is equally well maintained
fortunately, the source code is pretty simple 22:24
stevied so looks like I got this json working. no idea how. just random trial and error 22:25
so if I save the data structure as a hash and restore it to a scalar, it works: `my $raku = from-json 'metas.json'.IO.slurp;`
the `$raku` behaves like a hash
22:29 discord-raku-bot left 22:30 discord-raku-bot joined
well, at any rate, I now have all meta files for every version of every distro in one giant file. only took me 2 friggin' days to do. haven't coded in raku for a few months and I got rusty fast. 22:30
but in my defense, it was a little tricky to figure out
rf That's cool, you should host this somewhere, you can be the Raku archivist 22:34
Nemokosch rf: do you know REA? 22:39
stevied that's where I got the data from 22:41
all the meta files are in a tarball
so i had to extract each meta file 22:42
anyway, now i'm closer to the goal of forking each module with legacy file names and submitting a patch 22:43
curious to see how it works out 22:44
rf Lol that is awesome, goodluck! 22:47
stevied thanks. i figured it was a one day project but now it looks like it's turning into more like a one week project. 🙂 22:48
22:53 discord-raku-bot left, discord-raku-bot joined 23:10 n1to left