🦋 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.
00:19 Zero_Dogg left 00:20 Zero_Dogg joined
rypervenche Ahhh, that's what I was wanting to know. Great! Thanks. 00:36
00:54 __jrjsmrtn__ joined 00:55 _jrjsmrtn left 01:29 Noisytoot left 01:50 Noisytoot joined 01:52 sena_kun joined 01:54 Altai-man_ left 01:55 hungrydonkey left 02:06 satori__ joined 02:08 reach_satori_ left 02:16 cpan-raku left 02:17 cpan-raku joined, cpan-raku left, cpan-raku joined 02:28 Xliff joined 02:34 Zero_Dogg left 02:36 _jrjsmrtn joined 02:37 __jrjsmrtn__ left 02:47 Zero_Dogg joined 03:40 wamba joined 03:52 Altai-man_ joined 03:54 sena_kun left 04:37 kst left 04:43 guifa2 joined 05:00 hungrydonkey joined 05:08 hungrydonkey left, hungryd7 joined 05:10 vrurg left 05:11 vrurg joined 05:14 xinming left 05:16 OpenZen left, vrurg left 05:18 xinming joined 05:24 andrzejku joined 05:27 yht joined 05:42 wamba left 05:44 vrurg joined, vrurg left, vrurg joined 05:45 xinming left 05:46 xinming joined 05:53 sena_kun joined, andrzejku left 05:54 Altai-man_ left 06:08 aindilis left, xinming left 06:10 xinming joined 06:16 kensanata joined 06:23 andrzejku joined 06:32 JJMerelo joined 06:33 sno left 07:00 hungrydonkey joined 07:02 hungryd7 left 07:06 sno joined 07:08 rindolf joined 07:09 yht left 07:22 yht joined 07:30 hungryd88 joined 07:32 hungrydonkey left 07:48 dakkar joined 07:51 Altai-man_ joined 07:54 sena_kun left 08:00 aindilis joined 08:12 aindilis left
AlexDaniel` m: my uint8 $x = 255; say $x++ 08:19
camelia -1
AlexDaniel` -_-
bisect: my uint8 $x = 255; say $x++
bisectable6 AlexDaniel`, Will bisect the whole range automagically because no endpoints were provided, hang tight
AlexDaniel`, ¦6c (44 commits): «-1␤»
AlexDaniel`, Nothing to bisect!
08:21 pecastro joined
AlexDaniel` m: my uint8 $a = 200; my uint8 $b = -50; .say for $a..$b 08:21
camelia 200
201
202
203
204
205
206
08:23 oddp joined 08:33 aindilis joined 08:35 sarna joined 08:36 benaiah left 08:37 benaiah joined 08:44 Sgeo left 08:49 hungryd88 left 08:50 hungrydonkey joined 08:52 JJMerelo left
cpan-raku New module released to CPAN! HelloWorld (1.0.2) by 03PMQS 08:53
08:53 sena_kun joined 08:56 Altai-man_ left 08:59 markoong joined 09:02 hungryd51 joined 09:05 markong joined, markoong left 09:06 hungrydonkey left 09:07 hungrydonkey joined 09:10 hungryd51 left 09:18 rindolf left, hungryd57 joined 09:21 xinming left, xinming joined 09:22 hungrydonkey left 09:28 antoniogamiz joined, rbt left 09:29 rbt joined 09:36 yht left
antoniogamiz m: my $string = '<a href="?!^a">b</a>'; my $content; say $string ~~ /href\=\"{$content=$¢}\"/; 09:41
camelia Nil
antoniogamiz m: my $string = '<a href="?!^a">b</a>'; my $content; $string ~~ /href\=\"{$content=$¢}\"/; say $content;
camelia #<failed match>
antoniogamiz someone knows why it's failing? 09:42
timotimo m: my $string = '<a href="?!^a">b</a>'; my $content; say $string ~~ /href\=\"$<cm>=<-["]>+{$content=$<cm>.Str}\"/; dd $content;
camelia 「href="?!^a"」
cm => 「?!^a」
Str $content = "?!^a"
antoniogamiz $<cm> mmmm
timotimo you're not matching anything, your regex is looking for "" which isn't in the source, so the match fails
stands for "content match"
because i'm too lazy to type 09:43
antoniogamiz makes sense, thanks a lot :) 09:44
timotimo YW 09:51
09:51 Altai-man_ joined
timotimo m: my $string = '<a href="?!^a">b</a>'; $string ~~ /href\=\"$<cm>=<-["]>+\"/; dd $<cm>.Str; 09:52
camelia "?!^a"
timotimo if you don't actually need your $content variable to immediately contain the stuff, you can just use $<cm> after the match and drop the code block inside the regex 09:53
09:54 sena_kun left
antoniogamiz done :) 09:54
09:56 softmoth left 09:58 sno left 10:06 rindolf joined 10:18 yht joined 10:35 sno joined 10:41 patrickb joined 10:54 Black_Ribbon left
cpan-raku New module released to CPAN! HelloWorld (1.0.3) by 03PMQS 11:00
11:00 yht left 11:01 antoniogamiz left 11:08 robertle left 11:28 tejr left
cpan-raku New module released to CPAN! Raku-GitHub-Workflows (1.0.4) by 03PMQS 11:32
11:35 tejr joined 11:45 tejr left 11:47 bingos is now known as BinGOs 11:49 hungryd57 left, hungrydonkey joined 11:52 sena_kun joined 11:54 Altai-man_ left 11:58 skaji_ left 11:59 skaji_ joined 12:00 dyske joined, dyske left 12:01 dyske joined 12:03 dyske left, vrurg left 12:04 vrurg joined 12:09 vrurg left 12:12 vrurg joined 12:44 petr85 joined 12:48 petr85 left
rypervenche How long does modules.raku.org take to update once a new module is added to it? 12:54
lizmat rba ^^ ?? 12:58
rba modules.raku.org gets updated every 30 minutes. 13:02
tellable6 2020-06-24T12:09:10Z #raku <patrickb> rba There is a new rakubrew release: Version 12. Can you upload versions 10, 11 and 12 to the website? (rooster.uber.space/patcloud/index....JLQDZcjbf) 13:03
2020-07-09T08:48:38Z #raku-dev <patrickb> rba: Can you teach me how to deploy changes to rakubrew.org myself and upload releases? I'd really like to be able to do them myself...
patrickb rba: o/
rba patrickb: argh. I will do this ASAP and let you know...
patrickb v13 is bound to happen soon-ish. I'm still willing to learn how to do this myself. ;-) I have access to the webserver for the other sites, but rakubrew.org doesn't seem to live there... 13:05
Also the website itself has changes as well.
13:15 tejr joined 13:24 MasterDuke left 13:27 aindilis left, guifa2 left, _jrjsmrtn left, Xliff left, satori__ left, gordonfish left, fling left, Geth_ left, veesh left, raydiak left, leont_ left, maggotbrain777 left, finsternis left, nebuchadnezzar left, timlegge left, [ptc] left, Bucciarati left, KotH left 13:28 aindilis joined, guifa2 joined, _jrjsmrtn joined, Xliff joined, satori__ joined, gordonfish joined, fling joined, Geth_ joined, veesh joined, raydiak joined, leont_ joined, maggotbrain777 joined, finsternis joined, nebuchadnezzar joined, timlegge joined, [ptc] joined, Bucciarati joined, KotH joined, gordonfish left 13:38 tatata joined
tatata HeyI am trying to include a file 13:41
13:41 patrickb25 joined
tatata HeyI am trying to include a file following stackoverflow.com/questions/132626...-in-perl-6 . But it seems to be outdated, can someone help ? 13:41
13:43 patrickb left
guifa2 tatata: what is the error you are getting by using moritz's solution? 13:45
13:46 RaycatWhoDat left 13:49 sena_kun left, aluaces left
tatata guifa2 13:50
$ cat main.raku use v6;use lib '.'; # to search for Hello.pm6 in the current diruse Hello;hello;$ cat hello.raku module Hello;sub hello() is export { say 'hello';}$ perl6 main.raku ===SORRY!===Could not find Hello at line 3 in: /home/lesenr1/Work/ligo/src/stages/adt_generator /home/lesenr1/.perl6 /usr/lib/perl6/site
/usr/lib/perl6/vendor /usr/lib/perl6 CompUnit::Repository::AbsolutePath<93867113852400> CompUnit::Repository::NQP<93867090629376> CompUnit::Repository::Perl5<93867090629416>
ouch,
moritz tatata: if you name the module Hello, you must name the file `Hello.pm` or `Hello.rakumod` 13:51
tatata alright
Thanks a lot
moritz (case matters as well)
you're welcome 13:52
13:52 gordonfish joined 13:53 aluaces joined
cpan-raku New module released to CPAN! Set::Equality (0.0.2) by 03ELIZABETH 13:54
[Coke] rba: hi!
tatata Still does not find my module.. also, I had to write `unit module Foo;` instead of just `module Foo;` 13:59
Xliff \o 14:01
tatata moritz it seems like .pm works but not rakumod 14:04
codesections I have discovered an invalid regex that reproducibly causes Rakundo v2020.06 to hang in an infinite loop. As an example: 'any input' ~~ /[a*]*/ 14:05
moritz tatata: what version of rakudo are you using?
codesections: yes, that's well known
codesections ok, thanks, that's what I wanted to know
Saves me the time of opening an issue :) 14:06
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2020/07/13/2020-28-bridges-7/ 14:09
[Coke] was trying to duplicate the LibCurl issue reported on the mailing list. getting this error on zef:
moritz lizmat++
[Coke] $ zef uninstall LibCurl
Failed to get the directory contents of '/Volumes/BUKKIT/Users/coke/p6/share/perl6/site/short/D7B2661931C58BC571BED0D9CF7277DAAB35132A': Failed to open dir: Too many open files
will upddddddate everydaaaaaaaaaaaaaaaaaayy 14:12
14:12 andrzejku left
[Coke] ... 14:12
kb issues
lizmat MBP ?
[Coke] Yes. 14:13
lizmat been there, done that :-(
14:13 rindolf left, aluaces left, sena_kun joined
lizmat Apple is doing their utmost to ensure my next notebook will not be an Apple :-( 14:13
[Coke] mac mini 14:14
every few days the bt keyboard goes batshit crazy
14:18 rindolf joined
cpan-raku New module released to CPAN! App::Mi6 (1.0.0) by 03SKAJI 14:19
rba hi [Coke] 14:22
timotimo oh hey rba :)
rba hi timotimo
[Coke] rba: had some tickets on rakudo.org that I think you're the person for? 14:23
site not getting updated, missing updated info on infrastructure.
timotimo what if i threw my ssh public key your way, rba? :3
rba is feeling to get "attacked" from multiple sides ... :-) 14:24
sure
[Coke] sorry!
rba was to long not showing up in irc...
timotimo i kind of don't know how things are currently set up, and i think i don't have access to anything, or if i do i have already forgotten 14:25
rba [Coke]: You mean github.com/perl6/rakudo.org/issues...3534057860 ? 14:26
cpan-raku New module released to CPAN! WriteOnceHash (0.0.4) by 03ELIZABETH 14:27
14:27 sarna left
rba timotimo: you like to get access to lavm-perl6infra-1? 14:27
14:28 andrzejku joined
rba timotimo: What do you need? 14:28
[Coke] rba - yup, those. 14:29
(there are other tickets, but those are the two I tagged you on) if timo has access to poke at things, that will also be great. 14:31
I am happy to volunteer a key, but I won't be able to be a regular admin or anything.
timotimo 0i'm currently on my laptop and can't reach my desktop, but i can offer my laptop's key and use that to add my desktop's key later 14:33
cpan-raku New module released to CPAN! EERPG (0.0.1) by 03ELIZABETH 14:34
tadzik so, metacpan doesn't show these, modules.perl6.org doesn't show these, how I look them up except for github? :) 14:35
timotimo tadzik: m.r.o will show them, it just takes a moment or two to regenerate
tadzik heh 14:36
rba timotimo: I have copied the keys from the backup of p6c.org at installation. In case the key "timo@schmetterling" is still in your hands you can try to login using: ssh -p2222 akudo.org@lavm-perl6infra-1.atikon.io
14:36 dataangel left
tadzik I read that as "a month or two" 14:36
timotimo cool
14:36 dataangel joined
timotimo ah, yes, i am logged in 14:36
rba timotimo: Is this what you needed? 14:37
timotimo is that where all our websites are hosted now?
rba [Coke]: A small push updated the rakudo.org again: github.com/perl6/rakudo.org/issues/45 14:38
timotimo: Yes.
timotimo i see /home has folders for many perl6.org as well as raku.org folders
[Coke] rba++
rba timotimo: Most if the services I've duplicated at the rename. While the housekeeping didn't happen yet...
timotimo i wonder if i should get a "timo" unix user from which i could sudo to do server changes 14:39
rba timotimo: When you see through the home, which of those you like to get access to? 14:40
timotimo i guess everything that ends in .org 14:41
rba So far there is commands in the sudo for rakudo.org and docs.raku.org
14:42 xinming left
timotimo you mean stuff in the sudoers file? stuff those users can do without being asked for a password? 14:42
rba timotimo: Exactly. Mainly become the website user and restart nginx. 14:43
timotimo: And edit the nginx config file for the domain. 14:44
timotimo: Or do you like to get involved in admin completely? 14:45
14:45 tatata left
timotimo i think i could try at least :) 14:45
14:45 skids joined
rba timotimo: Username "timo"? 14:46
14:46 xinming joined
timotimo yes please 14:47
guifa2 lizmat++ 14:48
patrickb25 rba++ timotimo++
rba: rakubrew.org isn't hosted on lavm-perl6infra-1.atikon.io is it? 14:49
rba patrickb25: rakubrew.org is separted (and redundant :-))
patrickb25 That's what I remembered :-) 14:50
rba patrickb25: My open task is to give access from a "jumphost" to the rangeros runhosts. As soon this is done and documents you will get access to ti. 14:54
s/ti/it/
patrickb25 rba++ :-D
rba timotimo: please try to login with user timo. 14:55
timotimo i'm logged in, can i change my password? :)
rba timotimo: handle with care you got root rights using sudo...
timotimo only after i've obtained or changed my password :D
rba sure the timo user is yours.
timotimo well, passwd asks for the current password, which i don't think i haev 14:56
rba Will set and send you pvt
timotimo OK
i mean, putting it in a 600-modded file in my home directory is better than sending it over irc 14:57
rba timotimo: Sure. Yet you have to change it anyway... 14:58
timotimo well, yeah, but if someone knows my username and just reads a few lines up for the hostname, they could quickly jump in and steal the account 14:59
assuming they can get our privmsg
rba last + logs doen's show something unexpected. an attacker must have been very quick to hide his trace though. Yet you're right anyway... 15:01
timotimo: Be careful with changing nginx config and restart as nginx is serving all the sites... 15:02
timotimo: Whenever I have a time I like to continue my work to get websites ecapsulated in docker containers and run them on two hosts. Yet I will let you know before something is production ready... 15:04
rypervenche "nginx -t" first to make sure the config is safe to reload, and then a reload would probably be better than a restart. 15:05
rba rypervenche: agreed
timotimo good 15:13
are any of the dockered websites on this server? can it be used to put sites up for testing after they work locally?
15:27 patrickb25 left 15:31 squashable6 left 15:32 patrickb joined 15:33 squashable6 joined 15:36 softmoth joined 15:42 kensanata left 15:46 abraxxa left, abraxxa1 joined 15:48 softmoth_ joined 15:49 softmoth left, sena_kun left 15:51 abraxxa1 left, abraxxa joined 16:03 andrzejku left
rypervenche If I want to have a Class attribute be created from other attributes when I great the instance, what tool would I use for that? BUILD? Or not even? E.g., I have Str $.date and Str $.time attributes and would like to automatically combine them into a DateTime $.datetime . 16:13
I know I could do that combining outside of the Class, but I'm curious how to do it inside of it. 16:14
jnthn class Foo { has DateTime $.datetime; submethod TWEAK(Str :$date!, Str :$time!) { $!datetime = ...whatever logic here... } } 16:15
rypervenche Ahhhh, TWEAK, that's what it was. Thank you. I knew I had seen the solution before. 16:16
16:21 aluaces joined 16:35 sena_kun joined 16:40 molaf joined 16:42 dakkar left, xinming left 16:45 xinming joined 17:03 sftp joined 17:04 sftp left 17:07 sftp joined 17:10 cpan-raku left, softmoth_ left 17:11 cpan-raku joined, cpan-raku left, cpan-raku joined, softmoth joined 17:15 xinming left 17:16 xinming joined 17:31 Sgeo joined 17:35 defaultxr joined 17:41 xinming left, xinming joined 17:44 Manifest0 left 17:46 Manifest0 joined 17:53 sena_kun left 18:02 hungrydonkey left 18:06 andrzejku joined, sena_kun joined
xinming termbin.com/1hov <--- Is there roadmap for this bug to be fixed? :-) 18:21
I found it last year, then I got busy with other things, When I try to reread the doc, and find code snippets, and find this bug still exists. :-) 18:22
18:28 _jrjsmrtn left, Sgeo left, __jrjsmrtn__ joined
[Coke] xinming: that snippet doesn't show the results or the expected results 18:29
Do you know if a ticket was opened?
18:31 bocaneri left, Sgeo joined
[Coke] what's the bug? the missing , in the first @a definition means there are two elements there. 18:32
(is it that the two item list in the resulting @a has x and y, not y and z? 18:33
18:35 sena_kun left
cpan-raku New module released to CPAN! LibXML (0.5.6) by 03WARRINGD 18:35
vrurg weekly: vrurg.github.io/arfb-publication/0...ning-raku/ 18:36
notable6 vrurg, Noted! (weekly)
xinming [Coke]: It just needs to be clarified, that for @a, the second pair doesn't have comma, then, it'll parsed as 2 elements, 18:37
[Coke]: where the @b parsed correctly
[Coke]: IIRC, I asked to add an warning in this case. as when we are in a large array with structure like this, We'll have subtle bug which is a bit hard to track 18:38
guifa2 xinming: remember that any line that terminates in } "counts" as a bracket followed by a semi colon 18:47
m: @a = (1,2,3;4,5,6;7,8,9); @a.say
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@a' is not declared
at <tmp>:1
------> 3<BOL>7⏏5@a = (1,2,3;4,5,6;7,8,9); @a.say
guifa2 m: my @a = (1,2,3;4,5,6;7,8,9); @a.say
camelia [(1 2 3) (4 5 6) (7 8 9)]
guifa2 ah, you were talking not about a subtle bug in Raku, but in the program that leaves off the comma 18:48
nm
18:50 sena_kun joined 18:57 molaf left 19:01 softmoth left 19:04 sena_kun left 19:05 sena_kun joined 19:11 sena_kun left
xinming guifa2: Yes, No matter wether we consider it as a "bug", I think we need to give warnings about people for this. 19:17
abraxxa vrurg: great article! thanks! 19:20
I wonder if types like Int are also different in 6.c and 6.d scope and a comparison would return false? 19:26
like in the Grammar example
lizmat they are the same
Grammar is really one of the few that are currently different between versions 19:27
abraxxa but it could happen and introduce quite bad breakages?
lizmat PseudoStash is another one
19:28 MasterDuke joined
abraxxa lizmat: just reading the weekly, such things as the fix for order of files loading, do these fixes include added tests to Roast? 19:31
19:32 sena_kun joined
lizmat abraxxa: note the "tests needed" tag in github.com/rakudo/rakudo/issues/3783 19:32
:)
abraxxa I didn't mean this specific fix but more generally if the Roast test suite for 6.c and 6.d is extended in the -errata branches with tests for things found where obviously no test existed? 19:34
and as Raku can't parse and execute Perl 5 code, why are .pm files searched at all? 19:35
lizmat historically, .pm files were allowed and a "use v6" inside them, would make them Perl 6 modules 19:36
that's all leftover from the time where Perl 6 was to be the successor of Perl 5 19:37
abraxxa I would have broken with that when the rename happened 19:38
even pm6
lizmat we need pm6 as there are still quite a few modules out there with the .pm6 extension
abraxxa renaming files shouldn't be that hard 19:39
lizmat I guess, with a "use v6.e.PREVIEW" active, we could remove .pm as an option
abraxxa yeah
lizmat but we currently have no way to implement that, we need the newdisp branch to have landed for that
abraxxa is the loading code not in a setting? 19:40
lizmat yes, it is
well, most of it
it's called from World.nqp
abraxxa which should be renamed to World.nqr :)
ShimmerFairy The extensions from the era of "We're gonna replace Perl 5, right guys?!" I feel can be dropped by this point (using them instead of .pm6 etc. was uncool for years before the Raku rename), but the Perl 6-esque extensions are gonna have to be supported for a long time yet. 19:43
raydiak wonders if App::Pray should be renamed...to...Rray? 19:47
lizmat abraxxa: we've been over this: there will be no rename of NQP or the .nqp extension 19:48
we'll just de-emphasize it being an acronym
ShimmerFairy NQP, after all, is still not quite Perl :)
19:52 abraxxa left 19:53 abraxxa joined
abraxxa twitter.com/cpan_author/status/128...2437941248 19:53
can someone with a twitter account give him a better answer please?
I've asked the same thing in the past an remember that there is a way to say: set it to its default value 19:54
using a Type requires to know the type of the variable or attribute and if it changes replace it everywhere
Geth_ ¦ problem-solving: lizmat assigned to rba Issue pl6anet.org is a name that does not reflect Raku github.com/Raku/problem-solving/issues/212 19:55
lizmat abraxxa : doesn't jnthn's answer cover it ? 19:59
ShimmerFairy: indeed :-)
20:00 ShimmerFairy left
abraxxa lizmat: why can it be used with the automatically generated accessor method but not the manuelly written by him? Because of the method type definition? 20:00
lizmat yup, if the method had been written as: method x() is raw { $!x }, it would have worked 20:02
because that's what the autp-generated accessor really is
abraxxa i see, thanks!
so Nil was the thing you need to assign to reset the var to its default value?
lizmat if the attribute does not have "is rw", then the accessor is defined without the "is raw" 20:03
yes
m: my $a is default(42) = 666; say $a; $a = Nil; say $a
camelia 666
42
20:09 andrzejku left
defaultxr hello. dumb noob question: i'm used to late-binding languages that allow me to do stuff like $*SCHEDULER.cue({ &thing(); }, every => 1); and then redefine &thing and have the new definition called the next time the schedule runs that cancellation. however, simply redefining &thing doesn't seem to work in Raku; the scheduler just continues calling the function as it was defined when i cued the 20:09
cancellation. what would be the best way of doing this in Raku?
20:09 molaf joined
lizmat when you pass &thing, it is pass by value 20:10
so changing &thing afterwards, won't help 20:11
however, what you *could* do is make &thing a wrapper that looks at an atomicint lexical variable
and decides which actual code to actually call 20:12
or if you want to get fully flexible, have &thing look at a outer lexical which you can change with cas() to be some other code to execute
20:12 ShimmerFairy joined
lizmat defaultxr: hope that made sense? 20:13
defaultxr i'm still extremely new to Raku so i'm not familiar with the things you mentioned, but i think they will point me in the right direction :) i'll check the docs for them and see what i come up with, thanks! 20:14
Xliff defaultxr: Do you know the things that &thing can be set to at compile time? 20:15
rypervenche Where would I look in the docs to see what "::CLASS:U:" means? (I understand the U/D bit, but not sure about the :: syntax around it) 20:16
defaultxr Xliff, nope. i want to be able to change &thing to anything at any time
Xliff m: my $f; sub a { say 'a'; }; sub b { say 'b'; }; my $f = &a; $*SCHEDULER.cue({ $f() }, every => 1); Promise.in(5).then({ exit }); Promise.in(2).then({ $f = &b }) 20:20
camelia Potential difficulties:
Redeclaration of symbol '$f'.
at <tmp>:1
------> 3 { say 'a'; }; sub b { say 'b'; }; my $f7⏏5 = &a; $*SCHEDULER.cue({ $f() }, every =
a
Xliff m: my $f; sub a { say 'a'; }; sub b { say 'b'; }; $f = &a; $*SCHEDULER.cue({ $f() }, every => 1); Promise.in(5).then({ exit }); Promise.in(2).then({ $f = &b })
camelia a
Xliff m: my $f; sub a { say 'a'; }; sub b { say 'b'; }; $f = &a; $*SCHEDULER.cue({ $f() }, every => 1); Promise.in(5).then({ exit }); Promise.in(2).then({ $f = &b }); sleep 6;
camelia a
a
a
b
b
b
Xliff ^^^
defaultxr rad, that is indeed what i'm looking for! 😎 thanks Xliff! 20:22
Xliff yw
lizmat Xliff: of course, that is not threadsafe 20:24
that's why I mentioned either using cas() or an atomicint to indicate what you really want to execute
20:24 kensanata joined
defaultxr lizmat, do you mean even just evaluating $f = &a; while the cancellation is running is not safe? or do you mean like if i were to do anything more crazy with threads, i.e. changing $f from multiple different threads? 20:29
for now i'm just doing the former
20:29 _jrjsmrtn joined 20:30 sena_kun left
defaultxr i.e. i'm just doing $f = &a by entering it in the repl, not from any code running elsewhere 20:30
lizmat the chance is minimal, but yeah: if the cued code would read the scalar half-way the assignment, there's no telling what could happen
20:31 __jrjsmrtn__ left
lizmat now, in practice, for testing and such, it's ok to do it like that 20:31
and possibly for production in *that* particular case (assigning to a scalar) safe enough to give you an outdated value
but anything more complex like that, e.g. pushing or popping from an array, would not be advisable 20:32
defaultxr ah, ok, gotcha. yeah i'm just playing around right now, but i'll keep that in mind when start to do anything more serious :) thanks again to both of you 20:33
lizmat defaultxr: what decides to change the code to be executed?
maybe you're better off with a react { whenever { } } structure
the whenever will guarantee you there will only be *one* thread running that code at any time
defaultxr the user decides (i.e. just me right now). i'm basically just playing around with the idea of doing some live coding music type stuff in raku, and i want to have a function that is constantly running, i.e. to generate a rhythm, but can be modified without needing to manually stop and restart the cancellation 20:35
if that makes sense
i'll look into react and whatever too 20:36
Xliff lizmat: Hence my first answer. Since he said he didn't know what he wanted to run, I figured I'd give him an answer.
lizmat Xliff++ 20:39
Xliff defaultxr: If you know all of the potential subroutines for $f at compile time, then you could do something like this:
m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; $f = &a; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); default { c(); }; }; }, every => 1); 20:40
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3}; when 1 { b(); default { c(); }; }; }7⏏5, every => 1);
Xliff m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; $f = &a; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); default { c(); }; }; }, every => 1);
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3 }; when 1 { b(); default { c(); }; }; }7⏏5, every => 1);
Xliff m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; $f = &a; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); default { c(); }; }; }; }, every => 1); 20:41
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
c used at line 1
Xliff m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; sub c { say 'wtf?'; }; $f = &a; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); default { c(); }; }; }; }, every => 1);
camelia This type cannot unbox to a native integer: P6opaque, Sub
in block <unit> at <tmp> line 1
[Coke] you can't set an atomic int to a sub. 20:42
Xliff m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; sub c { say 'wtf?'; }; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); default { c(); }; }; }; }, every => 1);
camelia ( no output )
[Coke] ... there you go
Xliff m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; sub c { say 'wtf?'; }; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); default { c(); }; }; }; }, every => 1); sleep 2; $f = 1; sleep 2; $f = 'a'; sleep 2
camelia a
This type cannot unbox to a native integer: P6opaque, Str
in block <unit> at <tmp> line 1

a
b
wtf?
b
wtf?
b
wtf?
Xliff m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; sub c { say 'wtf?'; }; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); default { c(); }; }; }; }, every => 1); sleep 2; $f = 1; sleep 2; $f = 42; sleep 2 20:43
camelia a
a
a
b
wtf?
Xliff ^^ threadsafe
But you have to be able to at least know all the potential outcomes for f. Although with that setup, you can keep adding on until you are satisfied. 20:44
[Coke] Xliff++
Xliff m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; sub c { say 'wtf?'; }; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); }; default { c(); }; }; }, every => 1); sleep 2; $f = 1; sleep 2; $f = 42; sleep 2 20:45
camelia a
a
a
b
wtf?
wtf?
Xliff m: my atomicint $f = 0; sub a { say 'a'; }; sub b { say 'b'; }; sub c { say 'wtf?'; }; $*SCHEDULER.cue({ given $f { when 0 { a(); }; when 1 { b(); }; default { c(); }; }; }, every => 1); sleep 2; $f = 1; sleep 3; $f = 42; sleep 2 20:46
guifa2 defaultxr: It looks like no one answered your ::?CLASS question. That's a compile-time variable, see: docs.raku.org/language/variables#i...::%3FCLASS
camelia a
a
a
b
b
wtf?
wtf?
defaultxr guifa2, i think you mean rypervenche 20:47
guifa2 err yup
rypervenche: ^^
rypervenche Hmm. Why is it ::CLASS:U: in this case instead of ::?CLASS:U: and why the extra : at the end? 20:48
20:48 cpage_ joined
defaultxr and thanks Xliff, though i won't know all of the potential outcomes in advance since what i'm trying to do involves improvisation/trial and error in real time 20:48
20:49 sena_kun joined
[Coke] in a signature, trailing : indicates the "self" 20:49
in a *method* signature, I mean
rypervenche For example, FCO has it in his code here: github.com/FCO/Red/blob/master/doc...lationship
20:52 cpage left, cpage_ is now known as cpage
[Coke] so, the method as defined must be called on an undefined object 20:54
(in java, that'd be a static method, e.g.)
and the ::CLASS:D: is an instsance method. 20:55
guifa2 oh 20:56
duh
yuplushi is there a currated list of "best perl6/raku" youtube talks?
guifa2 rypervenche: ::CLASS is actually a type capture
It's just the most common is ::T
20:57 lostmywindows joined
lizmat yuplushi: no, there isn't to my knowledge 20:57
but a few months ago, someone made quite a few ones
[Coke] guifa2: ah, good call, yes. 20:58
rypervenche guifa2: Hmm, ok thanks. I'll have to do some reading to wrap my mind around type captures.
yuplushi maybe i should make a list, even filtering out the p5 talks would make it easier to browse them 20:59
guifa2 rypervenche: basically, type capture says "I don't know what type I'm going to get, but whatever I get, I need to use it again elsewhere"
yuplushi: tbh, if .author eqv $jnthn | $lizmat, it'll be awesome, but those don't tend to be intro video types (if that's what you're looking for). A curated list in a wiki or doc page would actually be pretty cool esp with a quick summary
[Coke] (given that it's in a method definition, when invoked it'll have to be something of that type or a subtype) 21:00
guifa2 rypervenche: so imagine I want a function to do something to two variables, but I want to make sure they're the same type (eg Int and Int, or Str and Str)
you could do a giant list of multis, but those aren't very extendable.
[Coke] er, -in the definition *and* it's the self: parameter)
guifa2 You could do sub foo ($a, $b where $b.WHAT == $a.WHAT) { … } 21:01
but the cleanest way is sub foo (::TYPE $a, TYPE $b) { … }
TYPE gets set to whatever $a's type is, and then becomes a constraint on $b
rypervenche Ahhhh. 21:02
lizmat yuplushi : maybe www.youtube.com/channel/UCDkz-__gl...LexukpG0DA is a good start
guifa2 in the method then, you could also say my TYPE $c := $a, for instance
21:02 kensanata left
lostmywindows not sure if ontopic but will raku/perl6 be available in zeal or other convenient format? 21:03
21:04 sena_kun left
guifa2 rypervenche: my guess though is that MasterDuke actually meant to say ::?CLASS in that case though :-) 21:04
21:05 rindolf left
lizmat lostmywindows: I suggest you make an issue in the doc repo 21:05
rypervenche SmokeMachine rather. :P
guifa2 is still waking up :-) 21:07
yuplushi lizmat, thanks haven't seen those before
lostmywindows thanx lizmat 21:10
21:19 sena_kun joined
leont_ rypervenche: your ticket on YAMLish wasn't quite clear to me 21:28
21:31 patrickz joined
SmokeMachine I’ve done that wrong!!! I’ll fix that... it should be ::?CLASS:U: 21:31
21:32 hungrydonkey joined
rypervenche leont_: Take a look at yaml.readthedocs.io/en/latest/example.html and search for "If a block sequence or block mapping is the element of a sequence" 21:39
I'd never even seen the non-compact version until I used YAMLish. Then I read the spec and learned about the compact and non-compact versions. 21:40
SmokeMachine Fixed 21:42
leont_ It's YAML, there are several ways to do everything 21:45
I mean, there are like 5 syntaxes for strings
21:47 Sgeo left 21:49 skids left, Sgeo joined 21:50 skids joined
raku-bridge <勉人> how do i assign a unicode compatibility character in raku? > $a = 0xF97E.chr 量 > $a.ord.base(16) 91CF 😕🤔⁉️ 22:03
ShimmerFairy Looks like you want to pipe it through NFKD or NFKC normalization 22:07
m: say 0xF97E.chr.NFKC.Str.ord.base(16)
camelia 91CF
jnthn Str means NFG which implies NFC
raku-bridge <勉人> m: say 0xF97E.chr.NFKD.Str.ord.base(16) 22:08
evalable6 91CF
ShimmerFairy yeah, the .NFKC (or NFKD) converts the string to a new type of object, which is why the .Str is there to immediately turn it back into a regular everyday Str. 22:09
22:09 Sgeo left
raku-bridge <勉人> it still doesnt work 22:09
jnthn Yes, but Uni => Str coercion means "normalize me"
22:10 Sgeo joined
jnthn You'd have to leave it as a Uni (which of course has a bunch of limitations at the moment) 22:11
ShimmerFairy Yeah, dropping the .Str lets you keep the string in its newly-normalized form.
raku-bridge <勉人> > 0xF97E.chr.NFKD NFKD:0x<91cf> > 0xF97E.chr.NFKC NFKC:0x<91cf> 22:12
<勉人> doesnt seem to work
jnthn You can't go via .chr because .chr makes a Str which is normalized 22:14
m: say Uni.new(0xF97E).NFKD
camelia NFKD:0x<91cf>
jnthn huh, what's that doing... 22:15
raku-bridge <勉人> m:say Uni.new(0xF97E)
evalable6 Uni:0x<f97e>
raku-bridge <勉人> how do i compare this to a string? 22:16
jnthn It's been years since I read the spec of what NFKD and NFKC are meant to do, though
22:18 patrickb left
jnthn Well, eq, but again, if you have a Str on the other side then it will have been normalized too 22:19
raku-bridge <勉人> womp
22:19 patrickz left
jnthn (Before you even get to doing the comparison) 22:19
guifa2 . o O ( Str does what's best and logicla 99.9% of the time. That other .1% though… ) 22:20
jnthn Well yes, that's why there's Uni too, for the .1%, though it turns out so few people need this that it's received little implementation attention.
raku-bridge <勉人> it makes sense. most of the time ud want 量 to match with 量 22:21
guifa2 jnthn: not sure if you saw it, but we finally solved an XML parse bug this week that I reported a year+ ago and it revolved around that .1% 22:23
raku-bridge <勉人> i started learning raku 2 weeks ago 🙃 22:24
<勉人> the grammars convinced me to change ships
guifa2 XML content that begin with a combining mark bomb it, because the grammar looking for > won't match in, e.g, >́ . 22:25
22:25 xinming left
guifa2 勉人: the grammars are so much fun to work with 22:25