Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-03-25

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:07 Exodist joined #perl6
00:11 skids left #perl6
00:12 Todd_ This did the trick:
00:12 Todd_ use Terminal::ANSIColor;
00:13 Todd_ my $Terminal = %*ENV<TERM>;
00:13 Todd_ sub PrintRed   ( $Str ) {
00:13 Todd_ if $Terminal ~~ /xterm/ || /linux/ {        print color('bold'), color('red'),   "$Str", color('reset');    }  }
00:14 Todd_ thank you again!  bye bye
00:15 Geth ¦ doc: 2dd13df6e2 | (Will "Coke" Coleda)++ | 2 files
00:15 Geth ¦ doc: Don't use private class WrapHandle
00:15 Geth ¦ doc:
00:15 Geth ¦ doc: The WrapHandle class:
00:15 Geth ¦ doc:
00:15 Geth ¦ doc: o Isn't actual part of the signature of these methods
00:15 Geth ¦ doc: o Is a private class (internal to the methods on Routine), so we can't
00:15 Geth ¦ doc:   refer to it at this level and expect the signatures to compile.
00:15 Geth ¦ doc:
00:15 Geth ¦ doc: also fix a typo.
00:15 Geth ¦ doc:
00:15 Geth ¦ doc: Closes #1254
00:15 Geth ¦ doc: review: https://github.com/perl6/doc/commit/2dd13df6e2
00:20 kurahaupo_ joined #perl6
00:22 Geth ¦ doc: 46be212f6f | (Will "Coke" Coleda)++ | doc/Language/quoting.pod6
00:22 Geth ¦ doc: Add example of nested Q delimiters
00:22 Geth ¦ doc:
00:22 Geth ¦ doc: Closes #1256
00:22 Geth ¦ doc: review: https://github.com/perl6/doc/commit/46be212f6f
00:34 bjz joined #perl6
00:45 aborazmeh joined #perl6
00:45 aborazmeh joined #perl6
00:49 Cabanossi joined #perl6
00:50 skids joined #perl6
00:57 jast joined #perl6
01:09 raschipi joined #perl6
01:11 samcv sweet. nqp::chr is soon going to be 46% faster
01:12 samcv which causes the Int.chr to be 12.3% faster
01:12 raschipi samcv++
01:12 AlexDaniel :O
01:12 AlexDaniel \o/
01:13 samcv except in the rare case the caracter has to be normalized before creating the string. then it's the same speed as before
01:13 raschipi samcv: If you keep this up, soon we will be as fast as C.
01:13 samcv hah.
01:22 samcv just doing the good work :)
01:26 aborazmeh joined #perl6
01:26 aborazmeh joined #perl6
01:30 cyphase joined #perl6
01:35 skids left #perl6
01:39 Voldenet Hm, I wonder how to forward all arguments to another method or submethod
01:40 Voldenet I'm looking for something like `sub one { ... } sub two { one(@_) }` from perl5
01:40 Voldenet m: sub one (Str $x) { say $x }; sub two { a($^a) }; two("test");
01:40 camelia rakudo-moar 1bacc6: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤    a used at line 1␤␤»
01:40 Voldenet m: sub one (Str $x) { say $x }; sub two { one($^a) }; two("test");
01:40 camelia rakudo-moar 1bacc6: OUTPUT: «test␤»
01:40 MasterDuke Voldenet: `sub one(|c) { sub two(c) }`, something like that
01:41 Voldenet m: sub one (Str $x) { say $x }; sub two { one(@_) }; two("test");
01:41 camelia rakudo-moar 1bacc6: OUTPUT: «Type check failed in binding to '$x'; expected Str but got Array ($["test"])␤  in sub one at <tmp> line 1␤  in sub two at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
01:41 Voldenet Uh, obviously. :)
01:41 MasterDuke huggable: capture
01:41 huggable MasterDuke, nothing found
01:41 MasterDuke huggable: Capture
01:41 huggable MasterDuke, Argument list suitable for passing to a Signature: https://docs.perl6.org/type/Capture
01:41 MasterDuke Voldenet: check out that link ^^^
01:42 u-ou in the repl, is there a way to say the previous answer
01:42 AlexDaniel m: sub one (|x) { two(|x) }; sub two($blah) { say $blah }; one ‘test’;
01:42 camelia rakudo-moar 1bacc6: OUTPUT: «test␤»
01:43 Voldenet m: sub one (|x) { two(|x) }; sub two($blah, $foo) { say $blah, $foo }; one 'test', 'foo';
01:43 camelia rakudo-moar 1bacc6: OUTPUT: «testfoo␤»
01:43 Voldenet splendid
01:43 samcv huggable, hug me
01:43 * huggable hugs samcv
01:44 u-ou is there a way to get the last evaluated thing in the repl?
01:45 bjz joined #perl6
01:45 u-ou like _ in python
01:45 cschwenz joined #perl6
01:45 MasterDuke u-ou: i don't think so, pretty sure the repl loses a lot of info about stuff that just happened
01:45 u-ou ok
01:47 cschwenz left #perl6
01:49 Cabanossi joined #perl6
01:59 BenGoldberg u-ou, You can always just assign the result to a variable.
02:07 BenGoldberg Does anyone know if there's something like nextsame/nextwith, but which can use an arbitrary Callable?
02:08 BenGoldberg I'm kinda thinking of perl5's goto &subname....
02:09 AlexDaniel BenGoldberg: return foo(…) ? :)
02:10 raschipi Obligatory: tail-call optimization, when?
02:10 AlexDaniel raschipi: when someone submits a PR? :)
02:11 AlexDaniel don't think it is as simple though
02:12 BenGoldberg Some things might depend on being able to play with the results of callframe(), and so *automatic* TCO is probably not a good idea.  *However* letting users perform explicity TCO should be doable.
02:21 muraiki left #perl6
02:46 Geth ¦ whateverable: e1420bc936 | (Aleks-Daniel Jakimenko-Aleksejev)++ | Unicodable.p6
02:46 Geth ¦ whateverable: Make unidump: command understand hex numbers
02:46 Geth ¦ whateverable:
02:46 Geth ¦ whateverable: Just a quick change to make it work
02:46 Geth ¦ whateverable: review: https://github.com/perl6/whateverable/commit/e1420bc936
02:46 Geth ¦ whateverable: 5bba2379ee | (Aleks-Daniel Jakimenko-Aleksejev)++ | Unicodable.p6
02:46 Geth ¦ whateverable: Tiny style tweaks
02:46 Geth ¦ whateverable:
02:46 Geth ¦ whateverable: Just making it more consistent. I wish the whole unicodable will be
02:46 Geth ¦ whateverable: refactored eventually.
02:46 Geth ¦ whateverable: review: https://github.com/perl6/whateverable/commit/5bba2379ee
02:49 Cabanossi joined #perl6
02:51 evalable6 joined #perl6
02:52 unicodable6 joined #perl6
02:52 bisectable6 joined #perl6
02:52 bloatable6 joined #perl6
02:52 committable6 joined #perl6
02:52 benchable6 joined #perl6
02:52 statisfiable6 joined #perl6
02:52 AlexDaniel (… had to update rakudo to get :i fix)
02:58 ZzZombo joined #perl6
02:59 ZzZombo What modules would be my best bet at creating my own HTTTP proxy server?
03:00 SmokeMachine m: enum Bla of Int (bla => 42) # should it be valid?
03:00 camelia rakudo-moar 1bacc6: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤No such method 'set_of' for invocant of type 'Perl6::Metamodel::EnumHOW'␤at <tmp>:1␤»
03:13 skids joined #perl6
03:13 skids What's the nqp incantation to transform a BOOTStr to str?
03:14 timotimo nqp::hllize
03:14 timotimo or perhaps you mean decont_s?
03:17 skids I think it's an NQP 'str' but I'm not totally sure.  it's from a nqp::getattr_s
03:19 Cabanossi joined #perl6
03:20 skids still 'P6opaque: representation mismatch when storing value (of type BOOTStr) to attribute (of type str)'
03:21 BenGoldberg m: for ^Inf { if callframe($_) -> $c { say $c.code ?? $c.code.name !! '?' } else { last } };
03:21 camelia rakudo-moar 1bacc6: OUTPUT: «(signal SEGV)␤␤sink-all␤sink␤<unit>␤?␤eval␤evalfiles␤command_eval␤command_eval␤command_line␤?␤?␤?␤»
03:22 BenGoldberg Oops?
03:26 noganex joined #perl6
03:26 ribasushi joined #perl6
03:29 cyphase joined #perl6
03:35 MasterDuke BenGoldberg: i just created a moarvm issue for that https://github.com/MoarVM/MoarVM/issues/562
03:39 timotimo i'd prefer a more concise title ("segv from accessing code objects from callframes") and the code to run it at the beginning of the ticket's description
03:40 timotimo the segv there is just a missing null pointer check, though it's surprising to have a callframe that gives null there
03:40 timotimo though perhaps that's what you get when you give a too high number to callframe?
03:40 timotimo m: say callframe(10000).code
03:40 camelia rakudo-moar 1bacc6: OUTPUT: «ctxcaller needs an MVMContext␤  in block <unit> at <tmp> line 1␤␤»
03:40 timotimo m: say callframe(10000).code.name
03:40 camelia rakudo-moar 1bacc6: OUTPUT: «ctxcaller needs an MVMContext␤  in block <unit> at <tmp> line 1␤␤»
03:40 timotimo fair enough i guess
03:40 ZzZombo joined #perl6
03:41 ZzZombo sup
03:42 timotimo ZzZombo: have you heard of the http adaptation protocol (or something like that?)
03:42 timotimo https://en.wikipedia.org/wiki/Internet_Content_Adaptation_Protocol
03:42 timotimo anything you could want to do with a custom proxy server you could do with squid and this instead
03:48 xtreak joined #perl6
03:55 bjz joined #perl6
03:59 skids Ah.  The BOOTStr is null.
04:03 ZzZombo timotimo: it was very interesting to learn, but unfortunately it doesn't seem like there is a whole lot of usable ICAP servers for Windows.
04:07 Cabanossi joined #perl6
04:11 xtreak joined #perl6
04:17 mst joined #perl6
04:20 ribasushi joined #perl6
04:22 skids m: use nqp; my $b; "o" ~~ / . {$b := $/.CURSOR }/; my $f := nqp::getattr_s($b,Cursor,"\$\!name"); nqp::say(nqp::isnull($f)); nqp::say($f);
04:22 camelia rakudo-moar 1bacc6: OUTPUT: «0␤say requires a concrete string, but got null␤  in block <unit> at <tmp> line 1␤␤»
04:22 skids :/
04:25 skids Ah.  isnull_s.
04:43 Slobo joined #perl6
04:55 ZzZombo joined #perl6
05:39 xtreak joined #perl6
05:58 vendethiel joined #perl6
06:10 wamba joined #perl6
06:12 cyphase joined #perl6
06:26 cyphase joined #perl6
06:38 cyphase joined #perl6
06:56 cyphase joined #perl6
06:58 samcv ugh wikipedia how can you not sort things numerically
06:59 samcv all the 9's at the top and it's not sorting by population
07:00 samcv i'm guessing it might be because they used commas with the numbers so it's sorting it as text. maybe on wiki you have to put the raw numbers in and it adds the commas by itself
07:05 samcv wiki markup is so insane.
07:05 samcv when it gets to complicated tables and such
07:06 Cabanossi joined #perl6
07:19 jordman_ joined #perl6
07:19 dalek joined #perl6
07:24 cyphase joined #perl6
07:37 unicodable6 joined #perl6
07:46 salv0 joined #perl6
07:50 samcv .tell nine getting those failing tests again. maybe because i'm using libffi under moarvm and not dyncall?
07:50 yoleaux samcv: I'll pass your message to nine.
07:54 robertle joined #perl6
07:55 nadim_ joined #perl6
08:00 domidumont joined #perl6
08:04 rindolf joined #perl6
08:06 mephinet joined #perl6
08:09 domidumont joined #perl6
08:13 setty1 joined #perl6
08:16 darutoko joined #perl6
08:18 Actualeyes joined #perl6
08:21 El_Che_ joined #perl6
08:46 Woodi hi #perl6 :)
08:46 samcv hi Woodi
08:47 Woodi samcv: *nicode question, if you don't mind...
08:47 pistacchio joined #perl6
08:47 pistacchio hi, is there a community forum anywhere?
08:51 samcv sure Woodi i am unicode. we all are unicode
08:51 Woodi so Unicode started as 32bit numbers, now 64 ? then encoding problems, let's say, resolved by utf-8... but that don't include *other* things like sorting, numbers - every such thing needs additional lookup table ?
08:52 Woodi just trying to find way to learn past bits and utf-8 :)
08:52 samcv ok. utf8 and unicode are seperate. unicode assigns characters to codeponits
08:52 samcv utf-8 is a way of encoding these codepoint numbers in section of 8bits
08:53 samcv the highest unicode codepoint is technically 0x10ffff but nothing is anywhere close to that high
08:54 samcv which is 1,114,111 and there aren't that many cp (yet?) but how moarvm stores codepoints is in 32 bit signed numbers
08:54 samcv well it can be 8 bits technically if all the codepoints in the string are under 128
08:55 samcv but regardless. 32 bits signed. so those negative numbers are used to store things higher than the max of a 32 bit signed number, and are also used to encode 'graphemes' which are made up of multiple codepoints
08:56 Woodi but 32/64 bit number space do not include eg. sorting ?
08:56 samcv i don't get your question
08:56 samcv but basically. there are enough negative codepoints to never run out (these synthetics)
08:57 samcv you'd have to have so much string data that it cannot be stored in any computer to use them all up.
08:57 Woodi codepoints are just numbers. how to sort lexially, by checking $cp1 < $cp2 numerically ?
08:58 RabidGravy joined #perl6
08:58 samcv uhm cmp sorts by cp
08:58 samcv i have implemented the Unicode Collation algorithm though if you want to sort properly
08:58 Woodi that algo uses additional data or just cp ?
08:58 samcv i added a docs page on the new metheods/operators i added https://docs.perl6.org/language/experimental#Collation
08:59 samcv the unicode collation algorithm uses additional data. so sorts things properly. (alphabetically)
08:59 samcv m: use experimental :collation; say <ä a o ö>.collate; # (a ä o ö)
08:59 camelia rakudo-moar ff3241: OUTPUT: «(a ä o ö)␤»
08:59 samcv m: say <ä a o ö>.sort; # (a ä o ö)
08:59 camelia rakudo-moar ff3241: OUTPUT: «(a o ä ö)␤»
09:00 Woodi and sotry with roman numbers and numbers from other cultures is similiar ? cp alone are not enought ?
09:00 Woodi *story
09:01 samcv yeah it does all languages
09:01 samcv also for latin script, it will sort 'a' before the letter 'Za'
09:01 samcv err 'Z'
09:02 samcv and you can custom set how to sort it. like if you want to ignore case. or ignore diacritics
09:02 samcv read https://docs.perl6.org/language/experimental#Collation_Levels how the collation levels work
09:02 Woodi opened :)
09:03 Woodi ok, thank you samcv++
09:03 samcv is that what you wanted?
09:04 Woodi yes :)  making sure that cp's alone are not enough for all what Unicode do
09:04 Woodi it's kind of problem with learning Unicode
09:05 nadim_ Morning P6  \o/
09:05 Woodi hi nadim :)
09:05 nadim_ do we have some Devel::Size equivalent?
09:05 nadim_ morning Woodi, long time ...
09:06 espadrine joined #perl6
09:06 Woodi pistacchio: hi, sorry for late answer... we don't have specialised forum but Reddit have specialised subreddit for us :)
09:07 domidumont joined #perl6
09:08 nadim_ I find myself use'ing three four packages all the time, is there a way to use them all in a package and just use that one?
09:10 Woodi nadim_: I think distros could be the answer but not sure
09:11 samcv Woodi, i've been asked to do a chapter on unicode for moritz's book. and have been meaning to make a blog post about unicode for too long now lol.
09:11 Woodi private CPANs, etc :)
09:13 Woodi samcv: I hear writing is learned by writing things :)
09:14 samcv that's just a rumor...
09:15 Woodi samcv: there is many blog post and articles about unicode and moust of them are similiar... I think something new should be written...
09:16 samcv ok so write what other people haven't written about unicode. that seems easy enough. link to one of these blog pages so i can make sure to be better than that one :P
09:17 Woodi samcv: I don't know to point "this is typical, bad blog post" :)
09:18 rburkholder joined #perl6
09:19 samcv this is an alright post https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/
09:19 Woodi samcv: problem is to explain you need to start from begining and that makes a lot of paragraphs. maybe post with very short intro ? :)
09:20 Woodi i read this twice I think. and that's basics, like subject indicate :)
09:20 samcv imo it goes too much into encoding and not into unicode
09:21 samcv it doesn't really say what unicode is. just how it can be encoded
09:21 chansen_ This is aslo a good introduction post: http://reedbeta.com/blog/programmers-intro-to-unicode/
09:21 samcv which i thought was leaving a lot out of it
09:21 Woodi maybe usually diacritics part is where moust readers finish reading...
09:22 samcv that looks a lot better chansen_
09:22 samcv i find it really interesting lol. but that's just me
09:23 Woodi it's much never then joels++ :)
09:23 chansen_ samcv: yeah, touches more Unicode concepts
09:24 samcv unicode is a framework for programmatically determining the properties of a character. determining what a 'visual' character is. these concepts are clear to humans writing on paper. but to a computer, it does not know what words are
09:25 samcv doesn't know how words and sections of words interact. and unicode is the framework which allows us as programmers to be able to support a vast array of scripts and languages by having clearly defined property values that can be followed
09:25 Woodi i think programmers just prefer simpler things like ascii, that them can control from start to finish...
09:25 samcv yeah of course. i mean ideally nobody would ever need to know the codepoint numbers and it wouldn't matter and it'd be abstracted enough away or something
09:26 Woodi how much is Unicode in Go and Rust ?
09:26 samcv so ascii it ties letters to 8 bits. but unicode actually describes WHAT they are. and how they interact wih the surrounding codepoints
09:26 samcv not i don't think
09:27 samcv i mean i think they support utf-8
09:27 samcv but nothing like perl 6 with its concept of graphemes
09:27 Woodi so probably Perl6 have a guaranteed lead for next 20 years :>
09:27 samcv swift is #2 with unicode support
09:27 samcv hah
09:28 samcv perl 6 was designed to be good enough for the next 100 years. or so they say
09:28 samcv at least in its flexibility and extensibility internally and such
09:28 Woodi samcv: I probably cynic here but I bet graphemes was sheduled to be invented by Unicode commeittee in future session :)
09:29 Woodi Perl6 just was too fast :)
09:30 samcv idk i could write a post about what unicode means for a perl 6 programmer. but. i don't like that really. because i think unicode should be transparent like it wasn't even there
09:30 samcv and the codepoints themselves will eventually become irrelevant
09:31 samcv and everybody would use the Unicode collation algorithm o sort things because the codepoints have no impact on the actual characters themselves and it will be a magical land, where everybody uses perl 6
09:32 Woodi samcv: maybe post how to use graphemes would be nice. eg. you used above .collate  and that's not what ascii user can imagine... such things
09:32 samcv yeah. it's easy for people to grasp, these letters aren't in the right order!
09:33 samcv when they see them. because that is the 1st thing that comes to mind, not their code values. and then expand on that. and show how unicode collation algorithm and all the properties and things give us a framework for this
09:34 samcv actually i think unicode is enormously simple
09:34 samcv for the task they do. it is amazing
09:35 parv joined #perl6
09:35 Woodi easy to say :)
09:36 parv m: say easy
09:36 camelia rakudo-moar ff3241: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤    easy used at line 1␤␤»
09:36 Woodi first: how to type that thingies :)
09:36 parv Woodi, what did you say?
09:37 Woodi parv: when ? :)
09:37 samcv Woodi, could probably write the reason things get added to unicode. such as some things are added to aid in transcribing historical text. others to allow two way roundtripping with another encoding. and need for such a thing. as well as current usage
09:39 samcv i find it interesting they have picture of squares. and like that is going to explain to you about the nature of unicode
09:40 samcv though i guess it's kinda neat. but. that was my first thought.
09:40 parv Woodi, nevermind​
09:41 Woodi samcv: I think Unicode will be used when we switch to using command lines in GUI, like `console in games :)
09:41 * parv has been doing copy-paste for unicode things not easily entered via US layout keyboard
09:42 samcv compose key!
09:43 parv samcv, I may set up that & remember the seq. or, not. don't
09:43 parv ... care enough yet.
09:45 samcv parv, you can steal my xcompose https://github.com/samcv/dot-files/blob/master/.XCompose
09:45 Woodi dayly used things always have priority...
09:45 samcv you can always search for the description or search for the symbol you copied from somewhere to remember the squence
09:46 samcv then you can do ???? and ???? and uh. ≤ and “ this ” and ¿ and whatever stuff
09:46 parv samcv, thanks # downloaded & bookmarked
09:46 samcv i have M-dash and n-dash and minus sign and horizontal bar
09:51 chansen_ samcv: How about writing about Perl 6's string model? Show how it's superior to other models/languages (concatenation, substring ...). Such post would give Perl 6 good exposure outside it's community
09:51 samcv yeah that for sure :)
09:52 samcv been good talking and getting me brainstorming
09:53 * parv .oO(if one can search unicode grapheme by description in vim)
09:53 samcv can one?
09:54 parv I no nothin'. wondering myself
09:57 jraglin joined #perl6
10:03 RabidGravy m: https://gist.github.com/jonathanstowe/d9f6c9a67f5af2002620757277336aa7
10:03 camelia rakudo-moar ff3241: OUTPUT: «(Hash[Str,<anon>])␤(Str)␤(Associative[Str,<anon>])␤No appropriate parametric role variant available for 'Associative'␤  in block <unit> at <tmp> line 12␤␤»
10:04 RabidGravy any way out of that? Assuming I need to know the "of" of the Associative attribute
10:07 RabidGravy actually isn't that a bug?
10:07 RabidGravy in rakudo that is
10:09 RabidGravy seeing that  the Associative role only has one parameter as defined but somhow it manages to create one with two parameters
10:24 kent\n joined #perl6
10:26 andrzejku joined #perl6
10:52 pistacchio how can i make "eq" to return "false"? I can only get Any
10:53 lizmat pistacchio: show us the code!  :-)
10:55 lizmat m: dd "foo" eq "bar"
10:55 camelia rakudo-moar 7ea0f6: OUTPUT: «Bool::False␤»
10:55 pistacchio oh, done
10:56 pistacchio it was the result of a grammar .made call. I just had to call .Bool on it :)
10:56 vendethiel joined #perl6
10:56 lizmat m: dd ?Any   # or prefix with ?
10:56 camelia rakudo-moar 7ea0f6: OUTPUT: «Bool::False␤»
10:58 RabidGravy so in the gist above how does the .type of the attribute become "Associative[Str,<anon>]" when there isn't a two parameter candidate for Associative?
10:58 RabidGravy or is the  .gist() cheating somehow?
11:00 RabidGravy like the Mu.gist has knowledge of the guts that isn't exposed properly in the Perl6 associative role
11:02 lizmat RabidGravy: nothing springs to mind, I'm afraid  :-(
11:03 RabidGravy my immediate thought for a fix is make Associative have two candidates
11:04 RabidGravy but I don't know what to call the key type constraint accessor
11:04 lizmat afk again&
11:07 Cabanossi joined #perl6
11:08 RabidGravy or actually just give the existing one a second parameter with a sensible default
11:10 RabidGravy ah keyof
11:10 RabidGravy will make a patch for that later, as the sun is out we're going to the seaside
11:11 wamba joined #perl6
11:14 pistacchio can you tell me why here https://ideone.com/AaSl2g <crontask> works file, while <crontask>+ hangs the execution?
11:35 pistacchio can you tell me why here https://ideone.com/AaSl2g <crontask> works file, while <crontask>+ hangs the execution?
11:53 lukaramu joined #perl6
12:07 Cabanossi joined #perl6
12:08 moritz \o from Oslo
12:08 moritz parv: <crontask> matches zero characters
12:08 moritz sorry, meant pistacchio
12:09 moritz EGONE
12:09 xinming joined #perl6
13:00 sjn o/ from Oslo :D
13:03 rumble joined #perl6
13:13 aborazmeh joined #perl6
13:13 aborazmeh joined #perl6
13:22 Cabanossi joined #perl6
13:23 lichtkind joined #perl6
13:35 lukaramu_ joined #perl6
13:44 kurahaupo__ joined #perl6
13:47 salv0 joined #perl6
14:06 AlexDaniel joined #perl6
14:07 unicodable6 joined #perl6
14:07 Cabanossi joined #perl6
14:16 domidumont joined #perl6
14:23 Sound joined #perl6
14:30 timotimo bench: compare HEAD "hey how are you".contains("w a") for ^100_000 ||| so "w a" ~~ / w ' ' a / for ^100_000
14:30 benchable6 timotimo, starting to benchmark the 1 given commit
14:31 benchable6 timotimo, ¦HEAD: «Benchmark: ␤Timing 10 iterations of 0, 1...␤         0: 0.4836 wallclock secs @ 20.6801/s (n=10)␤␉␉(warning: too few iterations for a reliable count)␤«timed out after 10 seconds»»
14:31 timotimo oh? whoops :)
14:31 timotimo bench: compare HEAD "hey how are you".contains("w a") for ^1_000 ||| so "w a" ~~ / w ' ' a / for ^1_000
14:31 benchable6 timotimo, starting to benchmark the 1 given commit
14:31 benchable6 timotimo, https://gist.github.com/748f075fdcd57cff22c52a625aa0e372
14:32 timotimo hm, the n in there can't be controlled, right?
14:33 MasterDuke timotimo: correct
14:34 ChoHag joined #perl6
14:35 MasterDuke you could make it controllable
14:35 timotimo it'd probably be beneficial to come up with a more involved benchmark to compare matching a string inside of another string with contains vs match (though perhaps it'd be fairer to use index instead of contains)
14:37 MasterDuke i keep forgetting how much overhead `for ^n` has compared to `loop (my int $i = 1; $i <= n; $i = $i + 1) {`
14:38 timotimo there is an optimization inside the Perl6::Optimizer that will transform that if n is literal
14:38 timotimo it constantly breaks, though
14:38 timotimo it's very sensitive to changes in other parts of the compiler ;(
14:41 MasterDuke bench: compare HEAD my $s = 0; $s = $s + 1 for ^1_000_000; say $s; ||| my $s = 0; loop (my int $i = 1; $i <= 1_000_000; $i = $i + 1) {$s = $s + 1}; say $s;
14:41 benchable6 MasterDuke, starting to benchmark the 1 given commit
14:41 benchable6 MasterDuke, https://gist.github.com/43d49c93c5ddffa99e7ab3d8071c2acd
14:41 MasterDuke loop takes one-tenth the time
14:42 timotimo bench: compare HEAD my $s = 0; for ^1_000_000 -> int $_ { $s = $s + 1 }; say $s; ||| my $s = 0; $s = $s + 1 for ^1_000_000; say $s;
14:42 benchable6 timotimo, starting to benchmark the 1 given commit
14:42 benchable6 timotimo, https://gist.github.com/53858e0d9e218e0c550ff846b228890e
14:43 timotimo that's at least 2x faster
14:43 timotimo bench: compare HEAD my $s = 0; for ^100_000 -> int $_ { $s = $s + 1 }; say $s; ||| my $s = 0; $s = $s + 1 for ^100_000; say $s;
14:43 benchable6 timotimo, starting to benchmark the 1 given commit
14:43 benchable6 timotimo, https://gist.github.com/a447873fa320927880a90fd89a7f804e
14:43 timotimo um ... huh?
14:43 timotimo apparently only after a given point
14:44 timotimo bench: compare HEAD my int $s = 0; for ^100_000 -> int $_ { $s = $s + 1 }; say $s; ||| my $s = 0; $s = $s + 1 for ^100_000; say $s;
14:44 benchable6 timotimo, starting to benchmark the 1 given commit
14:44 MasterDuke `-> int $_` has to create an extra frame, right?
14:44 benchable6 timotimo, https://gist.github.com/f72c3331f3e333521e599d3a82bb0e20
14:44 timotimo that's right
14:47 darutoko joined #perl6
14:48 MasterDuke m: for ^1_000_000 {}; say now - INIT now
14:48 camelia rakudo-moar 7ea0f6: OUTPUT: «0.4982313␤»
14:52 Cabanossi joined #perl6
14:55 timotimo DrForr: do you think it's already feasible to use Perl6::Parser to find stuff like "do any ecosystem modules call a method with this name with n positionals / this named arg"?
14:56 timotimo in the io grant, ioninja used a simple grep line to figure out if any calls to comb, lines, words, or slurp-rest pass the "close" named parameter, but it'd only ever find usages of "close" that's on the same line, and it'd false-positive on having "close" somewhere else on the line, too
15:14 khw joined #perl6
15:22 n1ce joined #perl6
15:25 vendethiel joined #perl6
15:26 masak that's a very interesting use case to have. timotimo++
15:27 n1ce left #perl6
15:33 gdonald joined #perl6
15:35 pmurias joined #perl6
15:36 pmurias jnthn: do we need to keep p6invokehandler? It seems to be a parrot relict as the current backends just turn it into call.
15:41 hankache joined #perl6
15:43 wamba joined #perl6
15:48 timotimo aye, perl6-all-modules is already fantastic
15:48 timotimo but unless you have a search tool with source code understanding, its use for automated surveying is limited
15:51 jnthn pmurias: I suspect it's a relic also
15:52 Cabanossi joined #perl6
16:06 pmurias jnthn: is rakudo-debugger maintained?
16:20 jnthn pmurias: As time allows, yes :)
16:21 jnthn Or doesn't allow, perhaps :P
16:21 jnthn I think recent slang changes mighta caused some upset
16:24 jraglin joined #perl6
16:56 vendethiel >  my @rm'd = $!state{'breakpoints'}.grep({ $_ ne @parts[2] });
16:56 vendethiel Grammar::Debugger's source code is nice :)
16:57 timotimo jnicethnice
17:21 domidumont joined #perl6
17:39 espadrine joined #perl6
17:48 ChoHag joined #perl6
17:48 samcv anyone had experience with a dual intel/nvidia laptop running linux. i know there's some weird things since linux doesn't have the same support as windows for these weird configs
17:52 Cabanossi joined #perl6
17:52 samcv hmm maybe have to use proprietary drivers for this. sounds like a hassle. since i do no gaming
17:53 AlexDaniel timotimo: in fact, maybe it'd be nice to have a bot for this…
17:54 dct joined #perl6
17:54 geekosaur I am under the impression recent nouveau does have limited support for it. but both the nv and nouveau drivers have (different) bugs
17:54 geekosaur but I have no direct experience; all my gear has Intel Iris Pro
17:55 geekosaur (that said, being the SME for a window manager means getting exposed to everyone else running into driver bugs :)
17:56 samcv i mena it's inherently weird. the nvidia card goes through the intel framebuffer
18:01 samcv well this t540 feels much faster than my x220. has same ram frequency (x220 supports 1666mhz if you install hacked b ios) and same amount of memory. and 2.4ghz vs 2.6ghz
18:02 samcv though i have an ssd and it is 6.0gb/s vs 3.0gb/s on the x220. though the cpu has got to be faster, or something. i don't think i really had a hard drive bottleneck before.
18:04 samcv and doesn't look like i can max out 6gb/s with aes encrypted hd. that's benching at 2.3GB/s on the t540
18:04 TeamBlast joined #perl6
18:04 samcv but still could have less strain on the rest of the cpu. hmm
18:04 samcv will have to run some rigorous benchmarks so i can actually figure out what it is
18:05 AlexDaniel m: say 2576980377.uniprop
18:05 camelia rakudo-moar 7ea0f6: OUTPUT: «Error, MoarVM cannot get Unicode codepoint property for synthetic codepoint -1717986919␤  in block <unit> at <tmp> line 1␤␤»
18:05 samcv actually wait. it's the same base ghz actually. more research is needed
18:06 samcv lol AlexDaniel nice overflow
18:06 AlexDaniel seeing it in my tests…
18:06 samcv you test that high of a cp?
18:06 samcv that's not a real one. but it should still throw differently
18:06 samcv or show different error
18:07 samcv or does it happen with normal ones
18:07 AlexDaniel samcv: https://github.com/perl6/whateverable/blob/master/t/unicodable.t#L133-L136
18:07 Actualeyes joined #perl6
18:08 AlexDaniel m: say 0x11FFFF.uniprop
18:08 camelia rakudo-moar 7ea0f6: OUTPUT: «␤»
18:08 samcv what are you expecting to happen?
18:08 AlexDaniel m: say 0x99999999.uniprop
18:08 camelia rakudo-moar 7ea0f6: OUTPUT: «Error, MoarVM cannot get Unicode codepoint property for synthetic codepoint -1717986919␤  in block <unit> at <tmp> line 1␤␤»
18:08 samcv a different error? throwing in perl 6 and not moarvm?
18:09 AlexDaniel uhhh I don't know…
18:09 samcv or just say invalid codepoint?
18:09 AlexDaniel m: try { say 0x99999999.uniprop }
18:09 camelia rakudo-moar 7ea0f6: ( no output )
18:09 AlexDaniel maybe it's fine…
18:09 AlexDaniel except for the overflow
18:10 samcv yeah
18:10 samcv probably an sprintf thing didn't do the right integer type etc lol
18:16 samcv it thinks the cp is less than 0 though. which is weird. since it's not
18:16 samcv and changing it to %li fixes it. hm
18:18 unicodable6 joined #perl6
18:18 AlexDaniel unidump: U+D800
18:18 unicodable6 AlexDaniel, https://gist.github.com/290250032f193908decbbdfd87a80fcc
18:18 AlexDaniel samcv: ↑ better than nothing I guess?
18:18 samcv this is sufficient
18:18 samcv :)
18:19 samcv i like your tables very much so
18:19 AlexDaniel unidump: 0x99999999
18:19 AlexDaniel :|
18:19 samcv XD
18:20 AlexDaniel I'll leave it as is for now… gonna revisit it later
18:22 Cabanossi joined #perl6
18:27 AlexDaniel m: say 0x99999999.uniname
18:27 camelia rakudo-moar 7ea0f6: OUTPUT: «<unassigned>␤»
18:27 AlexDaniel samcv: mmmmhmm
18:27 AlexDaniel samcv: why uniname works but uniprop doesn't?
18:27 samcv because uniname isn't in the same property function in moarvm
18:28 AlexDaniel internally, yes. But as a user, why would I care?
18:28 samcv different functions are the path they go through. they don't really share
18:28 samcv you shouldn't
18:28 AlexDaniel m: say 0x99999999.chr
18:28 camelia rakudo-moar 7ea0f6: OUTPUT: «chr codepoint too large: 2576980377␤  in block <unit> at <tmp> line 1␤␤»
18:28 samcv but you can't get a property for a non-real codepoint
18:29 AlexDaniel m: say 0xD800.chr
18:29 camelia rakudo-moar 7ea0f6: OUTPUT: «Error encoding UTF-8 string: could not encode codepoint 55296␤  in block <unit> at <tmp> line 1␤␤»
18:29 samcv the <unassigned> is not its name but is uh
18:29 AlexDaniel then I shouldn't be able to get its name also?
18:29 samcv whatever idk. will come back to it in an hour. gotta do something
18:29 AlexDaniel :)
18:29 samcv that's probably true AlexDaniel
18:29 samcv for ones above the legal limit
18:30 samcv cause it's not unassigned it's non grata
18:38 Tonik joined #perl6
18:45 raschipi joined #perl6
18:45 pmurias n/j #perl6-dev
18:47 pmurias do we want to "fabricate" unicode properties for synthetic code poins?
18:53 jnthn pmurias: Yes; so far we just take the properties of the base character and use those as the properties of the synthetic
18:53 TEttinger joined #perl6
18:53 samcv .o(probably broken for extend graphemes but i have not checked yet) but that was added recently support for extend grapheme cluster break
19:01 Voldenet How can I effectively load and unload snippets / modules in p6 script?
19:03 davido_ joined #perl6
19:05 Voldenet My use case is that I'd like to invoke perl6 scripts without reloading moarvm and leaking much memory
19:06 MasterDuke Voldenet: EVALFILE
19:06 mst now scoping is lexical you can probably load stuff into scope
19:06 mst but I dunno if rakudo will free the loaded CU after it drops out of scope
19:07 dct joined #perl6
19:07 Voldenet Oh, hm. I guess that can be easily checked with some tests
19:07 Cabanossi joined #perl6
19:11 rjbs- https://twitter.com/ignasi35/status/845339657474859008
19:11 Voldenet Nice.
19:11 mst rjbs-: you have a tail
19:13 jnthn MoarVM can collect compunits, and to my knowledge we have no remaining EVAL-related leaks
19:18 mst jnthn: wondering if there are lexical loading related ones
19:18 * mst plans to stuff things into a CUR with a timestamp version at some point or similar for reloading
19:18 mst or at least, I plan to try it and see what goes wrong
19:18 mst because that should be entertaining
19:19 FROGGS joined #perl6
19:25 labster joined #perl6
19:25 zakharyas joined #perl6
19:28 mst TimToady: incidentally, it seems like every time PEG grammars get mentioned online at least one person jumps in with "they're terrible use Marpa!" and a link to a not particularly clear critique of PEG - is there anything you can think of that elucidates the differences and explains why perl6 (and ingy's Pegex) preferred PEG ?
19:30 mst TimToady: my attempts to find comparisons just lead me in circles of Marpa zealots shouting "but PEG's terrible" and people going "uhh ... could you provide an actual analysis of this?" and then *crickets*
19:32 RabidGravy I think the tumblweed is enough counter critique
19:33 RabidGravy (I have no view on the matter)
19:33 timotimo /me didn't even read
19:34 masak mst: I read something -- a Marpa blog post -- to the effect that "while recursive descent is the easiest one to *explain* and conceptually *understand*, it's also the least optimal and least flexible from a number of parser-y points of view"
19:34 mst RabidGravy: yeah, it's enough for me to not worry about it ... but that doesn't mean the question didn't nerd snipe me anyway
19:35 raschipi u: Á
19:35 unicodable6 raschipi, U+00C1 LATIN CAPITAL LETTER A WITH ACUTE [Lu] (Á)
19:35 setty1 joined #perl6
19:36 raschipi I wonder what normalizes the codepoints I pasted.
19:36 mst masak: that would be a pretty reasonable explanation
19:36 RabidGravy you need more beer, I for one fell asleep halfway through making a tiny change to Associative.pm
19:38 Voldenet How can I force GC in moarvm, can I do this?
19:38 masak mst: one concrete case of that that I could think of is that an operator parser could be recdescent'd, but everyone I've ever seen ends up making it something like shunting algorithm instead, often citing performance
19:38 timotimo Voldenet: yes, "use nqp", then "nqp::force_gc"
19:38 masak even Perl 6 itself does a custom parser for the ops, in fact
19:39 timotimo good thing about perl6 grammars is that you can drop in anything you can imagine at any point in the parse process
19:39 timotimo as long as you return a Cursor at the end, iirc
19:40 masak 007 uses that a little bit
19:41 masak somewhere in the region of "you can declare your own operators, and they install themselves in the parser"
19:42 mst masak: oh interesting
19:43 Vishalk169 joined #perl6
19:44 Vishalk169 Hi
19:45 Vishalk169 Who's there ?
19:45 masak just us chickens...
19:45 mst too late
19:46 timotimo they came to see if perl6 is alive and it was clear to see that perl6 is actually dead
19:47 gdonald joined #perl6
19:48 AlexDaniel raschipi: perl 6 does :)
19:48 AlexDaniel raschipi: I haven't done anything in the bot to prevent normalization
19:49 AlexDaniel .u Á
19:49 yoleaux U+0041 LATIN CAPITAL LETTER A [Lu] (A)
19:49 yoleaux U+0301 COMBINING ACUTE ACCENT [Mn] (◌́)
19:50 AlexDaniel I wonder who is more right
19:50 AlexDaniel unicodable or yoleaux
19:52 Cabanossi joined #perl6
19:56 raschipi AlexDaniel: How hard would it be to prevent normalization in a string?
19:56 AlexDaniel raschipi: I guess you'll have to work with a Buf then
19:57 raschipi I'm thinking about file names, which need to be the same  bit-by-bit  to work.
19:58 geekosaur utf8-c8 is supposed to be engaged for filenames. but, yes, this needs to be thought out better
19:58 AlexDaniel where's Zoffix when you need him :)
19:58 raschipi If I have a file with the decomposed form on disk, I would need a Buf literal to be able to open it?
20:01 AlexDaniel raschipi: that's a good question, yes
20:01 AlexDaniel but no, I don't know
20:04 raschipi Right, I created a file with the decomposed forma and now I can't delete it. Let me use a graphical file browser.
20:04 timotimo utf8-c8 will always roundtrip properly
20:04 timotimo but if you have something like the A with combining accute accent, you'll end up with one or two synthetic graphemes after the A
20:08 raschipi OK, how can I declare a utf8-c8 literal?
20:09 timotimo you can't, source files go through NFG unless you specify a different encoding on the commandline
20:09 timotimo but you can spell out the Buf and put a .decode call directly in the source
20:10 raschipi That's a hassle, isn't it? Can't copy and paste filenames to source code.
20:11 Belial joined #perl6
20:12 timotimo if your filenames are weird, then yeah :P
20:13 raschipi Is there a way to say: "This string or any canonically equivalent?"
20:13 timotimo if you have Str, then "eq"
20:13 Belial Hi all, here pretty much looking for where to start with Perl 6? I used Perl 5 for work and am interested to see what has been done for the new iteration. Any tips for a C/C++ programmer learning Perl 6?
20:14 timotimo we have a few documents that could be the right thing for you, Belial
20:14 El_Che Pick a problem, and write a solution
20:14 timotimo one is the 5-to-6 pages in the docs that highlight important differences when you come to 6 from 5
20:14 El_Che while keeping a browser open with the perl6 doc
20:14 timotimo another is the perl6 page on learnxinyminutes, which is for "people who can already program" in general
20:15 Belial Ah most excellent, won't have to slog through the very basics, for some reason I can't make myself skip it lol
20:15 El_Che (is there any known schedule for the release of O'Reilly Learning Perl 6?)
20:18 lizmat no known schedule, afaik
20:18 El_Che Is it me, or did brian d foy changed the title?
20:18 El_Che "Learning Perl 6, the Nutshell Book from O'Reilly Media"
20:18 El_Che I don't remember the nutshell part
20:19 lizmat perhaps that's just O'Reilly marketing, really
20:19 lizmat it's akin to "for dummies", but hopefully it shouldn't make you feel as stupid  :-)
20:19 El_Che "Learning X" and "Nutshell" are very different kind of books
20:21 Voldenet Hm, what's the most viable way to inspect the memory usage of moarvm?
20:22 RabidGravy does t/spec/S02-types/pair.rakudo.moar have traditional failures or have I broke something
20:22 sufrostico joined #perl6
20:23 timotimo Voldenet: multiple ways to do it; i've been working on a little branch that does An Interesting Thing, let me dig it up
20:23 timotimo https://github.com/MoarVM/MoarVM/pull/536
20:24 timotimo another way is to use the moar-gdb.py gdb plugin and call "moar-heap" from a frame that has "tc" as a local variable available
20:24 Voldenet I want to see if http://ix.io/pfh will leak something, my understanding is that it shouldn't...
20:24 timotimo yet another way is the heap profiler which you get by telling perl6 to --profile=heap
20:24 Voldenet but I'd need to validate
20:25 timotimo oh, you can just watch the memory usage in top or something
20:26 Voldenet hm, something like this would probably work, but I might be profiling leaks in shell-* area http://ix.io/pfi
20:26 timotimo ah i was about to suggest using /proc/self for that
20:26 Voldenet Wow, I've used /proc/pid my whole life
20:26 Voldenet :P
20:28 Voldenet but i'll split that for sanity, I don't want to check if shell ops are leaky :P
20:29 timotimo right, that's why i suggested just watching in top
20:30 Voldenet hm, top has the problem of not monitoring over-time growth, and I don't want to sit 10 hours and watch it :-)
20:31 timotimo hm, okay, how about this
20:31 timotimo in addition to sleep 0.1, you also { say "hi" }
20:31 Voldenet :>
20:31 timotimo and you pipe that into something that invokes ps for every line it gets
20:33 Voldenet Well, I was just planning to make a perl script doing Proc::Async.new that'd save csv with memory usage measurements
20:33 Voldenet (i'm sure it's already solved, but I definitely need this :P)
20:35 sufrostico joined #perl6
20:36 Belial joined #perl6
20:42 matiaslina joined #perl6
20:45 [Coke] .ask awwaiid if they can check out https://github.com/perl6/doc/issues/1247
20:45 yoleaux [Coke]: I'll pass your message to awwaiid.
20:48 Voldenet uh, I wonder why Proc has pis and Proc::Async doesn't
20:48 Voldenet s/pis/pid/
20:49 raschipi OK, IO::Path.new is 'multi method new(Str:D $path)'
20:50 BenGoldberg joined #perl6
20:50 raschipi Shouldn't it take Stringy instead of Str so it can receive a Buf with the exact bits we need?
20:51 raschipi To open a file with a name that Str would normalize.
20:53 lichtkind_ joined #perl6
21:00 Voldenet okay, I'm not sure what to do to get a pid
21:01 Voldenet > perl6 -e 'my $sleep = run <sleep 3>, :out; say $sleep.pid'
21:01 Voldenet this should theoretically work... right?
21:06 pmurias jnthn: jnthn/rakudo-debugger seems to have a parrot specific Makefile, I have made a PR request to get rid of nqp::p6invokehandler but I don't know how to test it
21:07 Cabanossi joined #perl6
21:11 raschipi m: my $sleep = run <sleep 3>, :out; say $sleep.pid
21:11 camelia rakudo-moar b01d7e: OUTPUT: «run is disallowed in restricted setting␤  in sub restricted at src/RESTRICTED.setting line 1␤  in sub run at src/RESTRICTED.setting line 14␤  in block <unit> at <tmp> line 1␤␤»
21:13 jnthn pmurias: Oh, the Makefile should be tossed
21:14 jnthn pmurias: We moved the driver program into Rakudo since it needs maintaining with the compiler
21:14 jnthn So that repo of mine is just the frontend
21:15 jnthn pmurias: 'tis gone :)
21:15 jnthn pmurias: Test the PR - does it pass spectest? :)
21:43 Voldenet Argh, I still can't just run the process and get its pid, i feel sad now
21:45 Voldenet and running fork + execv doesn't feel like a perl6 solution at all :(
21:48 BenGoldberg Voldenet, run should work, just not with camelia.
21:48 mst I'm getting (Any) for .pid and also it doesn't seem like it actually ran it
21:48 mst I'm rather confused
21:52 AlexDaniel and what are you doing exactly?
21:52 Voldenet reposting the same code, but: perl6 -e 'my $sleep = run <sleep 3>, :out; say $sleep.pid'
21:53 mst I can't work out if it even got started tbh
21:54 AlexDaniel mst: say $sleep.out.slurp-rest; :)
21:54 AlexDaniel oh, and run needs :out then
21:54 mst but .pid is still (Any) after that
21:54 AlexDaniel ah, it's there, right
21:54 AlexDaniel yea, I see
21:56 Voldenet So... how do I force it to get started?
21:57 AlexDaniel interestingly… pid does not seem to be set at all
21:57 AlexDaniel https://github.com/rakudo/rakudo/blob/fb381908ed9a28f4291e3617c6fe57a2e6fe1bfd/src/core/Proc.pm
21:57 rburkholder joined #perl6
21:58 timotimo maybe some class deriving from Proc was supposed to do something about pid at some point
21:59 Voldenet well, I made some rather "solid example"
21:59 Voldenet http://ix.io/pft
22:00 Voldenet Without pid trying to do system-level stuff would get extremely hard
22:00 mst use IPC::Run:from<Perl5>;
22:00 timotimo i'm not sure what the api should look like to correctly get the pid out of our stuff
22:01 AlexDaniel Voldenet: yea, it's simply not there. Sad. Anyway, why do you need to know the pid exactly?
22:01 Voldenet mst: yeah, that does the job, but I could make that whole tool in perl5, the point was getting it done in perl6 :-)
22:01 timotimo i mean at the nqp op level
22:01 Voldenet AlexDaniel: getting /proc/(pid)/smaps
22:01 AlexDaniel :o
22:01 mst I'm curious how perl6 even tells when a process has exited if it doesn't have the pid to correlate with waitpid()
22:02 timotimo that's libuv domain
22:02 timotimo it knows what to do
22:02 geekosaur this is also why it's hard to get file descriptors, a lot of stuff is hidden at the libuv level
22:03 Voldenet it'd be harder to re-implement libuv though ;-)
22:03 timotimo yeah, we're planning to eventually throw out libuv partially
22:03 timotimo only fro synchronous I/O, of course
22:03 timotimo we just lazily implemented synchronous I/O based on just starting an uv loop and waiting for it to terminate, and that got us sync i/o
22:04 timotimo but it has big overhead and more frustratingly makes it impossible to open a socket on one thread and read from it in another >:(
22:05 mst Voldenet: what I'm finding is that perl6 can be used to write TCP daemons just fine, but for traditional unixy stuff, perl5 is still much more likely to be sane
22:05 mst (insert semi-regular grumble about no unix socket support here)
22:05 timotimo oh, yeah, that
22:05 Voldenet mst: but I tried some socket programming yesterday and managed to get some segfaults out of it, not with anything reproducible though
22:06 mst I haven't managed that yet
22:06 mst I'm sure it'll happen eventually given the number of times I've segfaulted perl5
22:06 Voldenet It was basically something about writing to a 'already-closed' socket
22:06 Voldenet AND signals
22:07 Voldenet that's why it's not really a reproducible combo
22:07 gfldex do we got isatty somewhere?
22:07 Voldenet mst: well, perl5 sits rather tight with tons of native code wrapped into packages, it's bound to segfault at some point
22:08 mst Voldenet: oh, please, that doesn't count.
22:08 Voldenet (I remember using openssl + DBI + pthreads crashed it mercilessly)
22:08 mst I mean single threaded pure perl segfaults
22:08 mst breaking XS modules is for amateurs
22:08 Voldenet :-)
22:08 lizmat gfldex: IO::Handle.t
22:09 mst I managed to make it deref a null pointer mucking with CORE:: once
22:09 mst that was -ing hilarious
22:09 gfldex lizmat: thanks
22:10 Voldenet That's... hilariously frustrating ;-)
22:10 timotimo oh if you want "hilariously frustrating" i have the story for you %)
22:10 timotimo have you heard of a program named "rakudobrew"?
22:11 Voldenet Not really, should I? :-)
22:11 timotimo not important
22:11 Voldenet Or rather, heard the name, didn't use it.
22:11 timotimo anyway, it puts a folder in your home that has a bin/ where it puts a rakudo and any binaries you installed
22:12 timotimo you're supposed to add that bin/ folder to your path and you can have multiple versions in there and switch all scripts/modules/... with just one command
22:12 Voldenet and that's sane... enough
22:12 timotimo yup
22:12 timotimo some people use that as root, which is not so terrible, but not perfect
22:12 timotimo but in itself it's not problematic
22:12 timotimo here's what happened
22:13 sftp joined #perl6
22:13 timotimo someone didn't want to add the path to every user's path (or something like that?) so they symlinked /usr/bin into the rakudobrew folder
22:13 timotimo now guess what the first thing is that rakudobrew does when you switch between versions
22:14 Voldenet hmm, throw "invalid .so"?
22:14 raschipi Nukes the directory, yay!
22:14 Voldenet Wow.
22:14 timotimo nukes the directory, exactly!
22:14 timotimo someone was left with a not very complete system
22:14 mst rm /usr/bin/* # oops
22:14 Voldenet Oh, now I get what's linking into /usr/bin was
22:14 timotimo and rakudobrew got something put in
22:16 timotimo to prevent that same thing from happening again
22:16 timotimo but we figured out since then that we shouldn't be recommending regular users to use rakudobrew at all
22:18 Voldenet Eh, but how does rakudobrew know which part of PATH contains rakudo?
22:19 timotimo huh?
22:19 timotimo it puts rakudo there
22:19 timotimo and you're supposed to add "there" to your PATH
22:19 Voldenet Ah.
22:19 timotimo i.e. export PATH=/home/me/.rakudobrew/bin:$PATH
22:22 Voldenet So it's more suitable to making some packages, not using in $PATH, and PATH way is for devs only
22:23 Voldenet Okay, time to write some perl6 wrappers around native methods.
22:23 timotimo nah, you shouldn't create packages with rakudobrew
22:23 timotimo native methods? you mean C or C++?
22:24 Voldenet fork and execv :)
22:24 Voldenet I guess passing the array to it moderately tricky.
22:24 Voldenet s/it/it is/
22:28 timotimo nah, we have CArray for that
22:36 gfldex m: dd &fail
22:37 camelia rakudo-moar b01d7e: OUTPUT: «Sub fail = sub fail (| is raw) { #`(Sub|60576296) ... }␤»
22:37 gfldex this seams to point to the proto. Is there a way to get hold of a specific multi candidate?
22:38 geekosaur m: dd &fail.^candidates
22:38 camelia rakudo-moar b01d7e: OUTPUT: «No such method 'candidates' for invocant of type 'Perl6::Metamodel::ClassHOW'␤  in block <unit> at <tmp> line 1␤␤»
22:38 geekosaur sigh
22:39 geekosaur m: dd &fail.candidates
22:39 camelia rakudo-moar b01d7e: OUTPUT: «(sub fail ( --> Nil) { #`(Sub+{Callable[Nil]}|37020544) ... }, sub fail (Exception:U $e --> Nil) { #`(Sub+{Callable[Nil]}|37020696) ... }, sub fail ($payload --> Nil) { #`(Sub+{Callable[Nil]}|37021152) ... }, sub fail (|cap is raw (*@msg) --> Nil) { #`(S…»
22:40 cpage_ joined #perl6
22:42 gfldex m: dd &fail.candidates».signature.grep(* ~~ :(|cap is raw (*@msg)))
22:42 camelia rakudo-moar b01d7e: OUTPUT: «().Seq␤»
22:42 gfldex m: dd &fail.candidates».signature.grep(* ~~ :(|cap is raw (*@msg) --> Nil))
22:42 camelia rakudo-moar b01d7e: OUTPUT: «(:( --> Nil), :(Exception:U $e --> Nil), :($payload --> Nil), :(|cap is raw (*@msg) --> Nil), :(Failure:U $f --> Nil), :(Failure:D $fail --> Nil)).Seq␤»
22:43 gfldex m: dd &fail.candidates.grep({.signature ~~ :(|cap is raw (*@msg) --> Nil)})
22:43 camelia rakudo-moar b01d7e: OUTPUT: «(sub fail ( --> Nil) { #`(Sub+{Callable[Nil]}|53990576) ... }, sub fail (Exception:U $e --> Nil) { #`(Sub+{Callable[Nil]}|53990728) ... }, sub fail ($payload --> Nil) { #`(Sub+{Callable[Nil]}|53991184) ... }, sub fail (|cap is raw (*@msg) --> Nil) { #`(S…»
22:43 timotimo if you have a capture you can use .^can or something to get one that can do what you want
22:44 timotimo rather than having to grep
22:44 gfldex i want to .wrap the candidate with the right signature
22:45 gfldex m: dd &fail.candidates.grep({.signature ~~ :(|cap is raw (*@msg) --> Nil)})».signature
22:45 camelia rakudo-moar b01d7e: OUTPUT: «(:( --> Nil), :(Exception:U $e --> Nil), :($payload --> Nil), :(|cap is raw (*@msg) --> Nil), :(Failure:U $f --> Nil), :(Failure:D $fail --> Nil))␤»
22:45 gfldex it's matching a bit much
22:46 dct joined #perl6
22:46 timotimo you can wrap the whole thing, inspect if the incoming capture is right, then do your stuff or not
22:46 gfldex I want the least fragile possible.
22:47 gfldex And it may be a good bit faster to wrap only the stuff that needs wrapping.
22:47 Voldenet joined #perl6
22:47 Voldenet joined #perl6
22:48 timotimo it's not enough to add a new candidate in a lexical scope, yeah? you need the whole-program effect of the wrap?
22:49 gfldex yes
22:49 timotimo OK
22:50 gfldex I want to .wrap the fail candidate that works on Str and add ANSI red to it `if $*IN.t`.
22:51 gfldex Not speed critical in this case but would be nice to have a method to do so if possible.
22:51 gfldex m: dd &fail.candidates».signature.grep(:(|cap is raw (*@msg) --> Nil) ~~ *)
22:51 camelia rakudo-moar b01d7e: OUTPUT: «(:(|cap is raw (*@msg) --> Nil),).Seq␤»
22:51 gfldex HA!
22:52 timotimo oh
22:52 timotimo it's not fail that's outputting stuff, you know?
22:52 timotimo well, it generates a message, i guess
22:52 Voldenet uh, i think I didn't get through
22:52 Voldenet hm, what's the type for Null in CArray?
22:52 timotimo can you elaborate a bit more?
22:53 Voldenet I need to pass a null-delimited array to execv, something like: { "/bin/ls", "-l", NULL }
22:53 timotimo oh
22:53 timotimo easy. if it's a CArray[CString] just put in CString
22:53 timotimo i.e. the type object
22:53 timotimo because type objects are perl6's version of "undefined"/"no value"
22:54 Voldenet no such thing as CString
22:56 Voldenet and using Str doesn't work at all, hm
22:56 gfldex m: dd &fail.candidates.grep(:(|cap is raw (*@msg) --> Nil) ~~ *)».signature
22:56 camelia rakudo-moar b01d7e: OUTPUT: «Type check failed in binding to '$e'; expected Exception but got Signature (:(|cap is raw (*@msg)...)␤  in block <unit> at <tmp> line 1␤␤»
22:57 timotimo oh, yes! you're right
22:57 timotimo it has to be CArray[Str]
22:59 timotimo https://github.com/rakudo/rakudo/blob/nom/t/04-nativecall/05-arrays.t#L26-L37 - here's some tests that use CArray[Str]
22:59 timotimo we might want to put in a test to cover passing a Str to get a null
23:06 kurahaupo__ joined #perl6
23:15 Voldenet so, eh, apparently invoking execv from perl6 isn't as straightforward
23:17 gfldex m: &fail.candidates[2].wrap({ say "foo" }); fail "oi‽"
23:17 camelia rakudo-moar b01d7e: OUTPUT: «Cannot invoke object with invocation handler in this context␤  in block <unit> at <tmp> line 1␤␤»
23:18 gfldex there goes my nice idea :(
23:20 Voldenet Any idea what's wrong with this: http://ix.io/pfC
23:22 Cabanossi joined #perl6
23:33 timotimo Voldenet: huh, doesn't that have to set $argc + 1 to Str?
23:34 timotimo m: my @argv = <hello how are you>; my $path = "me"; my @result; @result[0] = $path; $argc = @argv.elems + 1; for ^@argv.elems { @result[$_ + 1] = ~(@argv[$_]) }; @result[$argc] = 0; dd @result
23:34 camelia rakudo-moar b01d7e: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '$argc' is not declared. Did you mean '@argv'?␤at <tmp>:1␤------> 3= "me"; my @result; @result[0] = $path; 7⏏5$argc = @argv.elems + 1; for ^@argv.elem␤»
23:34 timotimo m: my @argv = <hello how are you>; my $path = "me"; my @result; @result[0] = $path; my $argc = @argv.elems + 1; for ^@argv.elems { @result[$_ + 1] = ~(@argv[$_]) }; @result[$argc] = 0; dd @result
23:34 camelia rakudo-moar b01d7e: OUTPUT: «Array @result = ["me", "hello", "how", "are", "you", 0]␤»
23:34 timotimo no, it's fine
23:35 timotimo can you find out what strace thinks is going on?
23:37 Voldenet timotimo: basically this, execve("ls", ["ls", "-la"], [/* 22 vars */]) = -1 ENOENT (No such file or directory)
23:37 Voldenet Yeah, maybe I don't have ls in my system
23:37 Voldenet :D
23:38 timotimo are you sure execve will use $PATH for you?
23:39 timotimo stackoverflow says: execve() does not look at PATH; for that, you need execvp().
23:39 timotimo Special semantics for execlp() and execvp()
23:39 timotimo The  execlp(),  execvp(), and execvpe() functions duplicate the actions
23:40 timotimo of the shell in searching for an executable file if the specified file‐
23:40 timotimo name does not contain a slash (/) character.
23:40 raschipi You can tell by the p.
23:40 timotimo p stands for path?
23:40 raschipi yeah
23:40 timotimo earlier today i heard p stands for pot. 420 blaze it!
23:41 Voldenet hmm, still doesn't work with p on the end though
23:42 cyphase joined #perl6
23:43 raschipi Are you using a Unix-like OS?
23:43 Voldenet obviously, a debian
23:44 * timotimo downloads teh code
23:44 Voldenet huh, strace does see a write syscall
23:44 raschipi Of course, since you used strace above
23:45 Voldenet ...but it doesn't output anything to the stdout
23:45 timotimo ah, yeah
23:45 timotimo it's trying to write to stdout
23:45 timotimo but it doesn't know that libuv already configured stdout to be quite a strange beast
23:45 timotimo so it's not talking to it properly
23:47 timotimo and boom, it's getting "bad file descriptor" errors when trying to write its result to stdout
23:47 timotimo then it's trying to output the error to stderr
23:47 timotimo but stderr is configured the same way as stdout
23:47 timotimo so it just gets EBADF there, too
23:47 timotimo then it gives up and exits with code 2
23:47 geekosaur actually that sounds weird. does libuv really move stdout and stderr away from fds 1, 2?
23:48 timotimo no, it does not
23:48 timotimo or ... maybe it does?
23:48 geekosaur EBADF is only returned if the fd is closed
23:49 timotimo oh? huh.
23:50 * timotimo reads closely the full strace log
23:51 geekosaur or if it's not open in write / read-write moe
23:51 timotimo here it dup3s 9 (which is /dev/tty) to 0
23:51 geekosaur but that would be even weirder
23:51 timotimo and then the same to 1
23:52 Cabanossi joined #perl6
23:52 timotimo i don't know most of these ioctls, FIONBIO? TCGETS?
23:53 Voldenet TCGETS is used to get termios
23:53 geekosaur non-blocking I/O for the first (old way; why???)
23:53 geekosaur and also used incidentally by the isatty() check to see if it should use line vs. block buffering
23:53 geekosaur (default line for ttys, block for everything else)
23:54 timotimo anyway, i'm late for bed
23:54 geekosaur those last 2 lines are about TCGETS
23:54 timotimo have fun figuring this out :) :)
23:54 timotimo may be enough to just close 0, 1, and 2 and opening then dup3ing /dev/stdin, stdout, and stderr in
23:55 timotimo hah, stat 4 times, then open
23:55 timotimo for many, many things, everything related to precomp and module loading
23:55 timotimo 5 times in this instance here
23:56 geekosaur http://stackoverflow.com/questions/1150635/unix-nonblocking-i-o-o-nonblock-vs-fionbio fwiw
23:56 geekosaur but I kinda want to slap anyone using FIONBIO for anything but a quick port of a 4.2BSD program >.>
23:57 timotimo feel free to ask the libuv people what their reasons are
23:57 timotimo they probably have some
23:59 Voldenet hmmm, hmmm, obviously perl5's exec doesn't work all that well

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo