»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
Zoffix m: Rat.^roles.say 00:02
camelia ((Rational[Int,Int]) (Real) (Numeric))
Zoffix foo3: ^ fixed now
thou m: my $x; 'abc xyz' ~~ /:s <ident> $x=<ident> /; say($x); # github.com/perl6/roast/blob/master...sing.t#L11 00:53
camelia (Any)
thou I can't seem to get this to work, although roast looks like it should?
Zoffix .tell teatime I wrote fudged tests for the Range-as-quantifier-in-regex thing. Unfudge them when you fix the bug. I *think* they're correct, but keep an eye out on wrong tests; I'm not omniscient :) github.com/perl6/roast/commit/44937e865e 00:54
yoleaux Zoffix: I'll pass your message to teatime.
Zoffix thou: I don't see that test file in the list of files that run: github.com/rakudo/rakudo/blob/nom/...ctest.data 00:55
There are a couple of such tests left over ones. It's still to be decided whether they need to be kept (I think they'll get tossed in 6.d)
thou ah, so it's probably not implemented
geekosaur not the problem 00:56
Zoffix Well, I'm not aware of <ident> being a thing that matches
geekosaur hm
Zoffix m: say "foo" ~~ /<ident>/
camelia 「foo」
ident => 「foo」
Zoffix Oh, OK
thou What I'm doing now is basically / $<x>=[foo] { $x = $<x>.tail } /
geekosaur ident's a builtin
I get the match failing, so $x not assigned 00:57
thou I'm just trying to avoid having to stuff junk into $/ when I just want to reference it in a closure right after the match basically 00:57
e.g. github.com/Leont/yamlish/pull/18/c...cd8c63R242 00:58
But it's not a big deal, the $<foo>.tail method is working
Zoffix doesn't quite follow why .tail is needed 01:00
thou $<foo> becomes a list of matches 01:01
since it's inside a [ ... ]* group
Zoffix m: "xxxx" ~~ /$<x>="x"*/; say $<x>.^name 01:02
camelia Match
Zoffix m: my $x; 'abc xyz' ~~ /:s <ident> (<ident>) {$x = ~$0} /; say($x); 01:03
camelia xyz
Zoffix I see why I thought <ident> didn't exist. Last time I tried it, I typed it as <indent> :)
thou m: "xxx" ~~ / [$<x>='x' { dd ~$<x> }]* / 01:04
camelia "x"
"x x"
"x x x"
thou m: "xxx" ~~ / [$<x>='x' { dd ~$<x>.tail }]* /
camelia "x"
"x"
"x"
geekosaur ok, yeh, looks like $foo=<...> is NYI
Zoffix Ah. Thanks.
thou m: "xxx" ~~ / [('x') { dd ~$0 }]* / 01:07
camelia "x"
"x x"
"x x x"
thou m: "xxx" ~~ / [('x') { dd ~$0.tail }]* / 01:08
camelia "x"
"x"
"x"
thou Alright, thanks! 01:11
teatime Zoffix++ 01:14
yoleaux 00:54Z <Zoffix> teatime: I wrote fudged tests for the Range-as-quantifier-in-regex thing. Unfudge them when you fix the bug. I *think* they're correct, but keep an eye out on wrong tests; I'm not omniscient :) github.com/perl6/roast/commit/44937e865e
Geth doc: ecbbf2eff6 | (Brian Duggan)++ | doc/Type/IO/Socket/Async.pod6
Fix typo in example.

The text says port 3333, the code says 8080
01:37
pierrot 830 01:55
Xliff Er... 03:04
s(xmlParserInput)
*sigh*
Inline::Perl5( 03:06
*fetch stage failed for Inline::Perl5: Unable to handle source 'www.cpan.org/authors/id/N/NI/NINE/P...6.tar.gz')
Better.
...and zef will not recognize that there is a new version. 03:07
Geth doc: 32002de6d8 | (Will "Coke" Coleda)++ | 10 files
Make test files that work on repo files respect TEST_FILES

TEST_FILES is an env file of comma separated files to test
04:47
doc: 20bfc3d6d6 | (Will "Coke" Coleda)++ | 9 files
Rework tests to skip files after the files are selected

not only if we're picking the default files; allows us to not care if we pass in a bunch of inappropriate files for a test with TEST_FILES
doc: 9bf3803415 | (Will "Coke" Coleda)++ | 2 files
Run the most recent files on all tests, not just aspell
[Coke] in perl6/doc you can now run 'util/xt-recent.sh' which will run make xtest only on the most recently changed files in the commit log. 04:48
[Coke] You can also do "TEST_FILES=a,b,c make xtest" if there's you want to test a specific file. 04:50
... If there's a specific file you want to test, I mean. 04:51
[Coke] Note that the xt-recent takes about 35s here vs. 3.5minutes for a full xtest. 04:54
Geth doc: 05df5f3d57 | (Will "Coke" Coleda)++ | xt/examples-compilation.t
whitespace
04:54
travis-ci Doc build errored. Will "Coke" Coleda 'whitespace' 05:14
travis-ci.org/perl6/doc/builds/280270693 github.com/perl6/doc/compare/9bf38...df5f3d57ef
buggable [travis build above] ✓ All failures are due to: timeout (1 failure). 05:14
tyil are there any documents on making (background) services in perl 6? 07:02
wander4096 how can i match text in such form 07:07
gist.github.com/W4anD0eR96/da9cb94...c7738094ec
what i need is id ==> venue 07:08
below is a try
gist.github.com/W4anD0eR96/7f4a760...1ea8e3ce0f
but it fails at `id = {W11-0302}' 07:09
i try to fix the problem, but get new bugs
since no need of any other lines, maybe clips = <id><a-line><a-line><a-line><venue><a-line><a-line> 07:11
but i stuck in match a line properly 07:12
piojo m: say 10.000000000000001 == 10.Num 07:17
camelia True
piojo Isn't that weird? In other languages, math operations are cast to the more precise version, not the less 07:18
moritz m: say 10.000000000000001.^name 07:21
camelia Rat
moritz piojo: you can't generally say that Rat is more precise than Num, nor the other way 'around
there is no one obvious and true way 07:22
m: say 0.01e0 + 0.01e0 + 0.01e0 == 0.03e0
camelia True
moritz I wonder how that works :-)
piojo moritz: I thought Rat had infinite precision, but I haven't thought about this as much as the dev team
moritz piojo: no, only FatRat has that 07:23
piojo moritz: oh, thanks 07:23
TEttinger m: say 10.000000000000001.Num == 10.Num 07:35
camelia True
TEttinger m: say (20 - 10.000000000000001).Num == 10.Num
camelia True
TEttinger m: say 20 - 10.000000000000001
camelia 9.999999999999999
TEttinger interesting, it isn't just flooring 07:36
wander4096 m: say 10.000000000000001 == 10.FatRat 07:37
camelia False
wander4096 m: say 10.000000000000001 == 10.Rat
camelia False
AlexDaniel squashable6: status 07:57
squashable6 AlexDaniel, Next SQUASHathon in 9 days and ≈2 hours (2017-10-07 UTC-12⌁UTC+14)
piojo m: my $n = 27.09269; say $n.WHAT; say $n.Num.Rat == $n; 07:57
camelia (Rat)
False
piojo m: my $n = 27.09269; say $n.WHAT; my $diff = $n-$n.Num.Rat; say $diff.WHAT; say $diff.perl; 07:58
camelia (Rat)
(Rat)
<27/38300000>
piojo m: my $n = 27.09269; say $n.perl; say $n.Num.perl; 07:59
camelia 27.09269
27.09269e0
piojo Bug?
DrForr Heh. Work email topic - '[puppet] RAT in kitchen 08:17
s/$/'/ 08:20
lizmat . 08:33
u-ou . 08:36
El_Che DrForr: where is work nowadays? 09:11
DrForr sighs deeply. 09:12
GoodData in Prague.
El_Che why the sigh? 09:13
DrForr Just really not liking the seemingly constant change, but that's how the work environment is nowadays I guess.
El_Che I see. It sounds tiring indeed 09:15
I'll be close to the GoodData location soon :) -> Open Source Summit 09:18
DrForr Would that by chance be at the Hilton here in Prague? 09:19
El_Che around the corner: events.linuxfoundation.org/events/o...mit-europe
yep
the hilton
DrForr I saw a few people with... Aha, it is.
El_Che (I am not staying there, but a colleague is)
DrForr I saw 3 people with SUSE backpacks on my walk to work.
El_Che (I like to walk to a venue, no everyone does)
still a month to go 09:20
thus should be an other event
DrForr Do you have my Romanian number? I'll *hopefully* be in town.
El_Che not sure, I'll look it up (maybe on one of the fosdem mails) 09:21
thx
The undersell Linus Torvalds on the page: "Linus Torvalds - Linux Foundation Fellow"
lol
moritz nice chap, cool fellow :-) 09:22
El_Che "Donald Trump - Famous golver and prolific tweeter user" 09:25
s/golver/golfer/ 09:26
stmuk "I am your God" - Linus
El_Che "Larry Wall - Linguïst and creator of rn"
t 09:31
DrForr Probably too late to submit a talk. 09:34
Xliff If a NativeCall routine returns NULL, will that be interpreted as Nil, or the specified return type? 09:40
jnthn Xliff: Type object of the specified return type 09:53
Xliff jnthn++: Thanks 10:00
m: use NativeCall; my int32 $a = int32; say "a" if $a; 10:01
camelia Cannot unbox a type object (int32) to int.
in block <unit> at <tmp> line 1
Xliff Hrm.
jnthn Native types don't have a NULL :) 10:02
Xliff OK, well if a returned value is set to the type object? Will that still be untruthy?
jnthn Yes, type object are untruthy and undefined
Xliff YAY!
I keep forgetting old lessones I leanred during my first experiments with NativeCall a year ago. 10:03
s/ones/ons/
piojo m: my $n = 27.09269; say $n.perl; say $n.Num.perl; say $n == $n.Num; say ($n - $n.Num); 10:11
camelia 27.09269
27.09269e0
True
0
piojo m: my $n = 27.09269; say $n.WHAT; my $diff = $n-$n.Num.Rat; say $diff.WHAT; say $diff.perl;
camelia (Rat)
(Rat)
<27/38300000>
piojo m: my $n = 27.09269; say $n.perl; say $n.Num.Rat.perl; my $diff = $n-$n.Num.Rat; say $diff.WHAT; say $diff.perl; 10:12
camelia 27.09269
<20753/766>
(Rat)
<27/38300000>
Zoffix Num is floating point
piojo Zoffix: I know, but this is a number that should be represented exactly 10:13
Zoffix Ah, OK
piojo err, for single precision float
maybe double precision has different exact numbers
thx :)
piojo m: my $n = 27.09269; say $n.perl; say $n.Num.perl; 10:15
camelia 27.09269
27.09269e0
piojo so they are numerically the same, as Num and as Rat. Right?
m: my $n = 27.09269; say $n.WHAT; say $n.perl; say $n.Num.perl; say $n.Num.Rat == $n 10:16
camelia (Rat)
27.09269
27.09269e0
False
Zoffix Maybe. I wouldn't trust .perl too much when displaying these TBH 10:16
s: 2.2, 'perl', \()
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/9dba.../Rat.pm#L5
Zoffix s: 2e2, 'perl', \()
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/9dba...Num.pm#L34
tbrowder .tell timotimo problem seems to be a CGI script cannot use a “use lib </some/path/lib>;” to find an uninstalled module.
yoleaux tbrowder: I'll pass your message to timotimo.
Zoffix s: 2e2, 'Str', \() 10:17
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/9dba...Num.pm#L97
Zoffix Well, at least the Rat one. I see it does divs and reductions
piojo m: my $n = 27.09269; dd $n; dd $n.Num;
camelia Rat $n = 27.09269
27.09269e0
Zoffix dd is just .perl with a bowtie
tbrowder the excption looks like it’s from rakudo 10:18
piojo Zoffix: okay, fair enough. Is there any way to see a number's full value?
piojo I will just use C++ to check this :P 10:20
Zoffix m: say 2.2.nude
camelia (11 5)
Zoffix OK 10:21
I guess what I'm saying is: if you're spotting a possible bug in precision, it's equally possible the code generating Str/Num views of Rat could have a bug hiding the imprecision 10:22
piojo m: C++ agrees that this is represented exactly as a double 10:23
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3C++7⏏5 agrees that this is represented exactly
expecting any of:
infix
infix stopper
statement end
statement m…
piojo Zoffix: it should pass round trip conversion
Zoffix Str, maybe, but not Num 10:24
Actually no, neither has to
piojo Zoffix: Num is a double-precision float, right?
Zoffix .perl should tho
piojo And we're dealing with a number that's represented exactly
Zoffix piojo: are you talking about your number? I meant Rat representation in general
piojo Zoffix: yes, my number 10:25
discovered because a program was failing that shouldn't have
dealing with serialized numbers, which were parsed into Rat--this is reasonable
Zoffix m: ⅓.Str.Rat.nude.say; ⅓.Num.Rat.nude.say; ⅓.perl.EVAL.nude.say 10:25
camelia (333333 1000000)
(1 3)
(1 3)
piojo but my "convert to Num if it won't lose any precision" logic failed because the "won't lose precision" thing was giving the wrong value
Zoffix m: say ⅓.Num 10:26
camelia 0.333333333333333
piojo m: my $n = 27.09269; say $n.nude; say $n.Num.nude; say $n.Num.Rat.nude;
camelia (2709269 100000)
No such method 'nude' for invocant of type 'Num'. Did you mean any of these?
none
note

in block <unit> at <tmp> line 1
Zoffix m: say 27.09269.nude; say 27.09269.Num.nude 10:26
camelia (2709269 100000)
No such method 'nude' for invocant of type 'Num'. Did you mean any of these?
none
note

in block <unit> at <tmp> line 1
Zoffix m: say 27.09269.nude; say 27.09269.Num.Rat.nude 10:27
camelia (2709269 100000)
(20753 766)
jnthn m: say (2709269e0 / 100000e0) == 27.09269e0
camelia True
Zoffix yeah, looks like it's losing something or other. I see it converted .33333333333333 to 1/3, so it looks like it tries to be smarter than just slapping a denominator onto it
piojo Zoffix: oh, that's interesting 10:28
Zoffix m: my $r = FatRat.new: 2709269, 100000; say $r.nude; say $r.Num.FatRat.nude 10:28
camelia (2709269 100000)
(20753 766)
Zoffix shrugs
jnthn (I wondered if the issue could be that all it has is the numerator/denominator, not the original values, and doing the floating point conversion/division of each of those doesn't work out, but it seems that it does) 10:29
piojo I'll file a bug 10:31
timotimo .tell tbrowder what user does the script run as? what are its permissions? could it, for example, fail to create a precomp folder in that lib folder? 10:32
yoleaux 10:16Z <tbrowder> timotimo: problem seems to be a CGI script cannot use a “use lib </some/path/lib>;” to find an uninstalled module.
timotimo: I'll pass your message to tbrowder.
Zoffix m: say 27.09269.nude; say 27.09269.Num.Rat(1e-10).nude 10:36
camelia (2709269 100000)
(2709269 100000)
Zoffix piojo: ^ turns out it works if you set smaller epsilon (default is 1e-6) 10:37
tbrowder timotimo: it looks definitely like a rakudo bug. i can demo it with a short script using cro server and client. 10:47
yoleaux 10:32Z <timotimo> tbrowder: what user does the script run as? what are its permissions? could it, for example, fail to create a precomp folder in that lib folder?
Geth doc: 8de3bbc0de | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/Num.pod6
Document Num.🐀 methods

The .Rat is already documented as being provided by Real, but Num has its own impl of it. The .FatRat isn't documented and isn't provided by Real (but probably should be?)
tbrowder good question, but
good questions. i will look... 10:48
i don’t see any .precomp in the local lib, but i think that’s because it never finds the lib. the exception msg shows it looks in the right place but doesn’t see it. 10:51
let me tidy the script and i’ll post it. 10:52
piojo Zoffix: oh! Thanks for finding that 11:03
tbrowder timotimo: looks like i cried wolf again. found a typo in local script. 😞
tbrowder path was wrong... 11:03
piojo Zoffix: let me tell you my use case, and try to convince you this should be changed somehow (if possible)... 11:04
Zoffix: the original data was a floating point number, serialized to JSON and sent over the network. A server picked it up and treated it as a Rat (since that seems to be the default type for numbers in most cases). I tried to add it to a database, found that I had to convert it to Num for it to be valid, but upon doing so, the value isn't right anymor 11:06
oh, wait--if it's the 2nd conversion that's wrong, then the part I've described so far has no issue
So when it's deserialized, it's turned into a Rat with epsilon=0 11:07
at least, that's how it seems, since it's read from JSON or from the REPL with full precision 11:08
piojo so the only part that's wrong is the way I wrote the round-trip conversion check 11:08
travis-ci Doc build passed. Zoffix Znet 'Document Num.🐀 methods 11:14
travis-ci.org/perl6/doc/builds/280372695 github.com/perl6/doc/compare/05df5...e3bbc0de31
piojo Zoffix: little copy/paste issue with FatRat here: github.com/perl6/doc/compare/05df5...e3bbc0de31 11:19
tbrowder ref travis: are numbered rakudo versions faster than “latest” for testing? 11:27
timotimo how do you mean "faster"? 11:41
pmurias cr.openjdk.java.net/~rpressler/loom...posal.html # fibers & continuations comming to JVM 11:46
moritz tbrowder: try it and see? 11:49
Zoffix piojo: you could also store it as two Ints that you Rat-ify back 12:01
piojo: I missed what I was meant to be convinced about.... 12:02
Geth doc: jstuder-gh++ created pull request #1582:
Remove Duplicate Code From Supply Migrate Example
12:02
doc: 49568f39cc | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/Num.pod6
Fix typo; piojo++
12:03
doc: 9bc1a755e9 | (Jeremy Studer)++ (committed by Zoffix Znet) | doc/Type/Supply.pod6
Remove Duplicate Code From Supply Migrate Example (#1582)
12:04
Zoffix tbrowder: pretty sure all versions are built with rakudobrew, so no, it won't be faster. Ask gfldex; I recall he made a .travisyml that runs fast 12:08
Geth_ DBIish: 432f1ad2c5 | (Jonathan Stowe)++ | META6.json
Up version
12:14
DBIish: aad9a96465 | (Jonathan Stowe)++ | 4 files
Use the proper DEPRECATED() sub

fixes #102
Zoffix swaps geths 12:17
hm 12:18
Again push webhooks without commits :/ 12:19
stupid github
Geth DBIish: 432f1ad2c5 | (Jonathan Stowe)++ | META6.json
Up version
12:20
DBIish: aad9a96465 | (Jonathan Stowe)++ | 4 files
Use the proper DEPRECATED() sub

fixes #102
Zoffix k
piojo Zoffix: Sorry, I stopped because I realized the *core* part wasn't wrong, just my attempt at checking equality 12:23
I should have been clearer that I changed my mind--nothing was fundamentally bad about the current API 12:24
But it IS a little icky that a default number is a Rat, but conversion to Rat will give reduced precision compared to the default Rat 12:25
piojo Not a serious issue, though, since it only comes up when you use conversion operators 12:25
Zoffix piojo: I don't get what a "default number" is... :/ 12:29
m: '2e0'.Numeric.^name.say 12:32
camelia Num
piojo Zoffix: Sorry, I'm being hand-wavy. I mean most small floating point numbers, when present in the REPL or a .p6 script
m: say 1.93384.WHAT
camelia (Rat)
piojo I believe Rat and Int will cover most common numbers that are written in a script or parsed from some input. 12:33
piojo (For example, JSON::Fast turns these numbers into Rat as well) 12:34
Zoffix piojo: but that's not the "default number". You're using the syntax for a Rat literal and it gives you a Rat literal.
Well, that's JSON::Fast's problem :) It can turn them into whatever it wants :)
m: say 1.93384e0.^name
camelia Num
Zoffix m: my $n = '1.93384'; $n.&[~]('e0').Numeric.^name.say 12:35
camelia Num
Zoffix ehehe
piojo Zoffix: I see what you mean
But I don't see what you did there :) 12:36
Zoffix m: my $n = '1.93384'; ($n ~ 'e0').Numeric.^name.say
camelia Num
piojo I guess I'm bringing too much baggage from other languages where \d+\.\d+ means floating point or double
Zoffix attached 'e0' to the end of the string, so the .Numeric parses it as a Num from the get-go
piojo Zoffix: I wouldn't go so far as to admit my argument has no merit, though--what I called "default" numbers is still the canonical way to write a number (math, not perl) 12:38
[Coke] waves
Zoffix particle 12:39
piojo Zoffix: As far as I can tell, the parser special-cases its input--everything is parsed from script/REPL with epsilon=0, right? 12:40
tbrowder Zoffix: thanks
piojo so it ends up feeling like a "perl" Rat has a higher precision than an explicit Rat 12:41
piojo I'm not saying this is terrible. It is merely awkward. 12:41
Zoffix has no idea what this conversation is about anymore 12:42
tbrowder .tell gfldex Zoffix says you have a fast travis yml, can you let me see it? thanks
yoleaux tbrowder: I'll pass your message to gfldex.
piojo Zoffix: no worries
Zoffix There *is* a bug tho in how 1.1121 literals are parsed 12:47
m: (9.99999999999999999999999999999999999999999999999).nude.say
camelia (999999999999999999999999999999999999999999999999 100000000000000000000000000000000000000000000000)
Zoffix ^ Rat denominator is supposed to be uint64 maximum.
And currently the planned fix is to make that ^ a RatStr 12:48
Xliff Is the OpenSSL module working? I am getting test errors when trying to install it. 13:31
Xliff Test Summary Report 13:31
-------------------
t/15-issue-36.t (Wstat: 512 Tests: 4 Failed: 2)
Zoffix m: sub foo { $^v.uc }; my $x = "meow"; $x .= &foo; say $x 13:32
camelia MEOW
Zoffix <3 .= &sub form
Zoffix m: my $file = "meow"; my $ver = "6.c"; my $new-file = "$file{ ".$ver" if $ver.contains: 'propos'}"; dd $new-file 13:37
camelia Str $new-file = ""
Zoffix spot the bug :P
Xliff :P 13:38
Where's the }?
Zoffix the }?
Xliff Won't string interpolation complain since there is no closing curly in $new-file?
Zoffix It's there
Xliff Oh, ew. 13:40
Zoffix--: Malicious use of double quotes.
Zoffix The bug is (in this program) is $file interpreted as a hash 13:40
Xliff Yes. I was getting there. 13:41
Zoffix m: my $file = "meow"; my $ver = "6.c"; my $new-file = "$file { ".$ver" if $ver.contains: 'propos'}"; dd $new-file
camelia Str $new-file = "meow "
Xliff Still... my eyes saw an unterminated {} in a string.
I had to cross them to see the '}'
tyil I'm trying to make a perl program fork into the background, so it can run as a service, but once it forks, moar starts using 400% cpu
script is here: cry.nu/p/j4ax
DrForr Xliff: braiding makes that interesting :) 13:42
tyil once I can figure this out in a clean fashion I'll see if I can make a fancy module for it
Xliff DrForr: Braiding? Do I really want to know? Please let it be about hair. 13:43
mspo tyil: are you looping at all? shouldn't it just fork, run, and exit/ 13:44
oh does baile() loop?
tyil mspo: it starts up a bailador process, which should already do the looping
mspo k
tyil: does it busy loop without the forking?
tyil busy loop?
Zoffix Xliff: when Rakudo is parsed, it's parsed with a braid of 3 languages: main, quote, and regex. So you can have nested quotes 13:45
mspo strace it :)
Zoffix (or 4, perl5regex?)
tyil (baile() correctly loops if its not forked, if that what you mean)
Xliff Zoffix++ #explanation
mspo tyil: yeah that's what I was asking
tyil I've never made a service before, so I'm not familiar with all the fancy terminology :(
I know of strace, I havent used it before I think
mspo try it out 13:46
it might show something obvious or it might not
DrForr More to the point they're not "nested" because the quoted string belongs in a different strand of the braid, so it operates under that language's nesting rules. 13:47
tyil mspo: a.uguu.se/yRGDtJeSqleO_strace.log it doesnt reveal much obvious to me right now :p 13:50
Xliff DrForr: Tell that to my eyes... that know nothing of this 'braaaydiingggg'. 13:51
mspo tyil: you probably need to run it with -f so it follows your fork
Xliff "$file{ ".$ver" if $something == "blah" }" -- Is just evil. 13:52
tyil ah
mspo otherwise I just see a lot of memory stuff
and then clone(), stuff, exit
ugexe m: with 42 { (1,).map: {say $_; say $^a} } 13:54
camelia 42
1
gfldex_work tbrowder: gfldex.wordpress.com/2017/04/14/sp...up-travis/ 13:54
tyil mspo: a.uguu.se/2ijpQ3AYOH5B_strace.log it seems to clone a lot 13:55
gfldex_work tbrowder: please note the comments, there is more then one way to be fast
DrForr 'exit -1;' is fast but may not be the most helpful approach :) 13:57
mspo yeah you produced 22 threads
ugexe you can also make your travis script push the rakudo directory to github once, then afterwards just download and untar the archive to install (a joke, but it actually works)
tyil mspo: thats something that shouldnt happen, right? :p 13:59
mspo shouldn't you be checking if pid is == 0 or > 0?
not sure about < 0
tyil I'm trying to follow some linux daemon howto, which tells me the return of getpid is -1 on failure
and > 0 if forking succeeded
tyil but if I change one of the checks the latter check to == 0, it seems to not spawn a plethora of threads, but continue on the code in run() 14:02
mspo yeah a child will get $pid = 0
parent will get pid > 0
the parent's $pid (of > 0) will be the actual pid of the child 14:03
tyil ok, so I should check if the pid was 0, and exit if it is 14:04
since 0 is the parent, and the parent needs to die
or am I reading wrong
Zoffix Xliff: twitter.com/zoffix/status/821800160569212930 14:05
mspo tyil: 0 is the child; run() if 0 14:05
tyil: if you want to kill the parent, exit if > 0
tyil: and just bail out if < 0 because you couldn't fork and probably broke something :) 14:06
timotimo still a bit surprising forking works out with moarvm, as we do use threads 14:07
tyil if $pid < 0 { die "fork failed" } if $pid > 0 { exit 0; } # to gracefully stop the parent process
ugexe m: with 42 { say $^a }; # i dunno if i love or hate that this works like this
camelia 42
timotimo and i don't recall seeing any setup code for how threads should handle a fork
tyil all code after that has $pid as 0, thus is only ran by the child 14:08
mspo timotimo: it should probably be done in BEGIN, which should be guarateed to be single threaded or something
I just made that up
timotimo now that we have spesh on a separate thread, there is no point in user code where there aren't threads 14:09
Zoffix All rakudo programs are multi-threaded. Even empty ones use more than one thread 14:10
mspo so p6 isn't fork safe?
Zoffix shrugs
mspo or even setuid, etc safe 14:11
timotimo oh, those are per process, not per "process" 14:13
mspo there's a whole drama surrounding golang's usage in "system" space and people discovering that it doesn't actually work 14:14
timotimo oh dang 14:15
mspo because the runtime offers no escape hatch doing setup code before spinning up threads
I mean you can just say that you can't do it up front (like erlang would)
Zoffix
.oO( we could add a phaser... )
14:16
ugexe cant just set max threads to 1?
timotimo no
the spesh thread starts up before the user program is even considered
mspo here's a more compicated version of the issue: www.weave.works/blog/linux-namespa...-don-t-mix
timotimo what we could have is an evnironment variable 14:17
mspo but it's basically the same as go not being able to do the fork/drop-privileges dance
a phaser (BEGIN_SINGLE_THREAD) or en ENV that you can change at runtime seem like the best options 14:18
when I've thought about it
timotimo not fork, but how about evaling a new program?
mspo so you start with THREADS=1, do namespace/fork/privleges/whatever, set THREADS=NUMCPUS
tyil mspo: if I replace the run; with loop { say "pomf"; sleep .5; }, it seems to work properly, if I then replace the say "pomf" with say $config.get() and add the my $config Config .=new(), it still works, but when I add the $config.read() part, it loops twice and then just uses a lot of cpu
timotimo we don't allocate "just numcpus" threads now, though
we check how much cpu usage there is to see if spawning new threads would help 14:19
mspo anyway the 80% use-case is initialization/setup code
timotimo maybe it'd be better to have a commandline flag 14:20
i can even imagine a separate binary for no-threads-until-a-certain-point situations
mspo here's more on the golang stuff: github.com/golang/go/issues/1435 14:21
timotimo the spesh worker can just wait until a specific instruction has been fired
mspo anyway it's a runtime decision if you want to support that level of control or not :) 14:22
weabot is there a language-provided way to limit recursion in perl 6? 14:23
to avoid infinite recursion?
timotimo there is not 14:23
only running out of memory or counting recursion levels yourself 14:24
weabot alright thanks
Xliff Zoffix: AAAIIEEE! 14:32
Zoffy: Why do you hate me so? :)
Zoffix :)
HoboWithAShotgun how would i split a string into chunks of two characters? in p5 i'd use unpack 14:46
ilmari m: "some string".comb(2).say 14:47
camelia (so me s tr in g)
HoboWithAShotgun m: sub split-rgb ( RGBString $rgb ) { return $rgb.substr(1).comb(2).map: { "0x$_".Int }; }; say split-rgb("#FFAA0F"); 14:54
camelia 5===SORRY!5=== Error while compiling <tmp>
Invalid typename 'RGBString' in parameter declaration.
at <tmp>:1
------> 3sub split-rgb ( RGBString7⏏5 $rgb ) { return $rgb.substr(1).comb(2).
HoboWithAShotgun m: sub split-rgb ( $rgb ) { return $rgb.substr(1).comb(2).map: { "0x$_".Int }; }; say split-rgb("#FFAA0F");
camelia (255 170 15)
HoboWithAShotgun yay. thanks
Zoffix I think there's a module for doing this 14:57
buggable: eco Color
buggable Zoffix, Color 'Format conversion, manipulation, and math operations on colours': github.com/zoffixznet/perl6-Color 5 other matching results: modules.perl6.org/s/Color
Zoffix m: sub split-rgb { $^s.comb(/<:hex>**2/)».parse-base: 16 }; "#FFAA0F".&split-rgb.say 14:59
camelia (255 170 15)
Zoffix m: sub split-rgb { $^s.comb(/<:hex>**2/)».parse-base: 16 }; "FFAA0F".&split-rgb.say
camelia (255 170 15)
Zoffix hm.. what's with the ded *able bots :/ 15:01
===SORRY!=== 15:03
Zoffix Cannot locate symbol 'SSL_load_error_strings' in native library 'libssl.so' 15:03
on the bot server when I try perl6 bin/Committable.p6
.tell AlexDaniel something worng with the bots. They're all dead and if I try to run one, I get "Cannot locate symbol 'SSL_load_error_strings' in native library 'libssl.so'" 15:04
yoleaux Zoffix: I'll pass your message to AlexDaniel.
jnthn I have a hazy memory that that is some kind of libssl version thingy 15:05
I think I merged an IO::Socket::Async::SSL patch
Zoffix hm, I think IRC::Client uses that module /me tries updating
But what I wanted to show with the bot is how awesome the Color module is ^_^ $ perl6 -e 'use Color; Color.new("#FFAA0F").rgb.say' 15:06
(255 170 15)
Zoffix jnthn++ that was it :D 15:09
Zoffix .tell AlexDaniel nm, just needed to update IO::Socket::Async::SSL 15:09
yoleaux Zoffix: I'll pass your message to AlexDaniel.
jnthn Yay :)
Zoffix c: HEAD use lib <data/all-modules/zoffixznet/perl6-Color/lib>; use Color; Color.new("#FFAA0F").rgb.say
committable6 Zoffix, ¦HEAD(36122f1): «(255 170 15)»
Xliff m: my $m = "Mmmm"; say $m.^name 15:10
Is de bot dead?
camelia Str 15:10
moritz m: say 42
camelia 42
Xliff No just lagged. 15:11
OK, so what is a slick way to get the variable to print out it's name.
Zoffix m: my $m = "Mmmm"; say $m.VAR.name
camelia $m
Xliff Take the above, I would like that to output "m"
Ah... that one.
Zoffix it don't always work; all depends on how you get it
m: my $m := "Mmmm"; say $m.VAR.name
camelia No such method 'name' for invocant of type 'Str'. Did you mean any of these?
none
note
take

in block <unit> at <tmp> line 1
Zoffix m: my $m = "Mmmm"; -> \m is raw { say m.VAR.name }($m) 15:12
camelia $m
Xliff Right. Coz that is a bind.
Zoffix m: my $m = "Mmmm"; -> \meows is raw { say meows.VAR.name }($m)
camelia $m
Zoffix s/is raw//; :)
m: my $m = "Mmmm"; my $not-m := $m; say $not-m.VAR.name 15:13
camelia $m
Zoffix So basically you can get the variable name of the original container. But that container might be bound some other variable (at least how as far as I understand all this stuff) 15:14
jnthn Yes. What you're actually getting is the name of is the Scalar container. 15:16
grondilu whishes !SomeType would mean $_ !~~ SomeType 15:31
m: subset Odd of Int where $_ % 2; say 2 ~~ !Odd
camelia True
grondilu m: subset Odd of Int where $_ % 2; say 3 ~~ !Odd
camelia True
Zoffix m: subset Odd of Int where $_ % 2; say !Odd 15:32
camelia True
Zoffix That's what you're comparing against
m: subset Odd of Int where $_ % 2; say 3 !~~ Odd
camelia True
Zoffix :(
m: subset Odd of Int where * !%% 2; say 3 !~~ Odd 15:33
camelia False
grondilu m: subset Odd of Int where $_ % 2; say Odd.WHAT
camelia (Odd)
grondilu m: multi prefix:<!>(U: $type) { $type.none }; subset Odd of Int where { $_ % 2 }; say 2 ~~ !Odd 15:35
camelia 5===SORRY!5=== Error while compiling <tmp>
Invalid typename 'U' in parameter declaration.
at <tmp>:1
------> 3multi prefix:<!>(U7⏏5: $type) { $type.none }; subset Odd of I
grondilu m: multi prefix:<!>($type:U) { $type.none }; subset Odd of Int where { $_ % 2 }; say 2 ~~ !Odd 15:36
camelia 5===SORRY!5=== Error while compiling <tmp>
Invalid typename 'U' in parameter declaration.
at <tmp>:1
------> 3multi prefix:<!>($type:U7⏏5) { $type.none }; subset Odd of Int wher
Zoffix grondilu: I think that's the wrong way to write that `where` clause. You're numerically smartmatching the result of `%` against the original value
grondilu am I? 15:36
Zoffix Yes. 15:37
grondilu * % 2 I guess then
Zoffix Yup, that'll work, 'cause that's a closure
grondilu I thought any $_ expression was interpreted as a block
Zoffix nope
It thunks it, and the result of that thunk is used for smartmatching. 15:38
moritz note that boolean results also work, becase ~~ True is always true and ~~ False is always False
Zoffix Yeah. In this case though, the result is numeric
$_ !%% 2 would work
Xliff Um. How can I tell a superclass to trust any descended subclass? 15:42
I think depending on the superclass to trust every sub that needs it is rather onerous. 15:43
grondilu not related : does the declaration order matter for the dispatch of multi methods? 15:43
because I wrote method calls that I thought would be ambiguous but somehow I get no error on execution. 15:44
Xliff: there is a "trust" keyword 15:46
Zoffix Yeah, it matters in some cases
grondilu not sure it implemented yet though
moritz m: class A { multi method x() { say 1 }; ulti method x() { say 2 } }; A.x()
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot have a multi candidate for 'x' when an only method is also in the package 'A'
at <tmp>:1
grondilu *it's
Zoffix m: multi x($ where 42) {say "here"}; multi x($ where .so) { say "there" }; x 42
camelia here
moritz m: class A { multi method x() { say 1 }; multi method x() { say 2 } }; A.x()
camelia Ambiguous call to 'x'; these signatures all match:
:(A $: *%_)
:(A $: *%_)
in block <unit> at <tmp> line 1
Zoffix m: multi x($ where .so) { say "there" }; multi x($ where 42) {say "here"}; x 42
camelia there
grondilu there is no ambiguity here though 15:48
oh wait
there is
grondilu so the order prevails with where clauses? 15:48
m: multi x($ where 42) { say "there" }; multi x($ where .so) { say "here" }; x 42 15:50
camelia there
Zoffix Yeah
There's also an RFC ticket for that rt.perl.org/Ticket/Display.html?id...et-history
Xliff grondilu: Yes, but I don't want to have to use that for EVERY descendent class that may need to use it. This is an API. There's know way I can know!
I guess I will need accessors. 15:51
grondilu Xliff: if it's an API you can write in your docs that any descendant should explicity trust its own descendants 15:52
(though I suppose you can't trust your user classes as you don't know their names) 15:53
(so there is that)
yeah, better write explicit public accessors 15:54
Xliff Yeah, just did. Read only accessors, and I get a MoarVM panic.
Xliff Golf'd 15:58
m: class A { has $.a; submethod BUILD(:$a) { $!a = $a; }; method new($a) { self.bless(:$a); }; method a { $.a }; }; class B is A { has $.b; submethod BUILD(:$a, :$b) { $!b = $b; nextwith(:$a); }; method new($a, $b) { self.bless(:$a, :$b) }; method test { say $.b; say self.a; } }; my $b = B.new(1, 2); $b.test;
camelia 2
MoarVM panic: Memory allocation failed; could not allocate 319328 bytes
15:59
Xliff If I remove the call to self.a -- no panic. 16:01
m: class A { has $.a; submethod BUILD(:$a) { $!a = $a; }; method new($a) { self.bless(:$a); }; method a { $.a }; }; class B is A { has $.b; submethod BUILD(:$a, :$b) { $!b = $b; nextwith(:$a); }; method new($a, $b) { self.bless(:$a, :$b) }; method test { say $.b; } }; my $b = B.new(1, 2); $b.test;
camelia 2
Xliff m: class A { has $.a; submethod BUILD(:$a) { $!a = $a; }; method new($a) { self.bless(:$a); }; method a { $.a }; }; class B is A { has $.b; submethod BUILD(:$a, :$b) { $!b = $b; nextwith(:$a); }; method new($a, $b) { self.bless(:$a, :$b) }; method test { say $.b; } }; my $a = A.new(42); $a.a; 16:02
camelia MoarVM panic: Memory allocation failed; could not allocate 319376 bytes
Xliff Ooor... not
m: class A { has $.a; submethod BUILD(:$a) { $!a = $a; }; method new($a) { self.bless(:$a); }; method a { $!a }; }; class B is A { has $.b; submethod BUILD(:$a, :$b) { $!b = $b; nextwith(:$a); }; method new($a, $b) { self.bless(:$a, :$b) }; method test { say $.b; } }; my $a = A.new(42); $a.a;
camelia ( no output )
Xliff m: class A { has $.a; submethod BUILD(:$a) { $!a = $a; }; method new($a) { self.bless(:$a); }; method a { $!a }; }; class B is A { has $.b; submethod BUILD(:$a, :$b) { $!b = $b; nextwith(:$a); }; method new($a, $b) { self.bless(:$a, :$b) }; method test { say $.b; } }; my $a = A.new(42); $a.a.say; 16:03
camelia 42
Xliff OK, so endless look because it calls ... itself?
s/look/loop/
Zoffix $.a is a method call 16:06
`has $.a;` is a shortcut for `has $!a; method a { $!a }`; If you call `$.a` inside `method a` then yeah, it'll infiniloop 16:07
Alright. Time to get 6.d in shape 16:08
\o
Xliff .tell Zoffix So in this situation, should I not RT the infiniloop? Maybe add a caveat to the docs? 16:12
yoleaux Xliff: I'll pass your message to Zoffix.
Zoffix Xliff: no, there's no bug. The docs should make it clear that `$.a` is a method call. I wouldn't exactly call it a caveat tho 16:18
Zoffix &
AlexDaniel squashable6: status 17:09
yoleaux 15:04Z <Zoffix> AlexDaniel: something worng with the bots. They're all dead and if I try to run one, I get "Cannot locate symbol 'SSL_load_error_strings' in native library 'libssl.so'"
squashable6 AlexDaniel, Next SQUASHathon in 8 days and ≈16 hours (2017-10-07 UTC-12⌁UTC+14)
yoleaux 15:09Z <Zoffix> AlexDaniel: nm, just needed to update IO::Socket::Async::SSL
AlexDaniel thanks 17:10
hythm Hi, I'm writing app with Bailador and IoC, All the routes are in TWEAK method of the App class here: github.com/hythm7/movieo/blob/mast...eo.pm?ts=2 , I would like to organize the routes in better way for, example routes under /movie is on separate file, routes under /tvshows on separate file, and so on. but I'm not sure how to do that, Any suggestion? 17:49
moritz hythm: disclaimer: I know nearly nothing about Bailador; maybe ufobat has a better idea :-) 17:52
hythm: but those route setups all look like simple data structures passed to the get or post function
hythm: so you could easily have separate modules that all have routes() method 17:53
moritz and they all return a hash of the form get => { '/movie/edit/:id'=> { ... }, more get methods here }, post => { '/movie/edit/:id'=> { ... } }, 17:53
and then you can load as many modules as you want, call their routes method, iterate over the result, call get() and post() as appropriate 17:54
hythm moritz: I'm actually following ufobat's app "VoteImproved" as a template for organizing the code, but in my case I have many routes, thats why I needed to organize them. 17:55
sprocket hello #perl6!
moritz \o sprocket
hythm moritz: sounds a good idea, I will look into doing it as separate modules 17:56
sprocket question regarding initializing arrays - if i declare an array with: “my @buffer := CArray[uint8];”, how can i initialize the first $x places of that array to, for example, zero
moritz hythm: or maybe those separate modules can call get() and post() themselves instead of returning the data structure; dunno if Bailador likes that :-)
sprocket in p5 there’s a list multiplier operator, is there one in p6 as well? 17:56
moritz m: say 0 xx 5; 17:56
camelia (0 0 0 0 0)
sprocket oh, hey, there it is :) 17:57
thanks, moritz!
hythm moritz: will try these options and see how it lokks 17:57
thundergnat Is there any way in Perl 6, to tell how many elements have been reified in a lazily generated array? 17:58
m: my @a = 'a bunch of words,'.words, { 'some more random words,'.words } ... *; say @a[^10]; # say @a.reified.elems?
camelia This Seq has already been iterated, and its values consumed
(you might solve this by adding .cache on usages of the Seq, or
by assigning the Seq into an array)
in block <unit> at <tmp> line 1
moritz thundergnat: I don't think so. That's pretty much internal to Array or List 18:00
thundergnat: if you need more control over that, a lazy list is probably the wrong tool, because it's meant to automagically handle all that 18:01
thundergnat moritz I suspected as much but wondered . Thanks 18:05
perlpilot thundergnat: why did you want it ooc?
Xliff What's the best way to pass initialization parameters (ala via new) from a sub-class to a super-classes submethod BUILD? 18:06
Xliff I thought that callwith and nextwith would work, but given this class tree -- A<-B-<-C, where A is the base class, I can't seem to get information from class C to class A. 18:07
perlpilot Xliff: submethods don't participate in inheritance
Xliff So how can I properly initialize all attributes in a class chain?
I can't naturally get B's attributes from C. 18:08
And the same applies to A from b.
So if submethods aren't the way, then how should it be done?
set accessors? 18:09
timotimo put all stuff you need in the arguments you bless with and each class in the inheritance chain runs their own BUILD and/or TWEAK
Xliff So I can set members from A via C by C's self.bless call in new()? 18:10
thundergnat perlpilot: Sorry, other conversations going on elswhere. It isn't anything critical. A lazy list works out really well for what I am trying to do, I just wondered if there was some way to query the number of reified elements.
Xliff And would TWEAK be run after BUILD?
moritz Xliff: TWEAK rusn after BUILD, yes 18:11
Xliff k
timotimo yeah, the .new would be responsible in that case 18:12
Geth doc: a783b06494 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Path.pod6
Postpone .child -> .child (secure) swap to 6.e

Postponed until 6.e because there's a huge amount of ecosystem usage and the IO::Path.add that is the alternative is too new for module authors to reliably switch to using it.
18:14
Xliff OK, that worked. But there are still situations where I think this may fall short. 18:19
It's C-think, but...
Xliff One thing I can think of is when the value set to superclass attributes need to be affected by the subclass. 18:20
Xliff I think I can work around those with accessors and TWEAK, but I don't know if TWEAK can take parameters? Where is TWEAK documented? 18:21
perlpilot Xliff: docs.perl6.org/language/objects#in...ntry-TWEAK 18:25
though, there's not much there.
timotimo TWEAK takes the same parameters as BUILD does 18:32
timotimo hm, the TWEAK there looks weird, may be missing a format code 18:33
sjn o/ 18:34
sjn was at the 50 year anniversial lectures for the Simula language today o/ 18:35
timotimo ooh cool 18:37
moritz is slightly suspicious of programming languages older than himself :-) 18:38
mspo perl was born in 1987 18:39
there are probably a number of people here younger
or do young people all use the slack? :)
japhb Wait, so this December we celebrate 30 years of Perl? That's pretty cool. 18:42
leont Yeah 18:43
perl5.git.perl.org/perl.git/commit...059a2804f1
stmuk Lisp is 60 next year :O 18:53
yoleaux 15:40Z <Zoffix> stmuk: why is t/harness6 blocked from using more than 1 test job? It works fine for me. What exactly is wrong with it?
15:44Z <Zoffix> stmuk: never mind. Apparently the orignal problem was fixed already. I removed the plug that made harness die on JOBS>1
Xliff perlpilot++: Yes. I see it. That is fairly sparse. Is there better information in the Synopsis which describes this feature? 18:58
In a month or so, someone will need to amend the /topic. 19:00
I say we all get drunk with each other over IRC on 12-17
or 17-12 for you odd ppls. 19:01
ufobat hythm, as long as you "use Bailador" you have the bailador DSL and cann call get and post, to setup routes, wherever you like 19:24
ufobat hythm, maybe you dont want to use IoC? github.com/Bailador/Bailador/blob/...ollers.pl6 19:26
hythm, moritz, i think it is not neccessary that you return anything in a "routes" method. What if you have a "setup-routes()" method and those simply set up the routes with the bailador specific DSL 19:29
moritz ufobat: that's what I suggested later :-) 19:30
ufobat as usual, i am faster at typing than thinking or reading :) 19:31
the same applies if you use IoC 19:32
hythm ufobat, moritz, yes, setup-route method sounds cleaner in my opinion. I will try that. Thank you both for answering 19:37
ufobat :) 19:38
tyil so, I'm still trying to get a process to fork into the background properly, but it still isn't working quite the way I want 19:45
I made a small script to make sure my other code isnt breaking it 19:46
cry.nu/p/28or
but rn the loop { } runs 19 times on every run thus far
and then just stops
but there's still a moar process consuming cpu running
tyil oh, for one run it seemed to go better, hitting 1094 runs before I killed it, but the run after it iterates 19 times again 19:48
jnthn suspects fork + multi-threaded VM = pain 19:49
Since fork only clones one thread - the one that called it
jnthn So suddenly you've got an instance of the VM missing most of its threads 19:50
tyil I kinda want to be able to properly fork into the bg somehow, so I can run this as a service
hmm
robertle there is also something weird around fork and locks, as the locks get copied/cloned in whatever their current state is... 19:51
jnthn That also
tyil I find it odd that it consequently stops at 19 tho
jnthn That's probably when it needs to do a GC run
I'd guess so, anyway 19:52
jnthn And that it then tries to get the background optimization thread to join in and...it ain't there. 19:52
geekosaur jnthn, you can stop suspecting. that's why python doesn;t do threads, perl 5 does ithreads, and ghc warns not to have multiple threads before forkProcess
the edge cases are nasty and hairy 19:53
jnthn OK, then I guess I might as well just switch to saying "don't do fork in MoarVM, it won't ever work"
tyil so its impossible in perl 6 to make services which run in the background? :< 19:54
also, the current run seems to work correctly, going at 31k+ iterations now
geekosaur fork first, thread only after
this even appleis to C
jnthn That doesn't help for VMs that start their own internal threads
tyil geekosaur: fork is the first thing that happens in that script's MAIN sub tho 19:55
jnthn So, anything that does concurrent GC, or background optimization.
geekosaur potentially you can handle those cases, although you need careful accounting
tyil it seems to rarely actually work, but most of the times it'll stop after 19 iterations
jnthn Yeah, I see there's some handler that is called but...
It looks incredibly tricky to pull off 19:56
tyil what edgecase am I hitting here where it accidentally works? 19:57
geekosaur the most common failure mode is that some thread is holding e.g. a mutex (or a userspace lock) during the fork 19:58
the thread goes away but the lock is process level and remains, with nithing around to know to unlock it
so then things work until something else needs that lock and suddenly you deadlock
tyil in the script I linked it worked on my last try, but the tries before that, with the exact same code, all stopped functioning at the 19th iteration 19:59
geekosaur this applies to any process level resource: filehandles, mutexes, etc.
HoboWithAShotgun m: say 1.111111111111111111111
camelia 1.11111111111111111604544
geekosaur I couldn't tell you why it sometimes works because I don't know internal details concerning what locks are held when 20:00
tyil ah 20:01
geekosaur I know what's going on and in fact was explaining essentially the same problem in #haskell about a half hour ago >.>
and have in the past explained it for perl 5, etc.
jnthn I know the details and know there's more than one possibility for which lock it could be :)
geekosaur yep, that also complicates things :)
tyil would it be possible to make background services in perl 6 a viable thing, or should I give up hope ;~; 20:02
geekosaur it might be easiest to do the backgrounding as a scaffold (e.g. shell script)
tyil I'm not familiar with internals of anything, except frogs, so I have no idea how much effort it would be
geekosaur: basically, make a shell script which forks into the background, and then runs the perl application? 20:03
ufobat isnt fork() just creating a clone of the process? dont you get a copy of all mutexes/locks and threads? how could for example a thread "be not there" while there is still a ramaining mutex 20:03
geekosaur this kind of thing is also why e.g. systemd (and other system managers like Apple's launchd) manages backgrounding itself. it's a Hard Problem(tm)
ufobat, you get a copy of all mutexes and all flehandles. 20:04
but you only get the currently executing thread and it becomes the main thread of the new process
tyil sadly I think systemd is the worst way to solve a problem, so thats not an option
ufobat AH!
tyil that, and BSD doesnt support systemd at all
and I intend to run this service on a BSD server once its done
geekosaur conceptually systemd is a very good solution. practically, it's so badly implemented as to not be a solution
ufobat and there is no way to "clone" other threads as well? 20:05
geekosaur ufobat, no, and if you think about it, it's a bad idea 20:05
tyil that I can agree with, if the systemd concept would also drop its desire to do literally everything
geekosaur consider: parent process has a thread that has aquired a mutex so it can have exclusive access to some resource
another thread fork()s
if you clone all threads then both parent and child processes now think they own that resource 20:06
*then threads in both
if it's something like a database file where you want only one writer across an entire system or you will lose data, this is data loss about to happen
ufobat yeah as a general rule you're right, but if you as a programmer know which threads you have and wait for a "good point in time" to fork you could have a reasonable result
geekosaur except you don't 20:07
consider that we generally, for good reason, do 2-level locking
ufobat what is that? 20:08
geekosaur the actual lock is a memory location, we use a fast-mutex (futex in linux terms) to synchronize access to that memory location, but do not otherwise hold process/kernel level locks when that location is "locked"
but now user code has to knwo about that memory location to know if it's a good time to fork or not 20:09
leont Threads are why pthreads has a at_fork function, so you can fix up the locking -_-
jnthn s/Threads/Forks/ ?
oh, or maybe not :)
geekosaur and the more things that have to know about these locks, the more expensive threading, and forking, and locking get for everyone
jnthn Can prase it both ways :)
leont jnthn: no, I meant that literally 20:10
geekosaur you *can* solve it but you end up with avery heavy solution like perl 5's interpreter-per-thread
leont at_fork also meant that fork suddenly wasn't async-signal safe anymore, something POSIX didn't immediately realise 20:10
(because the at_fork handlers invariably aren't async-signal-safe 20:11
tyil back
ufobat okay :-) thanks for the explanation
tyil geekosaur, ufobat, jnthn: thanks for the information, I'll try my hand at a posix-shell wrapper that does the forking for me, and write a small article to help other users in case they wonder
leont IME, you can have at most 2 out of forks, threads and a higher level programming language 20:12
geekosaur yeh, I've been collecting my comments about the haskell version because it;s come up in the past as well, and need to turn them into a haskell wiki article at some point
tyil tfw found the first thing perl 6 is "bad" at in my experience :( 20:13
geekosaur it wouldn;t be directly applicable to perl 6 but most of the same issues apply in some sense to any other language. C squeaks by only by not having higher level data structures
geekosaur but as soon as your user code adds them in order to do real work, you run into them again 20:13
moritz C doesn't automatically start a a thread pool scheduler for you that can hold on to locks 20:14
geekosaur (and libc has some, which is where that aync-signal-safe stuff comes in)
jnthn geekosaur++ # lots of useful details 20:15
My feeling from all this is that trying to make MoarVM do better at fork is probably going to lead to it both still being bad at it *and* getting worse at other stuff while trying to achieve that. 20:16
jnthn "A strange game. The only winning move is not to play." 20:17
ufobat :D
HoboWithAShotgun one day we will have perl 6 compile to c++ source with native integration of c++ libraries 20:28
make it happen j :)
leont They're way too different for that to make sense 20:31
tyil in case anyone wonders, cry.nu/p/6ceb
seems to do the forking as a shell wrapper
additional bonus, it sets -Ilib for me :p 20:32
tyil can I reassign $*IN to a filehandle so all output gets written to a file instead of STDIN? 20:48
leont It's a normal contextual variable 20:49
tyil $*OUT and STDOUT* sorry 20:52
Ven`` same answer :P
tyil ye, just to clarify :p
lizmat my $*OUT = open("foo", :w ) 20:55
tyil tfw she left immediatly 20:56
:(
tyil wb lizmat 20:57
lizmat yeah, flaky Ziggo wifi :( 20:58
Xliff m: class A { has $!func; method test { &( $!func )("foo"); }; method setFunc($f) { $!func = $f }; }; class B is A { submethod TWEAK { sub a { say "FOO!"; }; self.setFunc(&a); }; }; my $b = B.new(); $b.test; 22:06
camelia Too many positionals passed; expected 0 arguments but got 1
in sub a at <tmp> line 1
in method test at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: class A { has $!func; method test { &( $!func )("foo"); }; method setFunc($f) { $!func = $f }; }; class B is A { submethod TWEAK { sub a($bar) { say "FOO!{$bar}"; }; self.setFunc(&a); }; }; my $b = B.new(); $b.test; 22:07
camelia FOO!foo
Xliff Can someone tell me why I am getting this: 22:09
Variable '$server' is not declared. Did you mean '$!server'?
at /home/cbwood/projects/p6-webservice-eveonline/scripts/../lib/WebService/EveOnline/RESTBase.pm6 (WebService::EveOnline::RESTBase):42
------> method getServer(⏏$server) {
From here: 22:10
github.com/Xliff/p6-webservice-eve...STBase.pm6 22:11
Xliff Rather... 22:11
Xliff github.com/Xliff/p6-webservice-eve...se.pm6#L27 22:11
If I take out the contents to TWEAK, it compiles. Is this not legal?
lizmat if self.setCacheNameFunc(&cache_name_func); returns a Failure, then you will get that. Could that be the case? 22:16
night #perl6!@ 22:17
afk&
jnthn Xliff: I don't spot it (but I'm super tired), but often that's a run-away quote and it's trying to interpolate $server 22:18
Xliff jnthn: I found it. 22:19
timotimo Xliff: i think your use of || is wrong in the getServer function
you either need | there to get a junction or use a regex
Xliff: so where was the issue? 22:20
Xliff timotimo++: ohh! A totally separate bug!
github.com/Xliff/p6-webservice-eve...se.pm6#L31
jnthn++ was right. The regex is incomplete and being interpreted as a string. 22:21
timotimo oh! 22:21
Xliff I don't know HOW that 's' got there, but it did (probably missed an Alt-F) and totally changed the code.
timotimo it's an s/// without the part after the /
Xliff Exactly.
Crap that drives me up the wall!
timotimo that needs an "in regex" version, too 22:22
the error message i mean
not only "inside double quoted string"
u-ou I like perl 5 . but I love perl 6. 22:26
HoboWithAShotgun m: say 3e-1 - .3 22:50
camelia 5.55111512312578e-17
HoboWithAShotgun m: say (3e-1).WHAT
camelia (Num)
HoboWithAShotgun Shouldn't that be a Rat? 22:51
m: say 3e-1.Num - .3 22:52
camelia 5.55111512312578e-17
HoboWithAShotgun m: say 3e-1 - .3.Num
camelia 5.55111512312578e-17
timotimo you get a Num if you use that exponent syntax
that's our "escape hatch" to get a num when you would otherwise get a rat 22:53
HoboWithAShotgun i know, i would have expected a rat when the base is an int
timotimo nah, for that you'll need the actual * 10 ** 123
HoboWithAShotgun oh
HoboWithAShotgun m: say 3e-1 - (1/3).Num 22:54
camelia -0.0333333333333333
HoboWithAShotgun bah, i am tired 22:55
food, bed, cya
Xliff Why is Grammar::Tracer saying that rules are matching when my Grammar.parse($s) returns Nil? 23:11
timotimo could be you're not matching from begininng to end 23:13
try if subparse will match
Xliff ^ 23:14
Xliff Yep. That's weird. 23:14
And Tracer seems to imply that I AM matching from beginning to end. There is no overall fail mark. 23:15
timotimo right, it doesn't know about the parse/subparse difference 23:17
it totally should
Xliff kk 23:18
I am now seeing what I want. Thanks, timotimo++
timotimo yay
Xliff HTTP::UserAgent has a bug in the header parser grammar.
timotimo one last good deed before i go to bed 23:19
Xliff message-header => 「expires: Wed, 27 Sep 2017 23:02:16 GMT」
field-name => 「expires」
field-value => 「 Wed, 27 Sep 2017 23:02:16 GMT」
field-content => 「ed, 27 Sep 2017 23:02:16 GMT」
See the problem?
timotimo yeah, it drops the W there
not sure why
Xliff Note, that for some reason, it does NOT drop the T in Tue!
Now to study the grammar. 23:20
timotimo haha
it has w instead of \w?
Xliff Think so. 23:20
Cos that's the only DOW it drops. 23:21
timotimo do you remember the "printer doesn't print on wednesdays" thing? :D
tuesdays*
Xliff github.com/sergot/http-useragent/b...er.pm6#L18 23:22
LOL, tt
timotimo huh, what
what's the use case for this special case?
surely there's a test that covers this?
ugexe ETag 23:23
timotimo lives-ok { $h.parse('ETag: W/"1201-51b0ce7ad3900"') }, "parse";
Xliff Is there some kind of field modifier for http headers that need W?
timotimo yeah
i have no idea why this is a thing
Xliff Well, CRAP.
geekosaur 'is this doesn't print on tuesdays hard, or 500 mile email hard?'
timotimo geekosaur: <3 23:24
Xliff geekosaur: That remains to be seen.
timotimo strong vs weak etag validators
Xliff Now is that the only time we need this?
geekosaur surely that can go into the ETag handler? 23:25
ugexe in any case that should be happening in the actions, not the grammar
Xliff IIF field-name == "ETag'?
ugexe: Y
FWIW: There is no "etag handler"
timotimo at the moment it's ignoring weak vs strong completely, and i'm not sure it even does anything with etag in general
Xliff Any value that starts with a "W" will get it choped. 23:26
timotimo yeah, i'd call that wrong
also, why is the / optional there?
Xliff So if the field-name MUST be etag, I can change the Actions to fix it. 23:27
And just drop that out of the grammar.
timotimo that would be preferable, i'd say 23:27
Xliff OK. Yay! Another thing I get to fix! :)
timotimo thank you for your hard work :) 23:28
Geth doc: c8cc4801f1 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Path.pod6
Add that IO::Path.chdir will be entirely removed in 6.e
23:29
doc: e0e32d0092 | (Wenzel P. P. Peppmeyer)++ (committed by Zoffix Znet) | doc/Language/functions.pod6
note multi hiding via non-multi in lexical scope (#1574)
Xliff Oh... 23:31
W8....
If that's not done there than the grammar cannot properly process both ETag values and quoted ones. 23:32
>_<
timotimo hm, so either it has to be w/" or W/" 23:33
timotimo maybe it's enough for now to require the / to be there 23:33
or is that really optional?
Xliff Doesn't look like the / is optional for ETag. 23:36
The problem, however, is that the existing grammar will work for ETags, but will fail for ANY value that starts with 'W' and not followed by / 23:37
I will need to test that.
... "<!before \h> ['W/' | 'w/']?" looks to work. 23:39
timotimo i'm going to bed
seeya!
Xliff nn
ugexe that still seems broke for any header field other than etag that could start with W/ 23:40
timotimo i'd say perhaps require the " " as well
at the moment you can start a header's value with " but not end it with one 23:41
or start it without and end it with one
it won't be included either way
ugexe its a valid start to base64 value
timotimo oh
ugexe W/ is (why it cant be ignored)
Xliff So yeah. Doing that works for ETags, too 23:42
So unless someone can find an instance where the '/' is optional, I'm going with this.
Oh, 23:43
ugexe what about `Custom-Auth-Header: W/7fhEfhkjafeHF`
Xliff ugexe++ # I didn't think about that.
Xliff So now doing: <!before \h> ( ['W/' | 'w/'] )? 23:45
And if field-name is not "ETag"; then $/0 will be added back to field-value