🦋 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.
00:00 reportable6 left, reportable6 joined 00:41 Sgeo_ joined 00:42 Sgeo left 00:53 Pip` is now known as PipStuart 01:09 Manifest0 left 01:17 saint- joined 01:24 ispyhumanfly joined
jaguart a question about `use v6;` vs `use v6.d+` -> I see that the second gives me access to `Supply.snip() from core.e` - is this expected? I don't have the 01:30
.PREVIEW modifier and there is no warning? v6.d doesn't show methods from core.e 01:31
01:32 melezhik joined 01:35 ispyhumanfly left
tbrowder hi, can anyone explain trait handles? it looks like it can only applied to one attribute. 01:41
01:42 melezhik left
tbrowder m: class f{ also does Associative; has %.idx handles <AT-KEY>; has %.b handles <AT-KEY>}; use f; 01:45
camelia ===SORRY!=== Error while compiling <tmp>
Package 'f' already has a method 'AT-KEY' (did you mean to declare a multi method?)
at <tmp>:1
tbrowder docs don't mention that
01:48 razetime joined
jaguart handles is like delegation `has $!x handles foo,bar,baz` then when someone calls c.foo it is passed through to $!x.foo 01:50
so it doesnt make sense to have two AT-KEY methods handled by different fields
01:55 ispyhumanfly joined
tonyo tbrowder: what is your goal with this ^ ? 01:56
jaguart m: class A { method foo { say 'foo'} }; class B { method bar { say 'bar'} }; class C { has $!a handles 'foo'; has $!b handles 'bar'; submethod TWEAK {$!a = A.new; $!b = B.new } }; C.new.foo; 01:58
camelia foo
jaguart m: class F does Associative { has %!f handles <AT-KEY EXISTS-KEY STORE>; }; my $f = F.new; $f<a> = 'ah'; say $f<a>:exists; 02:04
camelia True
02:08 MasterDuke left
tbrowder my goal is to (1) know how one should use 2 or more attributes of the same type and (2) file a doc issue 02:24
ispyhumanfly tonyo: I'm trying your instructions now. Thank you. 02:27
tellable6 2023-01-17T17:01:00Z #raku <tonyo> ispyhumanfly can you add a key value to `$HOME/.fez-config.json`: `"bundlers": ["Fez::Util::Tar"]` and give it another shot?
rf jaguart: Thanks for this, this is incredibly useful for writing simple wrapper calsses thank you.
02:28 xinming left, xinming_ left, xinming joined 02:29 xinming_ joined
ispyhumanfly tonyo: tonyo: so far it just hangs at "fez upload" as it has before. Will their be some debug archive as a result of my doing this? 02:31
tonyo yea, give me a second and i'll give you a one liner 02:37
if you mv .gitignore to .whatever temporarily does it work 02:38
ispyhumanfly tonyo: I'll try that. 02:45
02:45 PipStuart is now known as Pip`
tonyo if that works i'll prioritize getting the glob branch merged to make better dists 02:45
ispyhumanfly tonyo: yes that worked :)
02:46 Pip` is now known as PipStuart 02:48 PipStuart is now known as Pip`
tbrowder speaking of zef, another thing the docs need is a blurb on the correct way to install modules by root so all raku users see them. it'd 02:50
*it's in the voluminous zef documentation but, imho, it needs to be in the docs somewhere as a best practice. 02:52
02:54 ispyhumanfly left 02:59 ispyhumanfly joined, Pip` left 03:01 PipStuart joined 03:03 PipStuart left
jaguart yeah - Good Practice docs, would be very much appreciated by newbies 03:06
ugexe the default config for zef will already install modules to the global 'site' repository if it is writable (like when you are root) 03:14
github.com/ugexe/zef/blob/9779091b...1230-L1237 03:15
ispyhumanfly tonyo: Hey thank you for your help.
ugexe github.com/ugexe/zef/blob/9779091b...ig.json#L5
ispyhumanfly ugexe: good stuff.
03:16 rf left 03:21 epony joined 03:31 PipStuart joined
thowe Is there, like, a recommended Mastodon server for Raku fans? fosstodon.org maybe? 03:32
03:35 Xliff joined
Xliff \o 03:35
Is there an example written on how to reassign $*OUT to an IO::Handle::Subclass? 03:36
Um... I meant an IO::Handle subclass
Aha! I found this one... 03:38
03:41 razetime left
Xliff m: multi sub a (1) { 1 }; multi sub a(2) { 2 }; multi sub a ("Bleah") { "Boo!" }; .signature.params.gist.say for &a.&candidates 03:57
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
candidates used at line 1
Xliff m: multi sub a (1) { 1 }; multi sub a(2) { 2 }; multi sub a ("Bleah") { "Boo!" }; .signature.params.gist.say for &a.candidates 03:58
camelia (1)
04:03 ispyhumanfly left 04:05 ispyhumanfly joined 04:17 ispyhumanfly left 04:18 peter1 joined
peter1 hi,is there anyone who knows both OCamel and Raku? 04:18
04:21 peter1 left 04:23 ispyhumanfly joined 04:28 ispyhumanfly left 04:29 ispyhumanfly joined, jpn joined 04:34 razetime joined 04:35 jpn left 04:43 ispyhumanfly left 04:45 ispyhumanfly joined 04:53 jmcgnh left 05:05 jmcgnh joined
tonyo rf ^? 05:05
CIAvash tonyo: Just updated my meta info. It's `CIAvash` and changed my display name to CIAvash, changed my website to siavash.askari-nasr.com and set an email address 05:17
05:19 razetime left 05:41 Homer_Simpson joined 05:57 ispyhumanfly left 06:00 reportable6 left 06:03 reportable6 joined 07:03 shareable6 left, tellable6 left, committable6 left, benchable6 left, notable6 left, coverable6 left, greppable6 left, quotable6 left, statisfiable6 left, evalable6 left, squashable6 left, bloatable6 left, linkable6 left, nativecallable6 left, sourceable6 left, unicodable6 left, releasable6 left, bisectable6 left, reportable6 left, committable6 joined, sourceable6 joined 07:04 greppable6 joined, bloatable6 joined, releasable6 joined 07:05 benchable6 joined, bisectable6 joined, linkable6 joined, notable6 joined, quotable6 joined, reportable6 joined, unicodable6 joined, coverable6 joined 07:06 tellable6 joined, shareable6 joined, nativecallable6 joined, statisfiable6 joined, squashable6 joined, evalable6 joined 07:54 discord-raku-bot left, discord-raku-bot joined 07:57 abraxxa joined 08:01 jjido joined, abraxxa left 08:02 abraxxa joined 08:21 razetime joined 08:23 discord-raku-bot left, discord-raku-bot joined 08:27 Sgeo_ left 08:29 jjido left 08:53 ispyhumanfly joined 08:57 ispyhumanfly left 09:01 jpn joined 09:05 dakkar joined 09:06 jpn left 09:09 razetime left 09:12 Homer_Simpson left 09:18 ab5tract joined 09:27 Nemokosch joined
Nemokosch .seen jjatria 09:27
tellable6 Nemokosch, I saw jjatria 2022-09-22T14:41:01Z in #raku: <jjatria> So it _would_ have worked if I had bumped the version again?
Nemokosch :c
09:27 Nemokosch left 09:32 Manifest0 joined 09:36 sena_kun joined 10:16 ecocode left 10:17 ecocode joined 10:19 jpn joined 10:30 Homer_Simpson joined
Homer_Simpson how can I automatically create a new list if the loop condition is true 10:30
10:30 sena_kun left
Homer_Simpson in C you would use malloc/realloc/free 10:30
lizmat you have to be more specific 10:35
Homer_Simpson unless I just append the data to the same list 10:36
lists are mutable right
Nemokosch lists by themselves don't provide mutation, although they are not immutable in the strictest sense 10:37
an Array (which is a List) is definitely mutable
Homer_Simpson yeah but I need it to be homogenous 10:38
Nemokosch what does that mean? 10:39
Homer_Simpson where it allows mixed types
lizmat m: my @a = 1,2,3; @a.push(42); say @a 10:40
camelia [1 2 3 42]
lizmat m: my @a = 1,2,3; @a.push("foo"); say @a
camelia [1 2 3 foo]
lizmat Homer_Simpson ^^ like that ? 10:41
Homer_Simpson ill try 2 seconds
yeah like that 10:43
lizmat Note there's also .unshift if you want to add at the start 10:44
m: my @a = 1,2,3; @a.unshift("foo"); say @a
camelia [foo 1 2 3]
lizmat you might also want to check splice for more general array manipulation 10:45
Homer_Simpson I basically only use operators with arrays, idk if thats weird or not
other than get/say and maybe chomp 10:46
even chomp can be done with operators I guess
it wont resize the array but doing @a[n] = Nil or @a[n] = 0; basically removes the value from it 10:47
@a = (); or @a = Empty; or @a = |(); is to clear an array 10:48
lizmat @a.splice 10:53
but yeah... I think @a = Empty reads the best 10:54
11:11 sena_kun joined
Homer_Simpson how do I put my functions in another raku file and then include that file in my project 11:30
by functions I mean my own defined subroutines
lizmat docs.raku.org/language/modules#index-entry-use 11:31
Homer_Simpson ah I dont need the "" 11:33
tbrowder .tell tonyo ^^^ 11:35
tellable6 tbrowder, I'll pass your message to tonyo
Homer_Simpson it says it cant find Islinetype1.raku 11:36
ok its not looking my my project folder for some reason 11:38
lizmat there's two answers to your question: 11:39
the simple one, that is good for development
the more complicated one, that is good for production
which one do you want ?
Homer_Simpson pastebin.com/Rmdmq5Zb 11:41
good for development
lizmat Add -I. to your raku invocation 11:42
or do: 11:43
export RAKULIB=.
11:44 ispyhumanfly joined
Homer_Simpson use -I Islinetype1.raku 11:44
Undeclared names I used at line 1 11:45
lizmat -I. 11:46
Homer_Simpson oh crud
lizmat and on the command line
Homer_Simpson ok
lizmat you could also put:use lib '.' 11:47
in your code, but that would interfere with whenever you decide to take it into production
11:48 ispyhumanfly left
Homer_Simpson ok so doing raku -I. do.raku still gives the same error where it cant find the file and doing raku -I. Islinetype1.raku only executed that file, where as the other file is the main file 11:56
12:00 reportable6 left
lizmat show us the code 12:00
Homer_Simpson ok
12:00 reportable6 joined
Homer_Simpson pastebin.com/D7644832 12:07
12:13 leah2 left
Nemokosch you mismatch casings 12:15
lizmat also a missing "is export" 12:16
tbrowder .tell tonyo now i'm really confused 'cause i now don't need to specilfy the Associative role or the handles and all works as i originally thought it did. probably a late-night ff. back to the drawing board.... 12:18
Nemokosch also, it seems to me that importing is extension sensitive somehow
tellable6 tbrowder, I'll pass your message to tonyo
12:19 leah2 joined
Nemokosch when I changed IsLineType1.raku to IsLineType1.rakumod, it suddenly worked... 12:20
Homer_Simpson I made a completley new project, containing lego.raku and testing.rakumod now if I do use testing.rakumod; and then do raku -I. lego.raku I get: 13:01
===SORRY!=== Error while compiling C:\Users\kris\CommaProjects\lego/lego.raku 13:02
Confused at C:\Users\kris\CommaProjects\lego/lego.raku:1 ------> use testing<HERE>.rakumod;
Nemokosch remove the extension from your "use" statement
Homer_Simpson ok now it worked 13:03
ok ill try adding the subroutine back in
13:19 linkable6 left, evalable6 left 13:20 evalable6 joined 13:21 linkable6 joined 13:26 jjido joined
Nemokosch leont: I remember multi dispatch with coercions came up as a topic 13:32
I'm mangling with the XML distribution and right now I have something like this: 13:33
let's put it aside whether this is a sensible api or not 13:34
but do you agree with the idea that this dispatch makes sense conceptually? haven't tried it yet but I think it might actually work now
13:41 jgaz joined
okay check, something really weird happens - the coercion precedes the subset testing 13:41
13:57 jjido left 14:20 saint- left 14:44 SqrtNegInf left
[Coke] TIL about 'git gui blame', which is a pleasant way to go back in time to find when a line was added to a file. 14:44
14:59 rf joined 15:08 melezhik joined
melezhik tell ispyhumanfly: I see you are trying to run builds for dot-env on SparrowCI, I know error messages might be confusing , I need to improve them )), but you can take a look at any successful build from other repos as example for sparrow.yaml , for example - github.com/rawleyfowler/Net-Gemini...arrow.yaml 15:13
tell: ispyhumanfly: I see you are trying to run builds for dot-env on SparrowCI, I know error messages might be confusing , I need to improve them )), but you can take a look at any successful build from other repos as example for sparrow.yaml , for example - github.com/rawleyfowler/Net-Gemini...arrow.yaml 15:14
tellable6 melezhik, I'll pass your message to ispyhumanfly
rf I made a pull-request on his repo to fix this.
github.com/ispyhumanfly/raku-dotenv/pull/1 15:15
melezhik rf: thanks a lot !
rf No problem!
15:20 melezhik left 15:22 epony left 15:25 Sgeo joined, melezhik joined
melezhik . 15:25
15:29 melezhik left 15:44 razetime joined 15:51 clarjon1 left 16:20 Homer_Simpson left
Geth infrastructure-doc/example-change: 006180182a | (Coleman McFarland)++ | README.pod
Trivial Change
infrastructure-doc: dontlaugh++ created pull request #7:
Trivial Change
infrastructure-doc: 006180182a | (Coleman McFarland)++ | README.pod
Trivial Change
infrastructure-doc: 8507e74e8c | (Coleman McFarland)++ (committed using GitHub Web editor) | README.pod
Merge pull request #7 from Raku/example-change

Trivial Change
16:23 Homer_Simpson joined
Homer_Simpson ok now I am getting 'unclared routine: replace()' 16:24
it worked when it was in the same file but I moved it to a module
this is the contents of replace.rakumod: sub replace($s, $i, &y){return substr($s, 0, $i) ~ y(comb($s, $i)) ~ substr($s, $i + 1);}; 16:29
[Coke] if it's in a module, did you export it? 16:32
Homer_Simpson I dont think so
I just included it in my raku project
[Coke] you either need to refer to with the fully qualified name, Some::Module::replace ... or declare it as "is export"
Homer_Simpson how do you declare it is export
[Coke] you also need to 'use' it in the top level raku
Homer_Simpson done that 16:33
[Coke] sub foo(...) is export { ... }
Homer_Simpson thx
[Coke] github.com/coke/raku-zef-deps/blob...rakumod#L5 , e.g. 16:34
(probaby also need the "our" scope)
16:44 NemokoschKiwi joined
Homer_Simpson does the our make it accessable for the entire project rather than the entire file 16:54
in C you use static , there is also extern idk what raku's equivelents are 16:55
16:57 razetime left
lizmat docs.raku.org/syntax/our 17:01
Nemokosch Raku is not really like C, I think many of these comparisons just don't make sense
17:36 dakkar left 17:44 lichtkind joined 17:55 abraxxa left
Homer_Simpson can raku compile to a .exe 17:57
the exe contains the java VM bytecode 17:58
17:59 NemokoschKiwi left
Nemokosch no (it cannot) and no (it doesn't contain the java VM bytecode) 18:00
18:00 reportable6 left
[Coke] there is no easy way to do that, HS. 18:00
(regardless of which backend, js,moar,jvm)
18:01 reportable6 joined
rf You can probably compile to a JAR with the jvm backend 18:01
Nemokosch not really, from what I know 18:03
18:13 sena_kun left 18:23 japhb left
rf That seems odd, especially if it can target the JVM 18:27
Nemokosch I'm not sure it actually "targets the JVM" in the sense, say, Clojure targets the JVM 18:28
my vague impression of the code has been that it rather has a *JVM-based runtime* 18:29
which would mean it only "targets the JVM" by the standards it "targets the C language" (since MoarVM is written in C)
18:30 japhb joined
rf Ah, I see. 18:30
Nemokosch I might be wrong though. I don't know many people involved in the JVM backend, usev6 and Kaiepi basically 18:34
Homer_Simpson I wrote a load of code then reaized that I can just do print("the file: '", $fh, "' has: ", elems(lines($contents))," lines.\n"); 18:37
does raku have EOF
(end of file constant) 18:38
its actually a character but is represented by EOF, its asci ID is 0x05 18:39
ugexe you can call .eof on the handle to see if its at the eof, but i don't see why you'd need to do that 18:41
lizmat Homer_Simpson: you don't even need to get a file handle
say "$filename has $filename.IO.lines.elems() lines" 18:42
Nemokosch seems like you need to break away a bit from the C way of thinking. C is mostly concerned about bytes and memory handling. Raku is more about text processing among other things. Also, Raku is much more elastic, regarding syntax and data structures as well. 18:45
18:52 sena_kun joined 19:00 jjido joined
rf I am running into a weird issue where a named argument is always Nil, even if I specify it in the method call: github.com/rawleyfowler/Humming-Bi...kumod#L239 19:14
If I go `say $permanent` above everything else, even when I specify it, I get Nil. 19:15
jaguart the one I have is when you have method x ( $a, :$b ); and the call is x ( 5, :b ); where there is a space between x and ( on the calling side
it eats args because it calls x with one arg - a List, argh 19:17
s/have/hate/ 19:18
maybe do a backtrace if $permanent.^name eq 'Nil'? 19:19
rf Yeah, I'm using it like: `$response.redirect('/', :permanent);`
jaguart you also have Type on your arg so a List would barf 19:20
how about add Bool on :$permanent? 19:21
rf I'll try that 19:23
Same problem 19:24
Nahita not really reproducible but what does `say %_` gives in the method 19:27
jaguart I'd try a backtrace then to check the code-path 19:29
rf %_ is empty on every test
jaguart another introspection would be to see what (|arg) { dd arg } reports - though you might be able to see the capture walking back through your caller stack - you can in perl, not sure about Raku 19:32
tonyo .tell ispyhumanfly no problem. i have a fix for that bug in progress 19:33
tellable6 tonyo, I'll pass your message to ispyhumanfly
jaguart not tried: `dd $_ for Backtrace.new.nice;` might help see if something is not passing :$permanent through? 19:37
rf If I remove Str from the first arg, I get a different error when calling with :permanent, it claims I have only passed 2 args instead of 3, (2 being the obj and the to) 19:41
Seems to omit the passing of :permanent
I think I found the issue. 19:45
19:45 ispyhumanfly joined
rf I don't want to talk aboutit 19:45
Thank you for the backtrace tip, that helped a lot 19:46
Homer_Simpson @lizmat how come doin $conents[0] is actually line 3 19:53
contents[0] is line 3 for some reason 19:54
dont computers read and write files (and to the video buffer) from top to bottom, and right to left
[Coke] Homer_Simpson: need to see code. 19:55
Homer_Simpson and $contents[1] is out of range 19:56
pastebin.com/RFaRVfUy 19:57
[Coke] add a "dd $contents" on line 3 to see what's actually in contents. 19:59
It's a single string with newlines.
m: my $string = "asdf\nasdf\nadsf\n"; dd $string[1]; 20:00
camelia Failure.new(exception => X::OutOfRange.new(what => "Index", got => 1, range => "0..0", comment => Any), backtrace => Backtrace.new)
[Coke] You can't index a string that way. you probably want .lines instead 20:01
then you get something array-ish back that you can index by line number.
Hope that helps
Homer_Simpson Str $contents = "1 0 0 16 0 1 0 0 0 1 0 0 0 1 3024.dat\n1 0 0 8 0 1 0 0 0 1 0 0 0 1 3024.dat\n1 0 0 0 0 1 0 0 0 1 0 0 0 1 3024.dat\n" 20:02
I know you normally cant
but elems was working
so I assumed it was an implicit array of strings not a single string 20:03
despite it having the $ sigil
[Coke] you're calling elems on lines of content, not content.
when you do, you get the array. when you don't, you have a string with newlines. 20:04
m: my $a="abc\ndef\nasdf\n123\n"; dd lines($a) 20:05
camelia ("abc", "def", "asdf", "123").Seq
[Coke] it's not implicit, we're explicitly making it an array with lines()
Nemokosch > the one I hate is when you have method x ( $a, :$b ) 20:13
just seen module code like that today - probably not a good idea in the first place
20:14 jpn left
Homer_Simpson bbl 20:19
21:09 Bocaneri joined, Bocaneri is now known as Guest5498 21:11 Sauvin left
tonyo CIAvash: i see those changes reflected in the db, the stats job is failing, should be fixed shortly 21:52
tellable6 2023-01-18T11:35:18Z #raku <tbrowder> tonyo ^^^
2023-01-18T12:18:49Z #raku <tbrowder> tonyo now i'm really confused 'cause i now don't need to specilfy the Associative role or the handles and all works as i originally thought it did. probably a late-night ff. back to the drawing board....
stevied www.reddit.com/r/rakulang/comments..._outdated/ 22:07
22:11 linkable6 left, evalable6 left 22:13 linkable6 joined 22:14 evalable6 joined
tonyo CIAvash: should be updated - 22:19
stats is a little more complicated and needs to be done again 22:20
(they're very out of date)
22:20 Homer_Simpson left
PipStuart Greetings to everyone in #raku! I'm just another mediocre Perl5 hacker who hadn't started learning Raku (or prior Oct2019 Perl6) up until about a week ago. Lots to learn. Thanks in advance for just being willing to help with that. 22:47
Nemokosch Hello, welcome on board 🙂 22:49
PipStuart has a question: If Raku's substr() doesn't allow for replacement within indexed strings, are most such needs now handled with ~~ smart-match && regex substitutions?
Nemokosh: Thank you. =) 22:50
Nemokosch I think there is substr-rw as well
docs.raku.org/routine/substr-rw 22:51
PipStuart Nemokosh: Oh, super-cool. Thanks! I must've missed it.
Nemokosch it returns a writeable part
22:51 lichtkind left 22:59 japhb left, japhb joined 23:15 codesections joined 23:18 sena_kun left 23:21 japhb left 23:22 japhb joined 23:23 stevied_test joined 23:30 stevied_test left, stevied_test joined 23:32 jgaz left