»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
geekosaur wonders at what pont this becomes "so if what works better for everyone else doesn't work for you, you may have to wait until someone comes up with a version of the docs that works for you" 00:20
timotimo i do have to agree that some examples are pretty bad :) 00:21
geekosaur neverteless. he's repatedly asserted tat perldocis the only corect way to doit 00:22
timotimo i didn't interpret it as "perldoc is the only correct way" 00:23
just that perldoc is more useful because it's less "academically" written i suppose?
[Coke] one note about the perldoc stuff; I don't liek the thought of adding the p5 style func THING, OTHERTHING because I really don't see how that improves over the literal signature. 00:31
[Coke] which I argued with dha about back in the day, I think. I absolutely agree that having a page on "how the docs work" would be a great thing, though, explaining common signature elements, among other things. 00:32
Xliff Is ::?METHOD the proper way to get the name of the current method? 02:14
Looks like &?ROUTINE.name works 02:18
Geth doc: d9a3ec23d8 | (Elizabeth Mattijsen)++ | doc/Language/pragmas.pod6
Document use isms / use isms <C++>
08:34
synopsebot Link: doc.perl6.org/language/pragmas
Geth doc: df4f027a6b | (JJ Merelo)++ | 2 files
Eliminates uneeded asides in the explanation of contains.

This, please, closes #2303.
Also some reflow and adds some examples to the basic Cool version of `contains`.
10:34
ZzZombo I've been watching the "no isms" commits today, and while they are on the right track, I don't agree with those silly restrictions where valid AND harmless syntax is forbidden out of fear that somebody somewhere manages to shoot himself or something. 11:41
The `new Foo` thing specifically is so stupid, I don't even. I'd actually expect there to be a `sub` version of the `new` method to do `Foo.new`, in line in all others sub versions of methods. 11:43
timotimo i disagree. "new" is only a convention in perl6 11:46
ZzZombo But then again, restricting that lies in line with forcing a specific way of working with class (composition over inheritance, private-public only access levels, etc), in contrary with the supposed freedom of choosing your way of things, i. e. typed vs untyped variables. 11:48
Disagree with what? `new Foo` is a valid syntax? 11:49
It may be just a convention, but doesn't justify forbidding it as a whole.
timotimo you can already write "new Foo:" 11:50
no need for a sub
and this syntax works with every method, rather than just with "new"
pmurias_ timotimo: why do we need a hard ban on new Foo instead of just having a custom error message if a &new sub is not is scop 11:55
* scope
lizmat pmurias: the answer to that question is hidden in the mist of time 11:59
El_Che so poetic? 12:02
"new Foo" was hard to parse correctly I thought 12:03
pmurias I can imagine just banning a "new Foo" without checking if it might work was easier 12:10
Zoffix ZzZombo: there's a ticket you can comment on regarding these silly restrictions: github.com/rakudo/rakudo/issues/1356 12:18
Geth ecosystem: pheix++ created pull request #410:
Add Router::Right to ecosystem
12:28
timotimo pmurias: i'd prefer just a custom error, too. 12:30
Geth ecosystem: 5b2c9bb62b | (Konstantin Narkhov)++ | META.list
Add Router::Right to ecosystem

See gitlab.com/pheix/router-right-perl6
  🦋🦋🦋
12:39
ecosystem: a246560228 | Altai-man++ (committed using GitHub Web editor) | META.list
Merge pull request #410 from pheix/master

Add Router::Right to ecosystem
El_Che Zoffix: interesting discussion about the errors 12:41
AlexDaniel well, I specifically made that ticket to cover a very narrow scope (variables only) 13:30
but people want to discuss the whole thing so much :)
AlexDaniel also, many 5to6 and 4to6 error messages for variables are now gone 13:31
since May
mscha m: for ^3 { for ^3 { once { say 'foo' } } }
camelia foo
foo
foo
AlexDaniel mscha: that's correct 13:32
mscha “A block prefix with once will be executed exactly once, even if placed inside a loop or a recursive routine.”
AlexDaniel huh… now that's wrong
I mean, the description
mscha: a proper-er description is here: docs.perl6.org/language/traps#Usin...once_block
mscha I figured. Either the doc or the functionality must be wrong. ;-) 13:33
AlexDaniel and then the doc goes to say “This works per "clone" of the containing code object, so:” 13:34
mscha But in my example there aren't any clones of code objects, no? 13:36
AlexDaniel but are there any “clones” :P 13:37
IMO `once` is pretty confusing, and having no clear description in the docs is not cool 13:38
that traps section is actually alright, but too long 13:39
lizmat "once" has changed its name already a few times
FWIW, I believe it follows the same logic as state variables wrt scoping 13:40
AlexDaniel yes
lizmat: what were its names?
lizmat as it internally uses a state variable to keep state :-)
I guess a bisect on "once 42" should tell you when it changed 13:41
AlexDaniel bisect: old=2014.01 once say 42 13:42
bisectable6 AlexDaniel, On both starting points (old=2014.01 new=5a9105a) the exit code is 0 and the output is identical as well
AlexDaniel, Output on both points: «42␤»
AlexDaniel lizmat: 2014.01 is the first rakudo on moar, unfortunately :)
pretty sure there's a ticket somewhere asking to add parrot builds to whateverable 13:43
but IIRC even 2014.01 is not buildable with the latest perl5… and the only reason I have those is because at the time the server had a slightly older version 13:45
mscha m: sub foo { once say 'a'; for ^3 { once say 'b' }; once say 'c'; }; foo for ^3; # confusing 13:46
camelia a
b
c
b
b
scimon So a while ago (just before LPW 2017) I wrote a script that would spider through a directory and look in each file within it for matching strings. (Recursively grepping). At the time it was slower than just running find and egrep. Ran it today in my company dojo where we were discussing Channels and Supplies and it's now faster on my laptop than the find / grep method. 13:48
I should probably blog that.
AlexDaniel BLOG IT!!!
:)
scimon: are you sure that it's correct though? 13:49
because I'm really surprised
mscha: so b is once per sub and a/b are once per mainline I guess? 13:51
a/c** 13:52
timotimo "once" has the same semantics as "state", i believe
so when a block gets a closure taken, it'll get its own state, and when the closure gets invoked multiple times it'll have the same state
so when you enter foo, the inner loop gets its closure taken and executed three times 13:53
and when the mainline is entered, the "once say 'a'" gets its closure taken
so that gets executed once in total
scimon So the script fires up 5 promises one does spidering passing IO objects into a channel.
timotimo scimon: it may not be easy, but can you find out if it's actually giving the same results and performing about the same work? 13:54
scimon So I've got a folder with 100 subfolders. Each has 100 files. Each has 500 lines each is a 100 character random string. 13:55
AlexDaniel also, ssd or hdd? First run or not?
scimon ssd 13:56
Not first run/
I have a script called lof which has this in it "find . -type f -exec egrep "$1" {} /dev/null \;"
timotimo why wouldn't you use the recursive flag for egrep? 13:57
oh, $1?
scimon On my box that's taking 8 seconds. real0m7.366s, user0m4.287s, sys0m2.497s
timotimo so it'd search for the file name inside the file?
scimon So I can do lof 1234567890
timotimo ah, no, $1 is what you pass to lof
scimon (Turns out 1 of my random strings has that in it)
The perl6 version times : real0m2.486s, user0m7.252s, sys0m0.370s 13:58
timotimo 4 cores? 13:59
AlexDaniel so 3x as fast…
scimon 4 cores and 4 promises doing the grepping.
1 promise spiders through the folder and feeds into a channel then closes it and stops.
I was a bit shocked when it worked out faster. 14:00
AlexDaniel well… I still don't believe it :D
timotimo it doesn't have to exec processes over and over
scimon (It was a bit slower when I was demoing it but I was doing a hangout stream) 14:01
timotimo you can see that the egrep version has 2.5 seconds of system time
i.e. time spent doing system calls and such
AlexDaniel then, what about using xargs to batch files?
and maybe parallelize as well
timotimo so the execing and folder reading and all that is taking as long as the perl6 version takes in total (when on 4 cores) 14:02
scimon These' might be cool and if people can tell me how. lof is something I made ages ago and use a lot because I know it.
scimon Ok so using grep -drecurse gives these times : real0m2.183s, user0m0.591s, sys0m0.292s 14:04
timotimo that's not that much faster than perl6, though of course it only uses one core 14:04
scimon Still that's not a bad comparison.
timotimo but grep can use regex and you're probably using .contains? ;) 14:05
scimon I am. Oh boy am I.
But I think it's still pretty good. And the code to write it is pretty simple. 14:06
AlexDaniel scimon: find . -type f -print0 | xargs -0 -n5 echo
AlexDaniel scimon: something like that. It echo's 5 files per run 14:06
scimon: and then also add -P4 14:07
AlexDaniel so that it does at least 4 processes at a time 14:07
perhaps you can increase it to 5 to improve the result a bit more
scimon Yeah. That's faster.
real0m0.807s user0m0.970s sys0m0.409s 14:08
AlexDaniel ok that makes more sense
so now in parallel?
timotimo huh, how come the user + sys isn't that much more than real?
scimon I have no idea. I'm just writing numbers. 14:09
Anyway. I'm pretty sure it's a lot faster than this time last year :)
timotimo :)
AlexDaniel by the way I love xargs
timotimo gnu parallel is also nice 14:10
AlexDaniel the name doesn't sound like it can solve problems like this, but it works so well
scimon Also it's a good framework for more extendable stuff.
ofperfection Hey guys, I have a question on regexs that I wasn't able to find in the docs, which typically implies that I'm doing something completely wrong 15:50
ofperfection specifically, I'm wondering if you can implement a range in a regex pattern 15:50
i.e.: my $regex-name = /{1..@arr.elems}/ 15:51
timotimo what exactly do you want the range to match?
m: my $rex = /^ <{ 9..30 }> $/; say "5" ~~ $rex; say "19" ~~ $rex; 15:52
camelia Nil
「19」
ofperfection I have a simple to do list application
timotimo interpolating an array (or positional things in general, which ranges also are) will act like a longest-token-matching alternation (single vertical bar, |) of the individual array elements 15:53
ofperfection I'm going to google the things you just said 15:53
ofperfection pastebin.com/546ABFb7 15:55
basically as written
I'm just trying to match the '1' in the "1 modify" string
I realize I'm not doing the regexs correctly 15:56
I think what you said answers it
I appreciate the help
timotimo no problem :) 15:57
sena_kun ofperfection, I think what you want can be done without regexes. You want to 1)in this exact case("1 modify") just split the string by space(s); 2)get first piece and convert it to integer. But regexes can help you validate input that user gives you. 15:58
so it's like
m:say "1 modify" ~~ /\d+ ' ' \w+/ 15:59
evalable6 「1 modify」
sena_kun m: say "bad input modify" ~~ /\d+ ' ' \w+/
camelia Nil
sena_kun and then
m: say "1 modify".split(' ').first.Int
camelia 1
sena_kun m: say "1 modify".split(' ')[0].Int # if you want
camelia 1
timotimo i tend to recommend .words over .split(" ") 16:00
sena_kun timotimo++
that's nice too.
also, maybe...
m: say "1 modify" ~~ /\d+ ' ' ['modify'|'add']/ 16:01
camelia 「1 modify」
ofperfection My aim was to validate the item number selection with the dynamic regex range, which I could also do after by checking the respective .Int that you recommended I suppose
I really appreciate you guys helping me out 16:02
I'm bouncing around between a couple perl6 books
and I'm not always able to find examples of what I'm doing wrong exactly
timotimo no problem :) 16:03
El_Che ofperfection: considere #perl6 an enhanced REPL 16:04
Geth doc: 5f6c115baa | (JJ Merelo)++ | doc/Type/Lock.pod6
Adds to the explanation of lock/unlock

Copying verbatim @jnthn words. Closes #1626.
17:49
synopsebot Link: doc.perl6.org/type/Lock
Geth doc: 64a0082ec7 | (Will "Coke" Coleda)++ | doc/Type/Lock.pod6
remove extraneous comma
17:58
synopsebot Link: doc.perl6.org/type/Lock
lizmat weekly: opensource.com/article/18/9/signatures-perl-6 18:17
notable6 lizmat, Noted!
robertle I got some weird stuff with a concurrent I/O benchmark: it sometimes works, sometimes moarvm segfaults, sometimes I get unhandled exceptions from within rakudo core code (threadpoolscheduler,lock,atomicops). not sure whether to report against moar, rakudo, or both, or neither 18:53
timotimo are you sure you're using objects safely? 18:54
i.e. not causing hashes or arrays to resize from one thread while another is trying to use it
robertle no, not sure. let me look at it again
AlexDaniel robertle: sorry, what's the situation with 2018.08 in debian? You're skipping it completely because of github.com/MoarVM/MoarVM/issues/951 or is there something else going on? 18:57
robertle AlexDaniel: I was mostly thinking about 951, yes. but then again that bug isn't going to solve itself, so perhaps giving a spin in the debian porter box might shed some extra light on it 18:58
but I am also totally short on time :)
AlexDaniel that's what I was hoping for, yes :)
robertle do we have anything on that bug yet?
timotimo: I do not think that I resize anything from different threads, but I guess that could easily be overlooked. I don't have much shared state between these threads though... 19:00
AlexDaniel it was fine on 2018.06 and it's not ok on 2018.08, and according to the ticket you can get good/bad state by just trying to build rakudo 19:01
so that makes it bisectable, but very often that's not very helpful
robertle timotimo: I also get the same behavior if I do RAKUDO_MAX_THREADS=1, which takes most of the code out of the running-concurrently game (I think)
AlexDaniel robertle: can we see your code? 19:02
robertle AlexDaniel: also bisecting rakudo builds on armhf is a tedious game :)
timotimo can i get the code? :) 19:03
robertle AlexDaniel: sure! it's not very nice though. backtraces and so on in gist.github.com/robertlemmen/5691c...85f463c986 code is at github.com/robertlemmen/p6bench/bl...03-backend
AlexDaniel robertle: why is it? I understand it can be slow, but if you can build rakudo once then surely you can do it 9 extra times, no? 19:04
robertle AlexDaniel: totally! it's just less fun to do than on say s390x :)
timotimo so much code :S 19:04
robertle hey it's pretty much most of http client and server impl... 19:05
AlexDaniel that's not much, especially given that it uses almost no modules 19:06
timotimo OK, OK :)
robertle the aim is to have it not use any modules 19:07
timotimo using IO::Socket::Async will give you at least the event loop thread, but also the thread pool scheduler to handle tasks
check RAKUDO_SCHEDULER_DEBUG=yes or something like that
robertle right, I get the problem even with RAKUDO_MAX_THREADS=1 so I was guessing it would not be between "my" main threads. I/O thread vs mine could happen of course, but I guess the libuv thread never modifies any structures I can see/use? 19:09
there is also a section with explicit threads towards the bottom (the clients), but they have even less shared state 19:10
timotimo it still uses worker threads to handle stuff from the libuv event loop thread 19:11
i see your Client is using tap instead of act
robertle I thought these worker trheads would be what is limited by RAKUDO_MAX_THREADS, am I wrong there? 19:12
timotimo i believe it'll add more if it detects that things are deadlocked
as i said, RAKUDO_SCHEDULER_DEBUG
that ought to give clarity
robertle not much: first run I get "Created initial general worker thread" then one "Added a general worker thread", then my segfault 19:16
second run I get two "Added a general worker thread" and then the unhandled rakudo core exception
timotimo OK
robertle when I run with that and RAKUDO_MAX_THREADS I never get the "added", but still the bug 19:17
timotimo gdb is telling me it's creating craptonnes of threads actually
robertle I believe these are not the worker threads, but the ones towards the bottom of teh code, created by Thread.start explicitly
timotimo oh, obviously 19:18
you're right
robertle but I do not see where they share anything
I want to replace them with tasks on the thread pool as well at some point 19:19
timotimo i'm still distracted doing tpf grant work, so not looking closely enough to help terribly much
robertle tpf grant for the win! 19:20
timotimo :) 19:21
robertle but if I convince myself that I am not sharing structures between my threads, what would be the next thing to look at? 19:24
AlexDaniel maybe you can try golfing it 19:32
robertle I was worried you would say that...
masak .oO( don't worry - be golfy ) 19:41
AlexDaniel robertle: it doesn't have to be problematic, perhaps try replacing some parts with static input 19:42
or, if it's client/server, maybe separating these into two files?
timotimo that's not a bad idea at all 19:43
then the crash is contained to one or the otheŕ
robertle that is a fab idea, I can easily separate them by client/server 19:45
AlexDaniel timotimo: a pessimist in me says that it will stop segfaulting 19:46
timotimo ehhh 19:48
lex_ I am not sure why the *% ',' captures the number with decemal between. I think this is the look back issue and I think i need some kind of word bound. I tried them and they failed. say "4,294,967,295.00 4,294,967 123.334.523 :: " ~~ m:global/ [\d+]*% ',' / ; 19:58
AlexDaniel m: say "4,294,967,295.00 4,294,967 123.334.523 :: " ~~ m:global/ [\d+]*% ',' / ; 20:00
camelia (「4,294,967,295」 「」 「00」 「」 「4,294,967」 「」 「123」 「」 「334」 「」 「523」 「」 「」 「」 「」 「」)
AlexDaniel m: say "4,294,967,295.00 4,294,967 123.334.523 :: " ~~ m:global/ [\d+]+% ',' / ; 20:00
camelia (「4,294,967,295」 「00」 「4,294,967」 「123」 「334」 「523」)
AlexDaniel lex_: is this expected output? ↑ If not, what would be the right one? 20:01
lex_ My expected output is 4,294,967,295 and 4,294,967. 20:02
TimToady maybe you want +% instead 20:04
TimToady wait, that won't work either 20:04
AlexDaniel m: say "4,294,967,295.00 4,294,967 123.334.523 :: " ~~ m:global/ [\d+]+% "," )> ["."\d+]? / ;
camelia (「4,294,967,295」 「4,294,967」 「123」 「523」)
AlexDaniel m: say "4,294,967,295.00 4,294,967 123.334.523 :: " ~~ m:global/ [\d+] % "," )> ["."\d+]? / ;
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %
at <tmp>:1
------> 0367 123.334.523 :: " ~~ m:global/ [\d+] %7⏏5 "," )> ["."\d+]? / ;
TimToady m: say "4,294,967,295.00 4,294,967 123.334.523 :: " ~~ m:global/ [\d+] ** 2..* % "," )> ["."\d+]? / ;
camelia (「4,294,967,295」 「4,294,967」)
TimToady to require at least one comma, if that's the intent
lex_ TimToady : This 2..* means at least two numbers one on each side of a comma such as 4,2. 20:16
lindylex TimToady this I tried this and it seems to work. say "4,294,967,295.00 4,294,967 123.334.523 4,2 :: " ~~ m:global/ [\d+] ** 2..* % "," / ; 20:21
lindylex TimTaody : why this part )> ["."\d+]? 20:21
AlexDaniel lindylex: oh that was mine, ignore it 20:22
lindylex Thanks AlexDaniel 20:23
AlexDaniel although, now I see that it is in TimToady's solution as well, hmm
m: say "4,294,967,295.00 4,294,967 123.334.523 :: " ~~ m:global/ [\d+] ** 2..* % "," / 20:24
camelia (「4,294,967,295」 「4,294,967」)
AlexDaniel I guess you don't need it, yeah
lindylex AlexDaniel : correct this works say "Letters here 4,294,967,295.00 4,294,967 123.334.523 4,2 Words around :: " ~~ m:global/ [\d+] ** 2..* % "," / ; 20:27
vrurg Does anybody know if DBIish Oracle driver is thread-safe? 20:28
AlexDaniel lindylex: does it have to be a regex?
lindylex I am noticing that lots of Perl6 book and online resources are giving bad information on regex. This is infuriating.
timotimo vrurg: i don't think any of the DBIish drivers are thread safe
it's probably the exact same as the C library underneath
i'd expect you'll have to have multiple handles so you'll only use each from at most one thread 20:29
lindylex AlexDaniel : I am attempting to gain proficiency in regex. This is why I am studying the topic.
vrurg timotimo: I saw DBI::Async in the modules. It claims to support postgress only though.
AlexDaniel m: "4,294,967,295.00 4,294,967 123.334.523 :: ".words
camelia ( no output )
AlexDaniel m: say "4,294,967,295.00 4,294,967 123.334.523 :: ".words
camelia (4,294,967,295.00 4,294,967 123.334.523 ::)
AlexDaniel m: say "4,294,967,295.00 4,294,967 123.334.523 :: ".words.grep(/[\d+]+ % ','/)
camelia (4,294,967,295.00 4,294,967 123.334.523)
timotimo there's also a PG-only module
eco: PostgreSQL
buggable timotimo, Found 2 results: DB::Pg, Pg::Notify. See modules.perl6.org/s/PostgreSQL
vrurg timotimo: Actually, this is what I'm doing. New dbh/sth per thread. It SIGSEGVs somewhere in Oracle instant client libs. 20:30
AlexDaniel m: say "4,294,967,295.00 4,294,967 123.334.523 :: ".words.map({/^[\d+]+ % ','/ ?? ~$/ !! Empty})
camelia (4,294,967,295 4,294,967 123)
lindylex AlexDaniel : this is what I get as output >> (「4,294,967,295」 「4,294,967」 「4,2」)
timotimo perhaps you're writing something like %handles<$*THREAD.id> and not realizing that won't interpolate and you're sharing one handle for all threads
vrurg The biggest mistery to me is that it dies later, when all thread workers are done and I create a new dbh in the main thread. And – now, it's clearly new .connect per Thread.start 20:32
timotimo oh, you're actually using Thread, interesting
vrurg Yep. A Channel and a receiver per thread which actually does INSERT. Just playing with what I can get out of asynchonosity. 20:34
timotimo: Ok, thanks a lot! It's not something critical for my task. Just exploring. 20:35
lindylex My output should be aa instead I get aa and b. say "aab :: " ~~ m:global/ a+ || \w+ / ; 20:48
timotimo the global adverb means it'll continue trying to match after it got "aa" 20:51
then b matches against \w+
lindylex Thanks I get it now.
timotimo NP 20:51
Kaypie why does this throw "Cannot find method 'compile_time_value' on object of type QAST::Op" when i try to load the module? pastebin.com/4apUQrhs 21:29
timotimo whoops! that's a good find 21:31
lizmat Kaypie: didn't you mean "uri => ..." instead of "uri -> ... " ?
timotimo i think normally we have to first .has_compile_time_value or nqp::can to check first
maybe some new code in the optimizer isn't careful enough
Kaypie ohh lol 21:32
lizmat or it is simply an LTA error ?
timotimo turn off the optimizer and see if it still crashes, i'd say
--optimize=0 or --optimize=off
(they are different)
lizmat hello 21:33
AlexDaniel hm, so zef will automatically install all scripts from bin/, right?
lizmat "uri -> string" feels wrong to me
AlexDaniel any way to prevent that? (besides renaming the directory)
Kaypie uri -> string was the issue 22:12
thanks
Kaiepi why did i have the same server open twice 22:12