🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
redhands quick question: did nqp::getcomp get renamed? nqp::getcomp("perl6") seems to be returning null object, and I think it was working about a year or so ago. 00:57
voidname Hello, everyone. I'm halfway through raku course (course.raku.org) and noticed the PART 2 - PART 5 of the course are not available. It seems to contain some import topics that are not covered in PART 1. Can anyone point me to the resources where I can learn those things (networking, object oriented programming, etc.,). Raku is the first programming language I'm learning. 04:02
moon-child iirc raku.guide/ was decent, and covers some of those 04:04
voidname thanks! 04:08
moon-child m: say + (True|False); say ? (True|False) 04:38
camelia any(1, 0)
True
moon-child why does ? collapse but + doesn't?
moritz_ because junctions are designed to be used in boolean context 07:24
andinus m: say 1^2 07:25
camelia one(1, 2)
andinus what is happening here?
tyil andinus: docs.raku.org/type/Junction 07:27
andinus ah, i was thinking ^ is ** 07:29
MasterDuke m: use nqp; dd nqp::getcomp('Raku') # redhands it's now followed the language name change 07:58
camelia (Perl6::Compiler without .raku or .perl method)
andinus what module should i use for sha1? 09:27
modules.raku.org returns github.com/bduggan/p6-digest-sha1-native
ctilmes andinus: Gcrypt does SHA1, but requires an external dependency (libgcrypt) github.com/CurtTilmes/raku-libgcry...igest-hash 10:25
tellable6 2021-03-21T17:23:54Z #raku <El_Che> ctilmes: \o/
stanrifkin can i load a file into the repl so i can test a sub already written in the file? 12:04
andinus yes, start the repl with `raku -Ilib` -- lib being the directory that file is in 12:09
lizmat japhb: www.reddit.com/r/rakulang/comments...e_in_raku/ 12:11
stanrifkin andinus: i thought of something like haskell where i can load a file and test some functions. i found EVALFILE but the function is not visible after execution. 12:13
stanrifkin raku.org mainpage still got a dead link under "more.." to example.perl6.org 12:21
MasterDuke perhaps `require 'filename';` first? 12:22
stanrifkin MasterDuke: will eval the file but subroutine isn't visible after that 12:24
MasterDuke any change if the sub has `is export`? 12:25
stanrifkin MasterDuke: maybe i put into a package and call full qualified name
MasterDuke: how to do that? 12:26
MasterDuke m: sub a($b) is export { say $b } 12:27
camelia ( no output )
stanrifkin MasterDuke: still doesn't work 12:28
MasterDuke sorry then, i'm out of ideas (besides creating a package/module for it), but the repl does have a bunch of known problems, maybe that's one of them 12:29
stanrifkin MasterDuke: i've got a simple fibonacci function here in a file. i want to call it with different arguments after it's loading into the repl
MasterDuke: no problem. i can run the file several times with changes or user input. i just thought about it, it could work like in haskel or lisp here 12:30
lizmat and another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/04/13/2021-...irst-conf/ 12:52
sena_kun lizmat++ 12:56
jmerelo lizmat++ 13:13
PimDaniel o/ 13:36
Hi:
I've got this:
String corruption detected: bad storage type in regex at /home/moi/raku/lib/.precomp/4A9B532DFE94A32567D38B422D487A96BD587829/68/68595D13809D9D2A55564C010C9CB7A66F1166DB line 1 13:37
Beuhhhhhhh!
And occurs randomly. 13:38
PimDaniel I just make a regexp that works most of the times but sometimes i get this strange error. 13:40
El_Che error is indeed LTA 13:40
dakkar that feels like time for a debug build of moarvm and running under valgrind… ugh 13:41
PimDaniel El_Che : LTA???
El_Che Less Than Awesome
dakkar "Less Than Awesome" 13:42
PimDaniel Ok thank's.
PimDaniel May be a new version of Raku? 13:44
MasterDuke i don't think i've ever seen that error before. could you share the code? 13:45
PimDaniel YES: I must control if this is not due to a Null string before. 13:46
PimDaniel I come back on my problem: Sometimes raku crashes : segfault. 15:30
Did someone allready saw crashes with Str.math routine?
here's the line: my $match = $k.match(/^ \d+ '_' (\d+) '-' \d+ '_' (\d+) $/); 15:31
for %vmis_pts.keys -> $k { my $match = $k.match(/^ \d+ '_' (\d+) '-' \d+ '_' (\d+) $/); ... } 15:32
I'm Very sure $k is an Str. 15:33
Erreur de segmentation 15:34
PimDaniel i must correct : Str.match NOT Str.math 15:39
Sometimes i get that: indexingoptimized requires a concrete string, but got null. ???? 15:46
lizmat PimDaniel: sanity check: which version of Rakudo are you using ? 15:47
PimDaniel Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.10. Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d Built on MoarVM version 2020.10. 15:50
PimDaniel I think my loops many times : my code is not optimized but i should not have this kind of error. 15:53
lizmat agree with you you shouldn't have this type of error 15:55
but 2020.10 is 5 months old and a lot has been improved re stability since then
is there a chance you could check whether that still is an issue with 2021.03 ?
PimDaniel Okay i'll upgrade may version and check... don't remerber where we grab the source? 15:57
may we uninstall last version? 15:58
before?
PimDaniel Question of the same order: Is there an apt link for Debian? 16:02
PimDaniel It should be faster, no? 16:02
I would.
MasterDuke El_Che: ^^^
PimDaniel: github.com/nxadm/rakudo-pkg 16:03
PimDaniel MasterDuke thank's but i do not know to which question you reply. 16:08
Raku debian package or raku npm package? more questions : Is that version the latest one, Stable? or Rolling Release? 16:09
MasterDuke that repo has instructions on how to get an updated apt for debuan
*debian
PimDaniel Before all : is there a way to remove properly my precedent binary distro? 16:23
I made the debian process but did not install yet.
MasterDuke something like `apt remove rakudo` should do it, but i think just upgrading the current one should be fine 16:24
PimDaniel The older one has nothing to do with apt.
It's a binary package. 16:25
MasterDuke oh, you mean just a .tar.gz or something like that?
PimDaniel Yes!
I made a rakudo-star-2020.10 folder which is still here. 16:26
MasterDuke just delete that folder is probably sufficient
PimDaniel No no : i have many things into my /usr/local/ Tree 16:28
PimDaniel Ok i remember: i have a rakudo-star-2020.10/src/moarvm-2020.10/MoarVM-2020.10 subdir with a ./Configure.pl perl Script. 16:30
and the README that i was looking for. 16:31
But nothing helps : no uninstall target. 16:33
MasterDuke what the value of PREFIX in the Makefile in your MoarVM subdirectory? 16:35
*what's
PimDaniel I cannot see the Makefile. 16:36
MasterDuke in any of the directories/subdirectories? 16:37
PimDaniel Ok i had to run ./Configure again.
prefix is /home/moi/Downloads/rakudo-star-2020.10/src/moarvm-2020.10/MoarVM-2020.10/install/ 16:38
I thing i changed prefix
whith an argument 16:39
MasterDuke whatever you'd given as the prefix is all you should have to delete
PimDaniel Yess but it's never perfect work that way. 16:41
You can suppress important things. 16:42
I'll refer the the install target.
redhands nevermind, this seems to do it: nqp::getcomp("Raku") 17:07
PimDaniel lizmat I intalled new version but the bug remains.: Segmentation fault. 17:33
lizmat PimDaniel: then please, "show us the code", possibly after you've been able to golf it 17:34
PimDaniel what means golf?
lizmat making the code smaller while still showing the problem (in this context) 17:35
it comes from: en.wikipedia.org/wiki/Code_golf 17:36
PimDaniel ok thanks lizmat. 18:42
PimDaniel I'll make a few tests to understand what context produces the crash. If i found. i'll make a golf. 18:44
otherwise i'll publish a whole committed version. 18:45
Doc_Holliwood weekly: my comment under www.youtube.com/watch?v=6X2D497is6Y 19:17
notable6 Doc_Holliwood, Noted! (weekly)
lizmat Doc_Holliwood: so many comments ? 19:26
didn't find yours
and how to link to yours ?
Doc_Holliwood hold on 19:27
twitter.com/HrBollermann/status/13...9383468032 19:30
I'm afraid it's not possible to link a comment
on YT
lizmat yeah.. ok, cool!
I will see it when parsing the #rakulang stream 19:31
japhb lizmat: Thank you for the pointer to that Reddit question. It was finally enough to convince me to create a Reddit account after all these years so I could answer it. :-) 19:41
lizmat japhb++ 19:42
PimDaniel lizmat : i've found the problem which has nothing to do with the line error: 19:43
I was building a new key on a hash that i was parsing with for.
It produced a memory problem that dit not indicate the true error. 19:44
lizmat did you do this from multiple threads at the same time ? 19:45
PimDaniel for %h.keys { $h{<newkey>} = something;} 19:46
lizmat: I struggle to reply to your question since i do not really know when new tread is created in Raku.
lizmat what is $h in that example ? 19:47
also, {<foo>} feels wrong 19:48
PimDaniel Hooo i mean %h
lizmat you probably meant %h<foo> then ?
PimDaniel YES
lizmat how big is the %h hash originally ?
in number of keys ? 19:49
PimDaniel Very small: but hash was feeding when it was parsing itself at the self time.
lizmat very small means < 10 ? 19:50
PimDaniel In my algorithm hash is here just to catch back keys.
lizmat and the newkey is always a constant? or is it somehow dependent on the key ?
PimDaniel YES less than 10
PimDaniel The new key is produced by existing keys produced before into a precedent loop but new keys have a complete different form and they are filtered by the math function. 19:52
lizmat m: my %h = "a" .. "e" Z=> 1..5; for %h.keys { %h{$_~$_} = 42 } # would this describe your situation ? 19:53
camelia concatenate requires a concrete string, but got null
in block <unit> at <tmp> line 1
lizmat wow, that's interesting, doesn't do that locally
m: my %h = "a" .. "e" Z=> 1..5; for %h.keys { %h{$_~$_} = 42 }
camelia ( no output )
lizmat m: my %h = "a" .. "e" Z=> 1..5; for %h.keys { %h{$_~$_} = 42 }
camelia ( no output )
lizmat m: my %h = "a" .. "e" Z=> 1..5; for %h.keys { %h{$_~$_} = 42 }
camelia ( no output )
PimDaniel I'll paste the piece of code tomorrow : it's late for me.
lizmat m: my %h = "a" .. "e" Z=> 1..5; for %h.keys { %h{$_~$_} = 42 } # foo
camelia ( no output )
lizmat m: my %h = "a" .. "e" Z=> 1..5; for %h.keys { %h{$_~$_} = 42 } # foo
camelia ( no output )
lizmat m: my %h = "a" .. "e" Z=> 1..5; for %h.keys { %h{$_~$_} = 42 } # foo
camelia ( no output )
lizmat m: my %h = "a" .. "e" Z=> 1..5; for %h.keys { %h{$_~$_} = 42 } # foo 19:54
camelia ( no output )
lizmat PimDaniel: whenever you're ready :-) 19:54
PimDaniel my loop is imbricated and i use Str.match function.
I'll reproduce it tomorrow morning : the problem is to have a chunk of datas for it. 19:55
Well i do not know what is the expected behavior in this case : feeding during parsing.
I'd say at first: it should not crash : this should be controlled. 19:56
lizmat I agree
PimDaniel But many langages do not accept this, i do not even know for Perl7. 19:57
lizmat m: my %h = "a" .. "e" Z=> 1..5; for %h.keys.eager { %h{$_~$_} = 42 } 19:58
camelia ( no output )
lizmat key.eager could be a workaround for now
it would fetch all current keys before keys are being added
PimDaniel May be use a random generator : it depends of datas 19:59
Also it occured when i used Str.match function : it's probably a memory bypass on match because match uses a few memory and for sure malloc or calloc underneath i think. 20:00
Ok good night : i'll track this tomorrow. 20:01
lizmat My guess for now is that adding keys while *lazily* iterating over a hash, may be a case of DIHWIDT 20:02
El_Che PimDaniel: rakudo-pkg can be installed next to rakudo supplied by the OS if you want to 20:45
tellable6 El_Che, I'll pass your message to PimDaniel
guifa lizmat: I noticed on the weekly that you did some work on user-added subclasses of Str 21:24
lizmat well, I worked on Str, Cool and Allomorph to transparently allow for subclasses of Str, indeed
lizmat m: class A is Str { method foo() { dd } }; my A() $a = "bar"; $a.foo 21:25
camelia method foo(A: *%_)
guifa A() ! 21:26
I was trying to figure out how to create subclasses, because nothing was working for instantiating
m: class Foo is Str { }; my Foo $a = 'a';
camelia Type check failed in assignment to $a; expected Foo but got Str ("a")
in block <unit> at <tmp> line 1
guifa m: class Foo is Str { }; my $a = Foo.new: ‘a’; 21:27
camelia Default constructor for 'Foo' only takes named arguments
in block <unit> at <tmp> line 1
lizmat but now with the new coercion syntax, it is much easier! 21:28
I figured it would make some people happy :-) 21:29
guifa Yeah. I had for a while thought about just making LanguageTag be a subclass of Str, but I decided in practice, providing a solid .Str worked basically as well
lizmat well, for the future, it could change the API for stuff like that 21:36
guifa: another approach:
m: class A is Str { method foo() { dd } }; my constant Str = A; my $a = "bar"; $a.foo # aka "lexical refinement" 21:37
camelia method foo(A: *%_)
guifa That won’t work for modules though right? Since the Str symbol will already be in scope and export can’t overwrite things in the symbol table, just add to it? 21:39
lizmat well..... that would be a bridge to cross :-) 21:40
I mean, if I can do it without a use statement, I should be able to do that *with* a use statement as well?
I mean, exports *are* lexical 21:41
so technically, it wouldn't be overwriting, just adding a symbol already known globally, in the lexical context of the "use" statement 21:42
guifa It would be a little weird though. Because if my use replaces Foo with Bar, if Bar isn’t a subclass of Foo, then I can see that causing all sorts of issues
lizmat well, with great power comes great responsibility 21:43
guifa True
Drop in class replacement is something that has to be done very carefully — I can’t think of anyone other than me that’s tried to, and whiel mine works and plays nicely, I still feel like I’m doing something I shouldn’t be lol 21:44
lizmat mind you, it is *not* class replacement 21:46
guifa Yeah, not at the technical level. But it would appear that way to the module user
lizmat m: sub ok() { say "foo" }; { use Test; ok 42 }; ok 42
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling ok(Int) will never work with declared signature ()
at <tmp>:1
------> 3k() { say "foo" }; { use Test; ok 42 }; 7⏏5ok 42
lizmat m: sub ok($a) { say "foo" }; { use Test; ok 42 }; ok 42
camelia ok 1 -
foo
lizmat outer "ok" is hidden, but only *inside* that scope 21:47
well, users need to realize that "use" is lexical 21:48
and that's hard for people coming from Perl
but yeah, it *is* something that needs to be taught and learned