Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-09-09

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:12 zakharyas joined #perl6
00:28 cdg joined #perl6
00:30 Cabanossi joined #perl6
00:33 skids joined #perl6
00:51 samcv sub thing { return $foo, @array;}; my ($foo, @array) = thing
00:51 samcv this makes @array an array of an array. how do i prevent this
00:51 samcv it becomes [[0 => 16, 2 => 5, 3 => 1, 1 => 9],]
00:51 samcv instead of what it used to be
00:52 astj joined #perl6
00:53 samcv return $foo, |@array seems to work at least
00:54 samcv wouldn't that possibly mess up things if i did: `return $foo, |@array, $thing`?
01:00 Cabanossi joined #perl6
01:01 Lac joined #perl6
01:08 nightfrog joined #perl6
01:18 ugexe m: proto sub foo { {*}>>.Slip }; multi sub foo { return 1, (2,3) }; my ($foo, @array) = foo; say @array.perl
01:18 camelia rakudo-moar 591b93: OUTPUT: «[slip(2, 3),]␤»
01:19 ugexe i like to use protos to do return value formatting for some reason
01:21 jeromelanteri joined #perl6
01:25 mr-foobar joined #perl6
01:53 Cabanossi joined #perl6
01:53 cdg joined #perl6
01:54 ilbot3 joined #perl6
01:54 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
02:03 piojo2 joined #perl6
02:16 noganex joined #perl6
02:21 R0b0t1_ joined #perl6
02:32 audiatorix joined #perl6
02:33 audiatorix is there any more direct way to get a list of captures from a Match than $/.caps>>.value>>.Str
02:34 dj_goku_ joined #perl6
02:34 audiatorix ie, without needing the hyperoperator
02:41 pyrimidi_ joined #perl6
02:59 raschipi joined #perl6
03:05 raschipi joined #perl6
03:05 raschipi m: 'ab' ~~ /(.)(.)/; $/.^methods
03:05 camelia rakudo-moar 591b93: ( no output )
03:05 raschipi m: 'ab' ~~ /(.)(.)/; $/.^methods.say
03:05 camelia rakudo-moar 591b93: OUTPUT: «(ast made STR MATCH CURSOR_NEXT CURSOR_OVERLAP CURSOR_MORE INTERPOLATE CALL_SUBRULE DYNQUANT_LIMITS OTHERGRAMMAR INDMETHOD INDRULE RECURSE BUILD clone Bool prematch postmatch caps chunks punct lower !LITERAL set_package CAPHASH !alt_nfa !reduce_with_matc…»
03:33 dogbert2 joined #perl6
03:44 Cabanossi joined #perl6
03:48 Geth ¦ doc: lefth++ created pull request #1543: Describe the Backtrace class in the debugging section.
03:48 Geth ¦ doc: review: https://github.com/perl6/doc/pull/1543
03:50 kaare__ joined #perl6
04:12 Geth ¦ doc: 7f104fe03f | (Dan Zwell)++ | doc/Programs/01-debugging.pod6
04:12 Geth ¦ doc: Describe the Backtrace class in the debugging section.
04:12 Geth ¦ doc: review: https://github.com/perl6/doc/commit/7f104fe03f
04:12 Geth ¦ doc: c89adc019a | (Rafael Schipiura)++ (committed using GitHub Web editor) | doc/Programs/01-debugging.pod6
04:12 Geth ¦ doc: Update 01-debugging.pod6
04:12 Geth ¦ doc: review: https://github.com/perl6/doc/commit/c89adc019a
04:12 Geth ¦ doc: c8c56df47e | (Rafael Schipiura)++ (committed using GitHub Web editor) | doc/Programs/01-debugging.pod6
04:12 Geth ¦ doc: Merge pull request #1543 from lefth/master
04:12 Geth ¦ doc:
04:12 Geth ¦ doc: Describe the Backtrace class in the debugging section.
04:12 Geth ¦ doc: review: https://github.com/perl6/doc/commit/c8c56df47e
04:13 raschipi joined #perl6
04:29 geekosaur joined #perl6
04:29 ShalokShalom joined #perl6
04:40 geekosaur joined #perl6
04:59 Cabanossi joined #perl6
05:01 Sgeo joined #perl6
05:03 Sgeo_ joined #perl6
05:06 piojo2 joined #perl6
05:18 pyrimidine joined #perl6
05:26 wamba joined #perl6
05:26 andrzejku joined #perl6
05:44 Cabanossi joined #perl6
05:46 espadrine joined #perl6
05:59 pyrimidine joined #perl6
06:01 cdg joined #perl6
06:06 pyrimidine joined #perl6
06:10 pyrimidine joined #perl6
06:20 pyrimidine joined #perl6
06:27 pyrimidine joined #perl6
06:32 todd joined #perl6
06:32 todd Hi All!  I am trying to convert some Perl 5 code to 65.  What do I use in place of `use Term::ReadKey qw ( ReadKey ReadMode );`
06:32 nadim joined #perl6
06:32 todd Full code can be seen here: http://vpaste.net/UGpel
06:33 pyrimidine joined #perl6
06:39 pyrimidine joined #perl6
06:43 pyrimidi_ joined #perl6
06:44 Cabanossi joined #perl6
06:45 todd I will post over on perl6-users@perl.org;  bye bye
06:47 pyrimidine joined #perl6
06:48 kaare__ joined #perl6
06:57 pyrimidine joined #perl6
07:04 pyrimidine joined #perl6
07:13 pyrimidine joined #perl6
07:14 okl joined #perl6
07:16 setty1 joined #perl6
07:19 robertle joined #perl6
07:19 pyrimidine joined #perl6
07:28 pyrimidine joined #perl6
07:31 domidumont joined #perl6
07:33 pyrimidi_ joined #perl6
07:35 pecastro joined #perl6
07:37 pyrimidine joined #perl6
07:38 domidumont joined #perl6
07:41 pyrimidine joined #perl6
07:46 pyrimidine joined #perl6
07:50 pyrimidi_ joined #perl6
07:54 darutoko joined #perl6
07:56 pyrimidine joined #perl6
07:58 pecastro joined #perl6
08:02 raschipi joined #perl6
08:03 pyrimidine joined #perl6
08:08 pyrimidine joined #perl6
08:19 pecastro joined #perl6
08:22 konsolebox joined #perl6
08:32 pyrimidi_ joined #perl6
08:58 Cabanossi joined #perl6
09:03 ChoHag joined #perl6
09:08 ufobat joined #perl6
09:10 robertle joined #perl6
09:36 margeas joined #perl6
09:41 piojo joined #perl6
09:43 piojo Regarding p6doc, can we index the MOP page as "Introspection"?
09:43 piojo nobody newbie searches for MOP
09:44 Cabanossi joined #perl6
09:45 piojo I can figure out how and make a PR if y'all would be amenable to that change, but it's possible the best way is to accomplish it is to rename the page.
09:46 piojo and then we'd need to add a redirect from "mop" to "introspection"
09:46 moritz I hope you can add an index item for "introspection" but still keep the page as "mop"?
09:47 moritz the MOP can do much more than just introspection, so I'm against a rename
09:47 piojo moritz: I haven't tried, but I have the doc server on my laptop so can figure it out
09:47 piojo moritz: you're right. I was looking at the top half of the page... I'll figure out if it can be indexed.
09:51 piojo I'm really glad you guys made the doc server easy to run. My internet connection is spotty, and I don't know what I'd do without local documentation. It's too bad the p6doc CLI isn't as powerful (either for searching or showing methods of parent classes)
09:52 piojo I guess nobody wants to improve the CLI for core classes/modules because the web UI is so beautiful. (Myself included)
09:53 moritz also it's a pain to make the CLI performant without having some kind of index in a DB
09:53 piojo oh, that reminds me I found I can't build HTML on windows. I've gotta remember to try fixing that...
09:54 piojo (bug already filed)
09:56 piojo a sqlite db could be generated during the build process, and modules could optionally provide a db with their .pod
09:56 piojo But that's a complicated change.
09:57 piojo (probably over-engineered to use more than one DB, but it depends how big a non-core class hierarchy gets)
09:57 piojo moritz: oh, something unrelated--I was reading your book blog entry on regex errors (than you, by the way), and noticed sometimes ".pos" isn't defined for Match objects
09:57 piojo Do you know what determines when .pos exists?
09:59 piojo The post on generating good errors for users, I mean. It described using "self.pos" to create the error message. When I converted it to a "log" helper, self.pos wasn't defined in that usage.
09:59 stmuk_ the CLI is more performant than it was but really needs a sqlite db with FTS
10:00 mr-fooba_ joined #perl6
10:01 moritz piojo: .pos is a method on the grammar, not on Match
10:02 moritz piojo: .pos on the grammar roughly corresponds to .to on Match
10:02 piojo moritz: is it right that the invocant is sometimes the grammar and sometimes the match?
10:02 piojo for grammar methods/rules
10:03 moritz piojo: the invocant is always the grammar
10:03 piojo and that always corresponds to "self"?
10:03 moritz yes
10:04 piojo is it a 'but' construct? because "dd self" shows match, but self.WHAT shows a grammar
10:10 wtw left #perl6
10:13 rindolf joined #perl6
10:14 Cabanossi joined #perl6
10:25 ShalokShalom_ joined #perl6
10:39 Skarsnik joined #perl6
10:44 nadim ab5tract: did you see my earlier message?
10:47 Geth ¦ doc: lefth++ created pull request #1544: Make the meta-object protocol also searchable as "Introspection".
10:47 Geth ¦ doc: review: https://github.com/perl6/doc/pull/1544
10:50 Ptolemarch joined #perl6
10:51 Skarsnik_ joined #perl6
10:56 piojo It looks like in some circumstances, <match-rule($i++)> is not post-incrementing $i when it's called in a grammar
10:56 piojo has anyone seen that bug, or is it new?
10:57 piojo the bug goes away if I refer to $i again in the same scope, like: {say $i}
10:57 piojo and it goes away if I replace the original assertion to force incrementing the variable: <match-rule($i)> { ++$i }
10:58 piojo the layout is basically:
10:59 piojo :my $i = 0; [     <rule-1($i, $arg1, $arg2)>     <rule-2($i++, $arg2)>      ]+
11:01 piojo Ignore me! Sorry, something else is wrong, though it seems related
11:01 llfourn joined #perl6
11:03 piojo I'm having a really hard time making this bug into a good test case, since adding blocks something in the way the grammar executes
11:03 piojo *adding blocks changes the way the grammar is parsed
11:11 dogbert2 joined #perl6
11:17 leont joined #perl6
11:19 jnthn piojo: Blocks are procedural, so adding a block into a token may change its longest prefix, and thus change the way it's LTM matched.
11:20 piojo jnthn: I know, that may be what's making the test case hard. But I really think there's a rakudo bug here.
11:21 piojo I can make the grammar work by changing little details. That's easy. But proving there's a bug is what's hard.
11:24 Geth ¦ doc: 4a6382c607 | (Dan Zwell)++ (committed by Moritz Lenz) | doc/Language/mop.pod6
11:24 Geth ¦ doc: Make the meta-object protocol also searchable as "Introspection".
11:24 Geth ¦ doc: review: https://github.com/perl6/doc/commit/4a6382c607
11:29 Cabanossi joined #perl6
11:37 leont Meh, it seems a callframe doesn't allow looking up dynamic variables easily
11:39 moritz you might have to go through CALLERS:: or so for that
11:40 leont Well, I'd want that relative to that callframe, which is where it gets complicated
11:40 leont I think it's easier to solve my problem in another way
11:41 moritz what problem are you trying to solve?
11:51 leont I'm writing a Test::Builder, I'm experimenting with $*TODO semantics
11:53 zakame joined #perl6
11:59 mr-foobar joined #perl6
12:04 espadrine joined #perl6
12:30 piojo I just posted my troubling grammar to stackoverflow--this may be a bug in the grammar engine
12:30 piojo but I'm always happy to hear how I'm wrong ;)
12:30 piojo https://stackoverflow.com/questions/46130716/is-this-perl6-grammar-broken-or-is-in-exposing-a-bug
12:30 kaare__ joined #perl6
12:33 timotimo piojo: did you get latest rakudo where Nil is no longer wrongly set in $/.made?
12:34 rindolf joined #perl6
12:34 Ven`` joined #perl6
12:34 timotimo putting a { } in your code causes the match object to be populated, including $0, $1, $2, ... and the named captures
12:34 piojo timotimo: I compiled last night, and I'm not using actions or .made
12:35 timotimo OK, was just a hunch because it said Nil there
12:35 piojo timotimo: that explains it! but why is that?
12:35 piojo I do need $<array-name> to be populated for this code to work
12:35 timotimo right, then you need to put a {} in there
12:35 timotimo this may need better docs or something
12:35 piojo why is that? seems like a nasty workaround
12:36 timotimo because otherwise performance would be ridiculously bad
12:36 timotimo we could probably figure out you're refering to a part of the match object there, not sure
12:36 piojo I see. And otherwise the variables are populated when each matcher starts?
12:37 timotimo i think they will be when a match succeeds
12:37 domidumont joined #perl6
12:37 piojo that should have already happened in this example
12:38 timotimo no, i mean the full match
12:38 piojo you mean per scope?
12:38 timotimo the full regex { ... }
12:38 timotimo well, token in this case
12:39 piojo "full" is relative when things are nested, but I think I know what you mean.
12:39 timotimo tbh, i'd factor this differently, with a keyed-array and keyed-array-tail token where keyed-array calls keyed-array-tail with the information it got
12:39 timotimo that saves you from having to re-populate the match object for every single line
12:39 timotimo every regex
12:39 timotimo every regex { } gets its own $/
12:40 timotimo that's the part that matters here
12:40 piojo that change sounds reasonable. But I was more interested in figuring out the problem than refactoring it, so I stopped trying to make it nicer after I encountered the error
12:40 piojo since I might accidentally make the error go away. We programmers are a perverse bunch :)
12:42 piojo timotimo: oh, that makes so much sense. then $/ will never invisibly "update" in the middle of a matcher
12:42 timotimo the regexes page in the docs doesn't seem to cover using $0 and friends inside the same regex you're matching them at all
12:42 timotimo let's see if there's a ticket for it
12:43 piojo I could take a stab at adding that info--
12:43 piojo although nervous about writing docs for things I just learned 5 minutes ago.
12:43 * timotimo opens an issue
12:44 piojo thanks!
12:46 timotimo the spec test suite should have some good bits to learn from, let me have a look-see
12:48 piojo timotimo: that sounds helpful. All the examples I could find online were too simple to be good guidance for yaml parsing, except a very few
12:50 timotimo tbh, yaml is a scary, scary thing
12:51 timotimo i have a single mention in S05-match/capturing-contexts.t
12:52 timotimo m: say "heyhey" ~~ / (.+) $0 /;
12:52 camelia rakudo-moar 2762bc: OUTPUT: «「heyhey」␤ 0 => 「hey」␤»
12:52 timotimo hm.
12:52 timotimo that just works™, probably because we're not using $/ in any kind of calling or code context
12:52 timotimo since you can have whatever code you want inside <foo(here)>
12:53 timotimo a whole lot more regex tests are in nqp's test suite
12:53 lucs joined #perl6
12:53 timotimo so maybe we'll have to look there
12:55 timotimo really. there's two lines with a "backreference" description in the qregex tests
12:55 timotimo and another two for the perl5 compatible regex
12:55 piojo I don't need to parse all of YAML, just what Unity3D uses. And it's mostly done
12:56 piojo and I can't use a library since it doesn't seem to be valid YAML1.1. Also because I want to save extra info to output it in exactly the same format (i.e., an inline array is never transformed into another type of array)
13:00 timotimo right
13:01 tinita piojo: do you have an example yaml that Unity3D uses that you think is not valid? would be interesting for the yaml-test-suite
13:01 timotimo heyo tinita
13:02 tinita hi timotimo
13:02 timotimo i used your yaml grant application document as inspiration for my upcoming application
13:02 tinita cool =)
13:02 tinita what do you wanna do?
13:02 timotimo tools for users of rakudo-moar that help figure out performance issues
13:03 piojo ‎tinita‎: every parse library I tried fails. The python crowd complains of the same problem, based on internet search results. Someone said the files are actually yaml 1.0, but I'm not sure
13:03 timotimo https://docs.google.com/document/d/102h_Nlpq4ED-PpJVfy7kggp5LYmpORhsB3E1eeZ3yfI/edit?usp=sharing - has the details
13:03 tinita timotimo: i hope it works, good luck =)
13:03 piojo so I don't think it could be incorporated in the test suite, since it actually should fail.
13:04 timotimo thanks!
13:04 tinita piojo: would still be interesting to see
13:04 timotimo i have the hardest part ahead of me: figuring out a preliminary schedule and what amount of money i'd ask for
13:05 piojo tinita: just a minute while I find one that isn't from work...
13:10 tinita timotimo: yeah, the amount of money gave me a headache too
13:12 piojo joined #perl6
13:12 tinita i estimated the hours and thought of an amount. the resulting hourly rate is about 1.5 times of the minimum wage
13:12 tinita (and i know already that the hour estimation is too low ;-)
13:13 Rawriful joined #perl6
13:14 Cabanossi joined #perl6
13:18 moritz it always is :-)
13:21 piojo tinita: here's a yaml doc that doesn't work: https://pastebin.com/K2DWwntw
13:22 piojo I think it's either because it has multiple streams per file, or because the alias defined at the top is used multiple times. But I'm just parroting what I read. I don't actually know YAML very well
13:27 leont joined #perl6
13:28 tinita piojo: i think the %TAG directive must be added for all documents
13:28 tinita a tag directive is only applied to the next document
13:29 tinita so yes, it's invalid unfortunately
13:30 piojo tinita: I don't mind. Just one more problem for which no tools exist. So it's time to make tools.
13:31 tinita i think they should fix their YAML
13:31 piojo Haha, just like they should allow nested assets (each saved as a file on disk)
13:32 tinita i could imagine writing a loader/parser that allows fiddling with it
13:33 tinita inserting a tag directive during parsing
13:33 piojo that seems a little too special-cased, though
13:34 piojo and we also don't know whether unity3d can *read* all the valid YAML syntax
13:34 tinita well, at least i aim for an API that allows such kind of things in general
13:34 timotimo tinita: i'd rather estimate too many hours and if i'm finished before the hours run out i just add "stretch goals"
13:34 tinita in yamlpp p5 at least for now
13:34 piojo so using a parser to read/write wouldn't necessarly produce the desired result
13:35 * tinita needs food &
13:38 tinita piojo: java snakeyaml and yaml-cpp can handle it
13:38 tinita so far the only two of 16 frameworks i tested
13:38 piojo holy cow, you're serious about yaml!
13:39 tinita =)
13:39 tinita i'm contributing to https://github.com/yaml/yaml-editor, https://github.com/yaml/yaml-test-suite and i wrote the text matrix:
13:39 piojo I'd still like to make something that can handle it in perl (preferably perl6), so people can write tools to batch-modify game projects
13:39 tinita piojo: http://matrix.yaml.io/
13:40 timotimo piojo: i never gave you the link to the issue: https://github.com/perl6/doc/issues/1545
13:40 tinita piojo: so your test case is definitely worth adding to the test suite as an invalid test, thanks
13:40 piojo tinita: wow, that is pretty!
13:40 tinita thanks
13:41 tinita leont's yamlish is to be added soon
13:42 leont :-)
13:43 leont I'm planning to add en event-stream output for those tests
13:44 mr-fooba_ joined #perl6
13:44 piojo timotimo: thanks, I adde a comment
13:45 piojo leont: I just downloaded yamlish--I think I'll learn a lot from reading that
13:46 leont Recent rakudo broke its tests, fix will be released soon but I was in the middle of a major refactor (that was needed to be able to add for example event-streams)
13:46 mr-foobar joined #perl6
13:48 piojo leont: I watched a video of your talk, and you really convinced me I should only parse the subset of YAML that's necessary, since it's a beast
13:48 piojo (but it looks so simple to a casual observer!)
13:49 tinita exactly
13:49 tinita we hope that we can release a 1.3 spec that makes some things easier
13:50 timotimo leont: that was already fixed if you mean the Nil/Any thing
13:50 leont :-)
13:51 leont Then I need to build a new rakudo
13:56 timotimo m: "hellohello" ~~ / $<first>=.+ $<first> /
13:56 camelia rakudo-moar 4de858: ( no output )
13:56 timotimo m: say "hellohello" ~~ / $<first>=.+ $<first> /
13:56 camelia rakudo-moar 4de858: OUTPUT: «「hellohello」␤ first => 「hello」␤»
13:59 piojo m: my regex word { \w+ }; say 'hellohello' ~~ /<word> $<word>/
13:59 camelia rakudo-moar 4de858: OUTPUT: «「hellohello」␤ word => 「hello」␤»
14:00 piojo so it works except when I want it to work!
14:01 piojo timotimo: that is really what my test case was doing, except it's fine in this context, for some reason.
14:01 timotimo m: "hellohello" ~~ / (.+) { say $/ } o /
14:01 camelia rakudo-moar 4de858: OUTPUT: «「hellohello」␤ 0 => 「hellohello」␤「hellohell」␤ 0 => 「hellohell」␤»
14:01 timotimo m: "hellohello" ~~ / (.+?) { say $/ } o /
14:01 camelia rakudo-moar 4de858: OUTPUT: «「h」␤ 0 => 「h」␤「he」␤ 0 => 「he」␤「hel」␤ 0 => 「hel」␤「hell」␤ 0 => 「hell」␤»
14:01 timotimo m: "hellohello" ~~ / (.+?) <&say($/)> o /
14:01 camelia rakudo-moar 4de858: OUTPUT: «「h」Nil␤P6opaque: no such attribute '$!pos' in type Match when trying to get a value␤  in block <unit> at <tmp> line 1␤␤»
14:02 timotimo oops
14:02 timotimo of course
14:02 timotimo m: my regex sayit($foo) { <?> { say $foo } }; "hellohello" ~~ / (.+?) <&sayit($/)> o /
14:02 camelia rakudo-moar 4de858: OUTPUT: «Nil␤Too few positionals passed; expected 2 arguments but got 1␤  in regex sayit at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
14:02 timotimo m: my regex sayit($foo) { <?> { say $foo } }; "hellohello" ~~ / (.+?) <sayit($/)> o /
14:02 camelia rakudo-moar 4de858: OUTPUT: «Nil␤Too few positionals passed; expected 2 arguments but got 1␤  in regex sayit at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
14:03 timotimo huh.
14:03 piojo It seems like parameters aren't fully implemented
14:03 timotimo m: sub sayit($/, $foo) { <?> { say $foo }; $/ }; "hellohello" ~~ / (.+?) <&sayit($/)> o /
14:03 camelia rakudo-moar 4de858: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Unexpected block in infix position (missing statement control word before the expression?)␤at <tmp>:1␤------> 3sub sayit($/, $foo) { <?>7⏏5 { say $foo }; $/ }; "hellohello" ~~ / (␤    expecting…»
14:03 timotimo m: sub sayit($/, $foo) { say $foo; $/ }; "hellohello" ~~ / (.+?) <&sayit($/)> o /
14:03 camelia rakudo-moar 4de858: OUTPUT: «Nil␤P6opaque: no such attribute '$!pos' in type Match when trying to get a value␤  in block <unit> at <tmp> line 1␤␤»
14:04 timotimo no, i'm just doing it wrong
14:04 timotimo i haven't used this in a long time and i didn't look at the docs :P
14:04 piojo oh. I can't see the error in the "huh" one
14:05 piojo oh, I forgot named regexes aren't the same as match rules
14:05 piojo I also don't know the right syntax. I don't use them that way.
14:10 piojo timotimo: I don't think the syntax is wrong. The unset variable isn't being counted as a parameter
14:11 piojo m: my regex repeated($x) { [$x]+ }; say 'ooxoo' ~~ / ^ <repeated('o')> . <repeated($<repeated>)> $ /
14:11 camelia rakudo-moar 4de858: OUTPUT: «Too few positionals passed; expected 2 arguments but got 1␤  in regex repeated at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
14:11 piojo m: my regex repeated($x) { [$x]+ }; say 'ooxoo' ~~ / ^ <repeated('o')> . {} <repeated($<repeated>)> $ /
14:11 camelia rakudo-moar 4de858: OUTPUT: «「ooxoo」␤ repeated => 「oo」␤ repeated => 「oo」␤»
14:11 piojo so named matches are only not being set when they have a parameter.
14:11 piojo since this works:
14:12 piojo m: my regex word { \w+ }; say 'hellohello' ~~ /<word> $<word>/
14:12 camelia rakudo-moar 4de858: OUTPUT: «「hellohello」␤ word => 「hello」␤»
14:13 pecastro joined #perl6
14:15 piojo m: my regex repeated($x) { [$x]+ }; say 'ooxoo' ~~ / ^ <repeated=repeated('o')> . <repeated($<repeated>)> $ /
14:15 camelia rakudo-moar 4de858: OUTPUT: «Too few positionals passed; expected 2 arguments but got 1␤  in regex repeated at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
14:16 yht joined #perl6
14:16 piojo m: my regex repeated($x) { [$x]+ }; say 'ooxoo' ~~ / ^ $<repeated>=repeated('o')> . <repeated($<repeated>)> $ /
14:16 camelia rakudo-moar 4de858: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in metachar:sym<( )>; couldn't find final ')'␤at <tmp>:1␤------> 3peated('o')> . <repeated($<repeated>)> $7⏏5 /␤    expecting any of:␤        infix stopper␤»
14:17 piojo m: my regex repeated($x) { [$x]+ }; say 'ooxoo' ~~ / ^ $<repeated>=<repeated('o')> . <repeated($<repeated>)> $ /
14:17 camelia rakudo-moar 4de858: OUTPUT: «Too few positionals passed; expected 2 arguments but got 1␤  in regex repeated at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
14:21 skids joined #perl6
14:25 timotimo it'd be unusual if a function call without a | would have a different number of arguments than what you wrote
14:29 piojo timotimo: I verified what you wrote in the bug report--it's not about parameters, it's about being used in a code context
14:29 Cabanossi joined #perl6
14:29 piojo (maybe it's about being used *as* a parameter, but not about the first match having parameters)
14:34 mr-fooba_ joined #perl6
14:37 piojo Time for food. Lovely and educational talking to you all!
14:53 khw joined #perl6
14:56 leont Imagine I have a module Foo with a class Bar, and a module Foo::Baz, in separate compilation units. Is there a way to enable me to refer to Foo::Bar as Bar in Foo::Baz?
14:56 leont s/module Foo::Baz/class Foo::Baz/
15:06 DerAlex joined #perl6
15:11 TreyHarris joined #perl6
15:16 lancew joined #perl6
15:31 setty1 joined #perl6
15:31 mr-foobar joined #perl6
15:38 tinita hm, too bad
15:39 tinita i found a simple way to make YAML::PP accept the YAML provided by piojo
15:39 tinita http://perlpunks.de/paste/show/59b40ae8.532.1e9
15:47 robertle joined #perl6
15:50 ChoHag joined #perl6
15:55 zakharyas joined #perl6
15:59 Cabanossi joined #perl6
15:59 kaare__ joined #perl6
16:04 kaare__ joined #perl6
16:06 zakame joined #perl6
16:10 xinming joined #perl6
16:11 ugexe you could probably do something like
16:11 ugexe m: constant Foo := ::("IO::Path"); say Foo.^name; say Foo.new($*CWD)
16:11 camelia rakudo-moar 4de858: OUTPUT: «IO::Path␤IO::Path is disallowed in restricted setting␤  in sub restricted at src/RESTRICTED.setting line 1␤  in method new at src/RESTRICTED.setting line 32␤  in block <unit> at <tmp> line 1␤␤»
16:12 pilne joined #perl6
16:17 galx joined #perl6
16:18 galx i have an array with length 2100
16:18 galx when i run for @my_array_name -> $iter { ... }
16:18 galx for loop works, but in ~20 times it stops!
16:19 galx what's it?
16:19 ugexe whatever ... is
16:20 galx $iter = $iter.trim; my $parsed = lozv_segment.parse($iter); say $parsed;
16:20 galx three lines
16:21 ShalokShalom joined #perl6
16:22 AlexDaniel what is lozv_segment ?
16:22 galx a grammar
16:23 galx https://pastebin.com/p0bJ65pL
16:23 ugexe does it freeze on the .parse() or the say?
16:24 Khisanth joined #perl6
16:24 galx on the say
16:25 AlexDaniel so without “say $parsed” it works fine? :o
16:25 galx no
16:26 galx but the last command it executes in the last loop "time" is `say`
16:27 galx it also does freeze without `say`
16:28 ugexe hmm let me see if i can repro
16:29 [Coke] http://news.perlfoundation.org/2017/09/call-for-grant-proposals-septe-1.html
16:29 galx the whole code https://pastebin.com/Mv9qZyxK
16:30 ugexe thanks
16:30 ugexe ah i need the data too
16:30 galx yes, i'm uploading it already
16:31 wamba joined #perl6
16:31 galx here it is https://pastebin.com/R8egnwLf
16:31 galx the log file is empty
16:35 mr-foobar joined #perl6
16:38 ugexe ok, i see similar behavior at first try
16:39 ugexe always 7 for me though
16:39 galx for me too
16:39 galx i was wrong, not 20, but 7
16:40 ugexe seems to be certain lines
16:41 ugexe if i skip lines 5-10 it does a few additionals ones until getting stuck again
16:41 ugexe lets see what Grammar::Tracer shows...
16:44 galx there are lots of fails
16:45 ugexe it looks like it might be getting stuck in an infinite parse cycle
16:45 galx ok, so the grammar should be fixed?
16:47 ugexe i think so. you could probably isolate the first line that causes it to freeze, and then just try to parse that line with Grammar::Tracer
16:47 ugexe probably a * that needs to be a + or something
16:48 galx ok, i'll try. thank you!
16:49 ugexe galx: actually s/regex/token/
16:49 ugexe i dunno if that breaks your results, but it gets around the infinite backtracking
16:54 wamba joined #perl6
16:59 Cabanossi joined #perl6
17:05 mr-foobar joined #perl6
17:06 domidumont joined #perl6
17:11 sftp joined #perl6
17:11 pecastro joined #perl6
17:19 scovit joined #perl6
17:19 Geth ¦ doc: 1a74aea21f | (Will "Coke" Coleda)++ | t/pod-valid.t
17:19 Geth ¦ doc: Die on pod warnings also.
17:19 Geth ¦ doc:
17:19 Geth ¦ doc: Helps catch errors like C<asdf
17:19 Geth ¦ doc:
17:19 Geth ¦ doc: Fix comment;
17:19 Geth ¦ doc: review: https://github.com/perl6/doc/commit/1a74aea21f
17:19 scovit m: my $addr = uint8; my $addre = uint16; my $addo = uint8; say ($addr.WHERE, $addre.WHERE, $addo.WHERE); # is this a reasonable way to store a type in a number?
17:19 camelia rakudo-moar 4de858: OUTPUT: «(44904872 44904728 44904872)␤»
17:20 scovit is there another way to get unique id to variables?
17:21 scovit can those things move due to GC?
17:22 eliasr joined #perl6
17:24 Skarsnik hm interesting
17:27 timotimo there's the nqp::objectid or what it's called
17:27 timotimo when you call that you'll get an id that won't change
17:27 timotimo it's what we use to make object hashes work properly
17:27 timotimo with mutable objects as keys i mean
17:29 Cabanossi joined #perl6
17:36 mr-foobar joined #perl6
17:37 scovit timotimo thanks
17:37 timotimo piojo_: regarding your stackoverflow question: it'd probably be better for later viewers if the text in the answer and its "update" would be merged into one text describing what's known
17:53 Skarsnik_ joined #perl6
18:04 scovit timotimo: is there a nqp op to get back from the objectid to the actual object?
18:06 telex joined #perl6
18:06 timotimo i don't think so
18:07 mr-foobar joined #perl6
18:10 andrzejku joined #perl6
18:14 scovit Ok, I am a bit struggling trying to do things which are not very useful and should probably be done at another level. So far has been fun but Im afraid I got to a dead end
18:17 scovit was trying to add attributes to an is repr('CPointer'), storing them around the pointer. But I stumble on wanting to store a type object
18:21 Skarsnik hm
18:25 [Coke] m: $*ERR = class :: { method print(*@a) {}}; { my $a; my $a; note "eek"}
18:25 camelia rakudo-moar 4de858: OUTPUT: «Potential difficulties:␤    Redeclaration of symbol '$a'␤    at <tmp>:1␤    ------> 3 { method print(*@a) {}}; { my $a; my $a7⏏5; note "eek"}␤»
18:25 [Coke] ^^ if we can make that not emit anything, it would be more correct, yes?
18:27 leont That reminds me, is there an easy way to get an IO::Handle that's actually backed by a Buf?
18:28 leont (or a Str, but Buf feels more appropriate)
18:28 [Coke] eco: string
18:28 [Coke] (*&^#$ bots.
18:29 [Coke] IO::String, IO::Blob
18:29 Cabanossi joined #perl6
18:29 geekosaur buggable: eco stromh
18:29 buggable geekosaur, Nothing found
18:29 geekosaur bleh
18:29 geekosaur typing what is it
18:29 [Coke] :)
18:29 geekosaur buggable: eco string
18:29 buggable geekosaur, Found 22 results: String::CRC32, MIME::Base64, Text::Levenshtein, IO::String, Form. See https://modules.perl6.org/s/string
18:30 geekosaur buggable: eco blob
18:30 buggable geekosaur, Found 3 results: IO::Blob, NativeHelpers::Blob, MessagePack::Class. See https://modules.perl6.org/s/blob
18:37 pecastro joined #perl6
18:42 mr-foobar joined #perl6
18:43 ggoebel joined #perl6
18:47 galx how to catch infinity grammar parsing loops?
18:47 galx if there some exceptions
18:47 galx *there are
18:48 galx (the previous problem was solved)
18:55 moritz galx: typically an infinite loop in a grammar comes from quantifying something that can match zero chars
18:56 moritz something like token identifier { \w* }; regex other { <identifier>
18:56 moritz erm
18:56 moritz something like token identifier { \w* }; regex other { <identifier>+ }
18:56 moritz identifier here can parse the empty string, and if there is no more identifier to match, it'll do so inifinitely
18:57 moritz Grammar::Tracer (zef install Grammar::Debugger) can help you find the spot
19:00 galx and if it is an exception that isn't worth added to the rules?
19:00 galx *worth add
19:00 moritz if it's not worth dealing, then don't deal with it
19:00 moritz and accept that it might loop infinitely
19:01 moritz but since you are asking right now, it seems to bother you, so maybe you should investigate handling it
19:03 galx but if 99% of cases work correctly, and 1% exceptions stop the loop,  then can I recognize them and ignore them
19:03 galx >
19:03 galx ?
19:03 moritz I'm nost qite sure what you're asking
19:03 moritz if it's a bug worth fixing, fix it
19:03 moritz if not, don't fix it
19:04 galx e.g.: I have a standard string like "A: 1, B: 2". And suddenly I get "*&$^%#*$#JH@#%U&"
19:05 galx And all exceptions are various
19:06 galx ok, it's not a bug. but how to avoid `for` loop stopping when a garbage string makes parsing infinite?
19:06 moritz structure your for-loop to not go infinite
19:06 moritz or validate your input string with a regex before entering the loop
19:07 timotimo scovit: i'm surprised it would even let you have attributes inside an "is repr('CPointer')" because a CPointer repr'd thing doesn't have any body to put attributes into
19:07 lichtkind joined #perl6
19:07 galx >structure your for-loop to not go infinite
19:07 galx how to do it?
19:07 galx timeout is a bad idea IMHO
19:08 scovit timotimo exactly it doesn't
19:08 timotimo right
19:08 timotimo because how would that be possible
19:09 moritz galx: this is all pretty hard to describe because your question is so abstract
19:09 moritz galx: I can answer in equally abstract terms, but I don't know if you will gain anything from it
19:09 scovit timotimo but this make composibility impossile
19:09 timotimo how so?
19:09 scovit a role have attributes
19:09 timotimo yeah
19:10 moritz galx: if well-formed inputs cause your loop to terminate, that means you have some assumptions in your code about how the data looks
19:10 scovit it would be nice to have a repr with a CPointer and also some space for attributes
19:10 scovit of course only accessible from Perl6 and not C
19:10 moritz galx: so as soon as you see those assumptions violated, react appropriately (discard the input, jump out of the loop, throw an exception, whatever)
19:10 timotimo it'll be pretty hard to have that same object come back from a C function
19:11 moritz galx: but that means you have to explore what those assumptions are, because quite often they are implicit
19:11 timotimo what you probably really want is for NativeCall to be able to grab a CPointer field from an object when passing to a native function
19:11 scovit timotimo true, it would be partially accessible from C
19:11 scovit timotimo sure
19:11 scovit but that way is like not using composition
19:11 timotimo but you can just do that in your own library and expose the "nicer" api to your users
19:12 moritz like if you regular input is "A: 1, B: 2", and implicit assumption might be "when I split by a comma, each element contains exactly one colon". You can detect if that's not the case, and jump out of the loop
19:12 scovit timotimo I told you it was not so useful..
19:12 scovit just I was trying to implement it with hacks
19:13 scovit (saturday)
19:14 Cabanossi joined #perl6
19:19 llfourn joined #perl6
19:20 mr-foobar joined #perl6
19:36 mr-foobar joined #perl6
19:39 moritz galx: still around? Was any of what I said above useful to you?
19:48 TEttinger joined #perl6
19:59 Cabanossi joined #perl6
20:09 moritz it appears not :(
20:12 troys joined #perl6
20:17 Exodist joined #perl6
20:18 mr-foobar joined #perl6
20:20 Kyo91_ joined #perl6
20:22 audiatorix joined #perl6
20:23 audiatorix Is there any way to make the second part of a substitution regex ignore leading/trailing whitespace?
20:29 Cabanossi joined #perl6
20:31 timotimo ignore in what way?
20:31 timotimo you mean to have whitespace in the second half without it ending up in the result?
20:31 timotimo sounds like the substitution-assignment-syntax would be nicer in your case
20:32 timotimo m: $_ = "hello how are you"; s[ \w(\w+)\w ] = "($0)"; .say
20:32 camelia rakudo-moar 4de858: OUTPUT: «(ell) how are you␤»
20:32 timotimo m: $_ = "hello how are you"; s:g[ \w(\w+)\w ] = "($0)"; .say
20:32 camelia rakudo-moar 4de858: OUTPUT: «(ell) (o) (r) (o)␤»
20:33 timotimo audiatorix: ^ how does that look?
20:34 audiatorix ahh I didn't know about that
20:34 audiatorix thanks
20:34 timotimo you're welcome :)
20:48 mr-foobar joined #perl6
20:53 moritz http://tomasp.net/blog/2017/design-side-of-pl/
21:13 timotimo uh oh, the call for grant applications has been published
21:14 Cabanossi joined #perl6
21:19 mr-foobar joined #perl6
21:20 mscha joined #perl6
21:21 mscha m: 'my $n = 1000000; my int @a; for 1..$n { @a[$_] = 1 }; say now - BEGIN now;
21:21 camelia rakudo-moar 4de858: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in single quotes; couldn't find final "'"␤at <tmp>:1␤------> 3.$n { @a[$_] = 1 }; say now - BEGIN now;7⏏5<EOL>␤    expecting any of:␤        single quotes␤       …»
21:21 mscha m: 'my $n = 1000000; my int @a[$n+1]; for 1..$n { @a[$_] = 1 }; say now - BEGIN now;
21:21 camelia rakudo-moar 4de858: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in single quotes; couldn't find final "'"␤at <tmp>:1␤------> 3.$n { @a[$_] = 1 }; say now - BEGIN now;7⏏5<EOL>␤    expecting any of:␤        single quotes␤       …»
21:21 mscha m: my $n = 1000000; my int @a; for 1..$n { @a[$_] = 1 }; say now - BEGIN now;
21:21 camelia rakudo-moar 4de858: OUTPUT: «0.6761706␤»
21:21 mscha m: my $n = 1000000; my int @a[$n+1]; for 1..$n { @a[$_] = 1 }; say now - BEGIN now;
21:21 camelia rakudo-moar 4de858: OUTPUT: «7.5491492␤»
21:21 mscha How come shaped arrays are so much slower than dynamic ones?
21:22 mscha The other way around seems more logical.
21:23 Skarsnik benchable6, my $n = 1000000; my int @a[$n+1]; for 1..$n { @a[$_] = 1 };
21:25 AlexDaniel Skarsnik: 7 seconds per run is too much (as it does several runs on each revision)
21:25 Skarsnik I forget to add what release anyways
21:26 AlexDaniel oh
21:26 benchable6 Skarsnik, ¦my: «Cannot find this revision (did you mean “all”?)»
21:27 AlexDaniel bench: 2015.12,HEAD my $n = 50000; my int @a[$n+1]; for 1..$n { @a[$_] = 1 }; say now - BEGIN now;
21:27 benchable6 AlexDaniel, starting to benchmark the 2 given commits
21:27 benchable6 AlexDaniel, benchmarked the given commits, now zooming in on performance differences
21:27 benchable6 AlexDaniel, ¦2015.12: «1.6192» ¦HEAD: «0.5518»
21:27 AlexDaniel bench: releases my $n = 50000; my int @a[$n+1]; for 1..$n { @a[$_] = 1 }; say now - BEGIN now;
21:27 benchable6 AlexDaniel, starting to benchmark the 22 given commits
21:28 AlexDaniel I don't think that shaped arrays became faster, what we're seeing there ↑ is that rakudo got faster in general
21:28 AlexDaniel well, that's my best guess, I can be wrong
21:29 Skarsnik still it's too much
21:29 BenGoldberg joined #perl6
21:29 Skarsnik 10 ten time slower with something supposed to be faster x)
21:30 benchable6 AlexDaniel, benchmarked the given commits, now zooming in on performance differences
21:30 benchable6 AlexDaniel, https://gist.github.com/121a42d5979b0402405654c8f3502806
21:31 AlexDaniel that's a very positive graph nonetheless
21:33 AlexDaniel it seems that a native unshaped array is faster than any other option in this case
21:34 Skarsnik bench: releases my $n = 50000; my int @a; for 1..$n { @a[$_] = 1 }; say now - BEGIN now;
21:34 benchable6 Skarsnik, starting to benchmark the 22 given commits
21:35 benchable6 Skarsnik, benchmarked the given commits, now zooming in on performance differences
21:36 benchable6 Skarsnik, https://gist.github.com/2f57cb9204a4e62406820a82b0e62749
21:36 Skarsnik duh
21:37 Skarsnik that was always faster
21:43 timotimo shaped arrays with multiple dimensions are rather slow still, yeah :(
21:47 mr-foobar joined #perl6
21:48 |oLa| joined #perl6
21:52 Skarsnik there is only one here
22:02 timotimo hmm
22:03 dogbert2 joined #perl6
22:04 zakharyas joined #perl6
22:10 mscha On my PC: my int @a[$n+1]: 7.7s; my int @a: 1.2s; my Int @a[$n+1]: 1.3s; my Int @a: 1.7s.  Weird: shaped is faster with Int, but much slower with int.
22:17 zakharyas joined #perl6
22:29 Cabanossi joined #perl6
22:29 |oLa|1 joined #perl6
22:31 Cabanossi joined #perl6
22:47 Kyo91_ joined #perl6
22:49 mr-foobar joined #perl6
22:50 scovit timotimo: I made it https://gist.github.com/scovit/a061415aa843ed9aa43b39c6c6901490
22:50 scovit .type and .size are like attribute
22:56 zakame joined #perl6
23:10 geekosaur joined #perl6
23:14 Cabanossi joined #perl6
23:17 mr-foobar joined #perl6
23:47 mr-foobar joined #perl6

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

Perl 6 | Reference Documentation | Rakudo