»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
00:03 cschwenz joined, cschwenz left 00:07 headcase left
tbrowder hib 00:23
00:25 entonian joined 00:27 margeas left 00:31 schmause joined 00:32 entonian left 00:34 schmause left 00:47 headcase joined 00:54 headcase_ joined 00:56 aborazmeh joined, aborazmeh left, aborazmeh joined, headcase left 00:59 headcase joined, headcase_ left 01:03 headcase left 01:19 epony left 01:32 piojo_ joined 01:35 headcase joined 01:37 headcase_ joined 01:39 konsolebox left 01:40 headcase left 01:45 rngoodn joined, ilbot3 left 01:49 rngoodn left 01:50 llfourn joined 01:54 rngoodn joined, ilbot3 joined, ChanServ sets mode: +v ilbot3 01:57 maettu left 01:58 mtj_ left, maettu joined, eliasr left 02:00 mtj_ joined 02:04 Cabanossi left, Cabanossi joined, aborazmeh left 02:09 piojo_ left, kyan joined, rngoodn left
kyan Hi! In shell scripts, I often do exception handling like: foo=''; [[ "$foo" == '' ]] && echo "fail" 02:11
kyan just thought of a test 02:12
02:12 geekosaur left 02:14 rngoodn joined
kyan I was going to say, I don't get why ( $argument1 === '' ) && fail "That is an empty string."; didn't fail — it's because I was casting to a number before that, so it was a 0 by that point. Sorry for the bother. 02:20
02:21 geekosaur joined 02:22 geekosaur left 02:28 geekosaur joined
skids .tell Zoffix github.com/skids/perl6-ArithFunctor <== persisiting types aross math without "is Int" or whatnot. 02:40
yoleaux skids: I'll pass your message to Zoffix.
02:52 mr-foobar left 02:56 mr-foobar joined 02:59 noganex_ joined 03:00 geekosaur left 03:01 noganex left 03:02 Cabanossi left 03:04 Cabanossi joined 03:13 geekosaur joined 03:17 wamba joined 03:18 troys_ is now known as troys 03:20 TreyHarris left 03:23 TreyHarris joined 03:30 BenGoldberg left, skids left 03:31 Cabanossi left 03:33 Cabanossi joined 03:34 Deejizzel joined 03:44 kyan left 03:45 wamba left 03:47 skids joined 03:51 zakharyas joined 03:52 AlexDaniel left 04:00 Deejizzel left 04:02 Possum left 04:04 Possum joined 04:06 wamba joined 04:11 skids left 04:12 troys is now known as troys_ 04:19 cdg joined 04:22 mr-foobar left 04:24 cdg left 04:25 headcase_ left 04:28 mr-foobar joined 04:29 headcase joined 04:33 wamba left 04:34 headcase left 04:45 troys_ is now known as troys 04:46 Cabanossi left 04:48 Cabanossi joined 04:49 eythian left, eythian joined 04:53 Ven`` joined, khw left 05:02 Ven`` left
moritz other opinions on github.com/perl6/DBIish/issues/100 would be very welcome 05:21
05:23 mr-foobar left 05:26 wamba joined, mr-foobar joined
[Coke] m: my @a = (5,7,9,10,8,6); say [==] @a.sort(-*).kv.rotor(2)>>.sum 05:27
camelia True
[Coke] m: my @a = (5,7,9,10,6); say [==] @a.sort(-*).kv.rotor(2)>>.sum 05:29
camelia False
[Coke] whee.
05:29 headcase joined 05:34 headcase left 05:39 patrickz joined 05:40 patrickz left 05:41 knobo joined 05:44 troys left 05:45 rngoodn left 05:46 rngoodn joined 05:49 domidumont joined 06:05 rngoodn left 06:08 espadrine joined 06:10 domidumont left 06:11 domidumont joined 06:14 rngoodn joined, andrzejku joined 06:17 rngoodn left, rngoodn joined 06:28 rngoodn left, ufobat joined 06:29 headcase joined 06:31 Cabanossi left 06:33 wamba left, setty1 joined, headcase left, Cabanossi joined 06:34 wamba joined 06:36 rngoodn joined, rngoodn left 06:47 piojo_ joined, piojo left, [particle] left, [particle] joined 06:51 wamba left 06:57 espadrine left, piojo joined 06:58 rngoodn joined 06:59 llfourn left 07:00 Cabanossi left 07:01 piojo_ left 07:03 Cabanossi joined 07:05 jonas1 joined 07:08 knobo left 07:09 wamba joined 07:22 SHODAN left
Geth doc: d3b64823e9 | (Philippe Bruhat (BooK))++ | doc/Language/5to6-perlvar.pod6
Clarify that $*EXECUTABLE-NAME is a Str, and $*EXECUTABLE is an IO::Path
07:22
stmuk grrrr the return of R0b0t1 07:29
yoleaux 20 Sep 2017 23:45Z <japhb> stmuk: In 06fe4c4d2910e8beb4edf30cc5e0cec2673c7165, wouldn't you want to check $jobs instead of TEST_JOBS, since it's broken whether the job count comes from the environment or a command line flag? Or are you leaving --jobs as an escape hatch?
07:29 knobo joined
stmuk .tell japhb I'll fix that shortly .. thanks! 07:30
yoleaux stmuk: I'll pass your message to japhb.
BooK also, run( $*EXECUTABLE, ... ) will only not succeed if changing directories and the path in not in the PATH
m: say $*EXECUTABLE.perl; $*CWD = "/"; run( $*EXECUTABLE, "-e", "say «hello»")
camelia IO::Path.new("./rakudo-m-inst/bin/perl6-m", :SPEC(IO::Spec::Unix), :CWD("/home/camelia"))
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…
BooK nevermind
$ install/bin/perl6 -e 'say $*EXECUTABLE.perl; $*CWD = "/"; run( $*EXECUTABLE, "-e", "say «hello»")'
IO::Path.new("install/bin/perl6", :SPEC(IO::Spec::Unix), :CWD("/home/book/src/perl6/rakudo"))
The spawned command 'install/bin/perl6' exited unsuccessfully (exit code: 1) in block <unit> at -e line 1
works fine with run( $*EXECUTABLE.absolute ) 07:31
07:31 dakkar joined
BooK obviously, it makes sense sometimes to have a relative path and ignore the :CWD, and sometimes not 07:32
07:34 rindolf joined 07:38 rngoodn left 07:39 wamba left 07:41 piojo_ joined 07:42 piojo left
gfldex gist.github.com/ed62484b162e7d7d06...2f42deefb2 07:44
says: Type check failed in binding to parameter '$l'; expected Distance but got Int (15)
where does it get the Int from?
moritz gfldex: you didn't make infix:</> a multi 07:48
gfldex: so it tries to recurse into the same candidate 07:49
and gets a type error
(if you look at the backtrace, you'll see that infix:</> appears twice)
DrForr timotimo: Indeed I would, and even noticed before reading IRC :) 07:59
tyil anyone used the mongodb module for perl 6? 08:03
whenever I try to insert a DateTime.now, it ends up in mongodb as some date very close to the unix epoch
(ISODate("1970-01-18T10:19:40.860Z"))
08:05 domidumont left, domidumont joined 08:08 wamba joined
moritz might be some confusion between seconds and microseconds since epoch 08:09
DrForr What's the equivalent of 'panda installdeps' in the brave new world of zef? 08:10
08:10 leont joined
DrForr (not really new, I know, I'm jst getting back up to speed and fixing broken sh*t) 08:11
08:11 darutoko joined, gargle joined
DrForr This is for Travis - I guess I could find a working module and copy its .travis.yml, I guess I'll do that. 08:12
moritz DrForr: you can simply zef install . 08:13
DrForr: that installs the deps, runs the tests, installs the module under test
DrForr Danke schoen.
moritz github.com/moritz/Math-Model/blob/...travis.yml 08:14
that's what I stole from somewhere, and now use in most of my p6 projects
DrForr Thanks, saved me a click :)
moritz r/savedyouaclick
DrForr I actually delved into reddit for my first time yesterday. Looked... random. Which is fine by me, shambolic seems to be my life this last few weeks. 08:18
Hell, months.
08:18 ChoHag left
DrForr I may also have tgo get one of these ThinkPad Carbons for myself once the money starts to flow back in. 08:19
08:20 cdg joined 08:21 robertle joined 08:23 zakame joined
zakame hello o/ 08:23
08:24 TEttinger left
moritz \o 08:24
08:25 cdg left
zakame hi moritz, just the persons I need :D can I bump a MIME::Base64 release? Gerd from github.com/perl6/Perl6-MIME-Base64/pull/11 wants to make a package for Fedora but needs a tarball for it 08:25
DrForr zakame: Seems like a decent guy, he just did perl6-readline for me. 08:26
zakame DrForr: yeah I noticed on FB :D
DrForr Nod. 08:27
moritz zakame: no objections from me
zakame yay, thanks guys! :D 08:28
moritz zakame: do you need anything (permission-wise or else) to do that?
zakame not that I know of, I have write on the repo I think, I'll let you know 08:29
moritz apart from some permissions, I don't have any special authority over perl6 on github, so you can decide stuff like on your own
zakame gotcha 08:30
gfldex moritz: is that recursive behaviour a ENODOC?
moritz gfldex: no, it's quite obvious
gfldex where is that doced then? 08:31
moritz gfldex: you define an infix:</>. If it's not a multi, it's the only infix:</> visible in that scope
zakame I'll make a release, then try to check on the 2 issues still open for it
moritz this is nothing special to operators; it's the same for all subs 08:32
gfldex that wasn't my question
where in the docs do we tell the reader?
moritz where do we tell the reader what? 08:33
that subs without "multi" aren't multis?
08:34 rindolf left 08:36 rindolf joined
moritz if you think it would have helped you, you can add an explanation to the section on Multiple Dispatch 08:37
gfldex it would have helped me to know that the dispatcher will ignore candidates in any outer scope if there is a non-multi in the given scope 08:42
guess what, nobody ever told me!
moritz then spread the knowledge! :-) 08:43
08:48 lowbro joined, lowbro left, lowbro joined 08:52 Ven`` joined 08:54 mr-foobar left 08:55 ChoHag joined 08:56 mr-foobar joined 09:01 Aaronepower left, Cabanossi left 09:03 Cabanossi joined 09:06 piojo joined, piojo_ left 09:07 leont left 09:09 Aaronepower joined 09:14 gargle left 09:15 margeas joined 09:16 ChoHag left 09:27 ChoHag joined 09:45 eliasr joined 09:46 Cabanossi left 09:48 Cabanossi joined, wamba left 09:51 Aaronepower left, wamba joined 09:57 TimToady left 09:59 TimToady joined
tbrowder o/ #perl6 10:07
DrForr Ahoj. 10:08
teatime Good $greeting-time, $person-name!
tbrowder ref Test: any easy way to test for a non-zero exit code on linux?
teatime like in a shell script? 10:09
10:09 Aaronepower joined
teatime after you execute a command, $? is the exit code. 10:09
tbrowder dies-ok seems to need an exception 10:10
teatime or you can just put it in an if statement; in shell, 0 is true.
ah.
10:10 ChoHag left
jnthn $ ./perl6-m -e 'use Test; dies-ok { run("/bin/false") }' 10:11
ok 1 -
10:11 zakharyas left 10:12 zakharyas joined
tbrowder we can use exit n to tell the system an error, it eoul be nice to have a Test test for that 10:12
s/eoul/would/
10:13 Dunearhp left
teatime tries to figure out why jnthn's example works; it doesn't appear that throws an exception? 10:13
10:13 Aaronepower left
tbrowder jnthn: hm, as teatime says, how does that work? 10:14
10:16 Aaronepower joined, zakharyas left
tbrowder in my code for failures i'm using CATCH and using die then. Shouldn't the die trigger dies-ok? 10:18
jnthn It depends on the return value of run being sunk 10:19
If that doesn't happen inside of the try block then it won't throw an exception inside of there
Can force it with sink run(...)
10:20 domidumont left
tbrowder hm, have to check on use of sink. Thanks jnthn. 10:21
10:22 Aaronepower left
teatime tries to figure out why the examples have '>foo.txt' as the filename instead of 'foo.txt'. docs.perl6.org/routine/run#(IO)_sub_run 10:27
not that it technically affects the examples, but it confused me for a second thinking shell redirection was involved 10:29
jast classic Perl syntax for selecting the open mode 10:30
teatime ah, yeah, it is, but that isn't what's going on there 10:31
BooK Zoffix: rt.perl.org/Public/Bug/Display.html?id=132140 # as promised 10:33
10:47 ChoHag joined
geekosaur it's demonstrating that it created and removed a file whose name contains a shell metacharacter 10:50
teatime ahhh
geekosaur that should probably be mentioned somewhere as the reason for the example
teatime thank you.
11:11 cdg joined 11:16 cdg left 11:34 ChoHag left 11:47 Cabanossi left 11:48 Cabanossi joined 11:49 rindolf left
Geth doc/robertle-perl5-regex-adverb: 71b11fdd7a | (Robert Lemmen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
Document :Perl5 adverb
11:50
doc: robertlemmen++ created pull request #1571:
Document :Perl5 adverb
11:52 ShalokShalom_ joined 11:55 ShalokShalom left 11:58 wamba left 12:04 pmurias joined, rindolf joined 12:06 virtualsue_ joined, virtualsue left, abraxxa joined, abraxxa left 12:07 virtualsue_ is now known as virtualsue, domidumont joined 12:08 virtualsue left 12:11 piojo_ joined 12:12 ram_ joined, piojo left 12:13 ram_ left 12:18 travis-ci joined
travis-ci Doc build passed. Robert Lemmen 'Document :Perl5 adverb' 12:18
travis-ci.org/perl6/doc/builds/278150945 github.com/perl6/doc/commit/71b11fdd7a70
12:18 travis-ci left 12:25 AlexDaniel joined 12:30 vendethiel- joined
zakame hi again o/ how's perl6 on the jvm? I was checking MIME::Base64::Perl's code and saw it unwrap <'a' ..'z'> ranges due to a jvm bug, but its from 2015 12:30
timotimo hm, have there been commits to that repo recently at all? besides maybe updating the META6 file or something? 12:31
Geth doc/robertle-perl5-regex-adverb: 769ff7b1f0 | (Robert Lemmen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
reword to avoid perl5-is-old suggestions
12:32
zakame yep I updated it a while ago for a version bump, it is being packaged for Fedora by someone else 12:35
moritz zakame: rakudo on JVM is in a bit of a sad state, afaict 12:36
zakame i see, I tried building it my rakudobrew but invoking perl6 gives me "java.nio.file.NoSuchFileException: blib/Perl6/BOOTSTRAP.jar" 12:39
12:42 zakharyas joined 12:44 skids joined 12:49 piojo joined
[Coke] how to use [==] @stuff with an arbitrary sub instead of an op? 12:50
timotimo [[&sub]] i'd expect 12:51
since [&sub] is how you turn any sub into an infix operator
Zoffix .
yoleaux 02:40Z <skids> Zoffix: github.com/skids/perl6-ArithFunctor <== persisiting types aross math without "is Int" or whatnot.
[Coke] ok. what about an inline sub right there?
timotimo m: sub test($a, $b) { say "$a test $b" }; [[&test]] 1, 2, 3, 4, 5
camelia Potential difficulties:
Useless use of [[&test]] in sink context
at <tmp>:1
------> 3sub test($a, $b) { say "$a test $b" }; 7⏏5[[&test]] 1, 2, 3, 4, 5
1 test 2
True test 3
True test 4
True test 5
Zoffix skids: but by defining a million of ops, something I uinderstood grondilu wished to avoid.
timotimo hm, or not.
oh, it was correct!
12:51 rgrau joined
timotimo just doesn't like me using it for side-effects :) 12:52
which makes a lot of sense
skids Zoffix: yes, but they can be defined once by that module, and never again no matter how many people use it.
Zoffix [Coke]: can't have whitespace in there, so that pretty much makes inline sub impossible..
timotimo [Coke]: you can still use the .reduce method instead, where you can put an inline sub without trouble
12:53 vendethiel- left
Zoffix skids: is it in the ecosystem? Don't show up on MP6.o 12:53
[Coke] timotimo zoffix thanks.
timotimo doesn't read as nicely of course, though with a "given" you can put the list in the back and the sub in the front
skids No I just wrote the draft last night.
It will be useful to find out where it breaks, because that will point to a few places where maybe we should have coercive params on core functions. 12:54
timotimo m: say .reduce(sub $a, $b { $a + $b }) given <1 2 3 4>
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3say .reduce(sub7⏏5 $a, $b { $a + $b }) given <1 2 3 4>
expecting any of:
new name to be defined
timotimo m: say .reduce(sub :: $a, $b { $a + $b }) given <1 2 3 4>
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3say .reduce(sub ::7⏏5 $a, $b { $a + $b }) given <1 2 3 4>
expecting any of:
new name to be defined
timotimo m: say .reduce(sub :: ($a, $b) { $a + $b }) given <1 2 3 4>
camelia 10
timotimo what is wrong with me right now :)
Zoffix skids: might want to run it by grondilu :) They were the ones making custom numerics 12:55
m: say .reduce({ $^a + $^b }) given <1 2 3 4>
camelia 10
12:56 lizmat left
[Coke] reduce isn't quite the same as [==] though; 12:57
it's doing something slightly different.
timotimo oh, it doesn't necesarily know about chaining
[Coke] (so, good for adding everything together, but not chaining a comparison)
timotimo m: say .reduce(&infix:<==>) given <2 2 2 2 2>
camelia True
timotimo it can, but the op has to be marked chaining, i'd say
moritz but &infix:<==> is chaining 12:58
oh
m: say .reduce(&infix:<==>) given <2 2 2 2 3>
camelia False
moritz m: say [&&] <2 2 2 2>.rotor(2 => -1).map(&[==]) 12:59
camelia True
moritz m: say [&&] <2 2 2 2 3>.rotor(2 => -1).map(&[==])
camelia True
timotimo hm, whoops?
m: say <2 2 2 3>.rotor(2 => -1).map(&[==])
camelia (True True)
moritz it's considering the sublist a single item
timotimo that's not enough
Zoffix m: say [&&] <2 2 2 2 3>.rotor(2 => -1) 13:00
camelia (2 3)
Zoffix m: say [&&] <2 2 2 2 3>.rotor(2 => -1).flat.map(&[==])
camelia False
timotimo well, that just gives you the last true one
moritz m: say <2 2 2 3>.rotor(2 => -1).map({ &[==](|$_)})
camelia (True True False)
moritz m: say [&& ] <2 2 2 3>.rotor(2 => -1).map({ &[==](|$_)})
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say [&& ] <27⏏5 2 2 3>.rotor(2 => -1).map({ &[==](|$_)}
expecting any of:
infix
infix stopper
postfix
statemen…
moritz m: say [&&] <2 2 2 3>.rotor(2 => -1).map({ &[==](|$_)})
camelia False
moritz m: say [&&] <2 2 2 2>.rotor(2 => -1).map({ &[==](|$_)})
camelia True
Zoffix m: say .reduce(&infix:<==>) given <2 2 2 2 1>
camelia False
Zoffix m: say .reduce(&infix:<==>) given <2 2 2 2 1>
camelia False
13:01 ShalokShalom_ is now known as ShalokShalom 13:02 mcmillhj joined
[Coke] m: ?all(<4 6 8 7 5>.sort.rotor(2=>-1).map({$_[0]+1==$_[1]})) 13:04
camelia WARNINGS for <tmp>:
Useless use of "?" in expression "?all(<4 6 8 7 5>.sort.rotor(2=>-1).map({$_[0]+1==$_[1]}))" in sink context (line 1)
[Coke] m: say ?all(<4 6 8 7 5>.sort.rotor(2=>-1).map({$_[0]+1==$_[1]}))
camelia True
moritz loves rotor 13:05
last used in gist.github.com/moritz/8cd941011b5...23fe279e84 13:06
[Coke] usually feels like he's failed if he needs it. :|
moritz in the gist above I think it's a perfectly legitimate use case 13:07
Ven`` I'm mostly thankful I don't have to do it by hand, usually.
o/, #perl6
[Coke] m: [&&] <4 6 8 7 5>.sort.rotor(2=>-1).map({$_[0]+1==$_[1]}) # there, no junctions, at least.
camelia ( no output )
moritz ok, something @border Z=> @borders[1..*] might worked too, but I don't think rotor is wrong in any way there
13:08 cdg joined
Ven`` moritz: that doesn't "go around" though 13:11
moritz Ven``: and for my use case, it shouldn't
Ven`` alright :-) 13:12
13:40 wamba joined, headcase joined
timotimo [Coke]: why not more like .[0] .. .[*-1] eqv @$_ given <4 6 8 7 5>.sort 13:52
m: .[0] .. .[*-1] eqv @$_ given <4 6 8 7 5>.sort
camelia WARNINGS for <tmp>:
Useless use of "eqv" in expression ".. .[*-1] eqv @$_" in sink context (line 1)
timotimo m: say .[0] .. .[*-1] eqv @$_ given <4 6 8 7 5>.sort
camelia False
timotimo ah, yes, range isn't eqv a list
m: say (.[0] .. .[*-1]).List eqv $_.List given <4 6 8 7 5>.sort
camelia False
timotimo m: (say (.[0] .. .[*-1]).List.perl; say $_.List.perl) given <4 6 8 7 5>.sort 13:53
camelia (4, 5, 6, 7, 8)
(IntStr.new(4, "4"), IntStr.new(5, "5"), IntStr.new(6, "6"), IntStr.new(7, "7"), IntStr.new(8, "8"))
Ven`` mh.
timotimo haha
m: say (.[0] .. .[*-1]).List eqv $_.List given (4, 6, 8, 7, 5).sort 13:54
camelia True
timotimo [Coke]: you like that more?
Ven`` :\
13:54 Khisanth left
timotimo oh oh oh oh 13:58
how about this
m: say [==] $_ Z- 1..* given <4 6 8 7 5>.sort 13:59
camelia True
timotimo m: say [==] $_ Z- 1..* given <4 6 8 7 999>.sort
camelia False
timotimo [Coke]: i like this one the best :D
Ven`` Perl 6.
13:59 rindolf left 14:00 headcase left 14:01 rindolf joined
timotimo of course now you can't just .squish to get rid of duplicates 14:02
14:05 headcase joined 14:08 Khisanth joined 14:09 cdg left, cdg joined 14:11 headcase left 14:13 cdg left 14:19 headcase joined 14:32 knobo left 14:33 bdmatatu joined 14:35 rngoodn joined 14:40 rngoodn left, zakame left 14:41 ChoHag joined 14:46 zakharyas left 14:48 Cabanossi left, Cabanossi joined 14:51 lowbro left 14:54 domidumont left 14:56 kyan joined, itaipu joined 14:59 cdg joined
jdv79 timotimo: got it. its just endianness issue. 15:07
timotimo jdv79: huh, we have to manually htons the port number?
well, maybe ntohs 15:08
jdv79 yup
timotimo m(
jdv79 i'll try to code and test it
timotimo thanks!
kyan Hi! What am I doing wrong here? 15:11
p6: grammar EM { token identifier { \d+ } }; sub runParserTest(Str $code, Pair $rule) { say $code; say $rule.WHAT; }; runParserTest("foo(String, String qux?, *)", :rule<identifier>);
camelia Too few positionals passed; expected 2 arguments but got 1
in sub runParserTest at <tmp> line 1
in block <unit> at <tmp> line 1
timotimo kyan: you forgot to mark the $rule parameter as named in the sub declaration 15:13
oh 15:14
you wanted a positional pair, you need to put parenthesis around the pair, or use "rule" => "identifier" (including the quotation marks on the left of the =>)
kyan They should both be positional...
timotimo no, when you pass it like that it's a named argument 15:15
the caller makes that decision, not the callee
it's purely syntactical
timotimo AFK again
kyan Thank you!
kyan not sure why that's named there, probably need to familiarize more with routine call syntax 15:16
perlpilot :foo<blah> and foo => "blah" are considered named args 15:17
teatime that they look like Pair's is entirely intentional 15:18
kyan Oh, so I can also write this like, Str $code, Str :$rule 15:19
(in the routine signature)
b2gills p6: grammar EM { token identifier { \d+ } }; sub runParserTest(Str $code, Pair $rule) { say $code; say $rule.WHAT; }; runParserTest("foo(String, String qux?, *)", (:rule<identifier>));
camelia foo(String, String qux?, *)
(Pair)
b2gills p6: grammar EM { token identifier { \d+ } }; sub runParserTest(Str $code, Str :$rule) { say $code; say $rule.WHAT; }; runParserTest("foo(String, String qux?, *)", :rule<identifier>); 15:20
camelia foo(String, String qux?, *)
(Str)
grondilu m: proto f(Int $) {*}; subset Odd of Int where * % 2; sub g(Odd $x) { f($x) } 15:23
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling f(Int) will never work with declared signature
at <tmp>:1
------> 3Odd of Int where * % 2; sub g(Odd $x) { 7⏏5f($x) }
grondilu ^why?
I'm not calling f(Int), I'm calling f(Odd) 15:24
m: proto f(Int $) {*}; subset Odd of Int where * % 2; multi f(Odd $) { 0 }; sub g(Odd $x) { f($x) } 15:25
camelia ( no output )
grondilu I guess I have to write a candidate for f
15:29 jonas1 left, jonas1 joined 15:30 SHODAN joined 15:35 Ven`` left 15:37 headcase left, headcase joined
kyan Ok, so in this, if I understand correctly, baz() gets called with a single named parameter called "foo" with the value "bar". 15:42
p6: sub baz(Pair $qux) { say $qux.WHAT; }; my Str $foo="bar"; say :$foo.WHAT; baz(:$foo);
camelia (Pair)
Too few positionals passed; expected 1 argument but got 0
in sub baz at <tmp> line 1
in block <unit> at <tmp> line 1
kyan So, that makes me assume Pairs get interpreted as named parameters when passed to subs.
However, this produces a different result: 15:43
p6: sub baz(Pair $qux) { say $qux.WHAT; }; my Str $foo="bar"; my Pair $example=:$foo; say $example.WHAT; baz($example);
camelia (Pair)
(Pair)
kyan Is it only when a Pair is created within the context of a routine call that it is interpreted as named parameters?
grondilu there are rules about that indeed. It's documented in S06 15:44
if you want a Pair not to be interpreted as a named parameter, enclose it with parenthesis
IIRC
b2gills or you can use 'foo' => 'bar' for a positional 15:45
kyan Yeah, that works, I just didn't get why it works (since it would still be the same type)
grondilu see "Named arguments" section in S06
b2gills In this case it is about syntax, not about type 15:46
perlpilot kyan: wrt your "different result", it's a syntactic thing, not a type thing.
15:46 Cabanossi left
kyan Ok. Thanks! 15:46
grondilu: (this? Seems to be what I want. github.com/perl6/roast/blob/master...ameters.t)
grondilu no that the test suite 15:47
I was talking about synopsis
kyan thought the test suite was the current version of the synopses... probably misunderstood something 15:48
grondilu github.com/perl6/specs/blob/master...utines.pod
15:48 piojo left, Cabanossi joined
kyan Ohhhh, ok, for some reason I thought that was obsolete. Thanks! 15:49
perlpilot S06: Named arguments
S06:Named arguments
synopsebot6 Link: design.perl6.org/S06.html#Named_arguments
15:49 piojo joined
grondilu Seems like people prefer the docs in docs.perl6.org lately, but I still rely on the synopsis personally 15:49
kyan Oh, it says "Note: these documents may be out of date". That's why I had that impression 15:50
perlpilot grondilu: heh, me too! They seem to have more information
grondilu (they are just easier to read on the console)
15:50 wamba left
[Coke] wrote a one line "json-tidy" that is "use JSON::Fast; say to-json from-json $*ARGFILES.slurp;" \o/ 15:51
(which will be super useful dealing with the rancher CLI) 15:52
perlpilot [Coke]: I tend to use jq for tidying. Plus it's quite useful if you have wade through large json data or transform it into other json data 15:54
kyan Huh, this is weird. Grammar::Tracer doesn't seem to do anything unless it's included at the beginning of my script, so I can't conditionally include it when a test fails
perlpilot kyan: It modifies the way the grammar is built, so yeah. 15:55
15:55 mr-foobar left
ugexe you could capture the output (assuming nothing else gets output but the debug info while parsing), and output what you captured conditionally 15:56
15:57 mr-foobar joined
kyan Ooh, that's a good idea. 15:57
Thanks!
ugexe IO::Capture::Simple is a module that can capture output
16:00 headcase left 16:01 nadim joined, robertle left, headcase joined
skids grondilu: If you want to compare your Int-bending endeavors to the way you specifically said you didn't want to do things, I drafted up github.com/skids/perl6-ArithFunctor last night. 16:01
16:02 mcmillhj left 16:03 mcmillhj joined 16:07 khw joined 16:12 mcmillhj left 16:20 mcmillhj joined
Zoffix m: -> Pair $p { dd $p }( :foo<bar>.Pair ) # also works, if you want to make distinction more obvious 16:20
camelia :foo("bar")
kyan Erm, I have another question... 16:24
p6: use IO::Capture::Simple; sub a() { if ( capture_stdout { return True; }; ) { say "Hi!"; }; }; a; # should print Hi!
camelia ===SORRY!===
Could not find IO::Capture::Simple at line 1 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-1/share/perl6/site
/home/camelia/rakudo-m-inst-1/share/perl6/vendor
/home/camelia/rakudo-m-inst-1/share/perl6
C…
kyan ...oh. Well, anyway, it prints "True" instead of "Hi!". 16:25
16:26 mcmillhj left
Zoffix That module's code looks rather wrong. It only ever implements .print method so it'll fail to capture a lots of things 16:27
timotimo it's rather old, isn't it ...
Zoffix kyan: that line of code doesn't print anything for me...
timotimo perhaps kyan ran it in the repl? 16:28
Zoffix Yeah, it's from Oct, 2016. So it was last updated before 2 major IO refactors and assumes too much about IO::Handle implementation.
kyan Ah, I just discovered something:
p6: sub a() { if ( { return True; } ) { say "Hi!"; }; }; a(); # should print Hi!
camelia Hi!
Zoffix I'd expect it not to print Hi 16:29
16:29 piojo left, dakkar left, piojo joined
Zoffix Ah, never mind, it doesn't run the block with return at all 16:29
kyan p6: sub a() { if ( { return False; } ) { say "Hi!"; }; }; a(); # should print nothing 16:30
camelia Hi!
kyan That one prints Hi! too. Weird.
I definitely don't understand something here
16:30 DerAlex joined
timotimo m: say so { say "hi" } 16:31
camelia True
Zoffix kyan: you're not executing the block with return, so it's just treated as a noud and it's always true
timotimo yup
Zoffix kyan: and even if it did execute, `return` returns from routines, not blocks, so it'd return from your sub
kyan Oh, I see.
Zoffix s/noud/noun/;
teatime dang, thought for sure I was about to learn another obscure perldev term/acronym. 16:32
Zoffix :)
kyan What's the right way to make a block exit with a failing status?
16:32 mcmillhj joined, Cabanossi left
kyan had already googled "noud perl6" 16:32
teatime me too.
Zoffix lol
timotimo we can totally coin that for something useful 16:33
newcomers will love it
16:33 Cabanossi joined
Zoffix kyan: it'd just need to be the last statement. I think there's a plan to implement `leave` or something or other, but it's not done yet. 16:33
kyan: or you could use just a sub instead. 16:34
16:34 headcase left
Zoffix Also, you don't need parentheses around if's condition 16:34
p6: sub a { if sub { return True; }() { say "Hi!" } }; a;
camelia Hi!
Zoffix p6: sub a { if sub { return False; }() { say "Hi!" } }; a;
camelia ( no output )
16:34 headcase joined
kyan Ah, I see. Thanks! 16:34
kyan is used to Bash, where: if (exit 1); then echo "Hi"; fi # prints nothing 16:35
16:37 mcmillhj left
Zoffix kyan: but going to your IO::Capture code. The code block you give to capture_stdout is meant to be the code that contains all the things you want to capture and its return value is ignored. So instead of `return True` you need something like `print "meows"` inside. And the routine returns the captured string, so your `if` will say "Hi" only if the block given to capture_stdout prints something 16:37
16:38 AlexDaniel left
Zoffix kyan: and as I've said, it only captures .print method of IO::Handle, not a handful of other methods that can also generate output. There's IO::MiddleMan that captures all of them (I think), but it's too a bit out of date. The Right Method™ would be to override just the special methods but they're not yet part of the language and their names are contentious and might change 16:39
buggable: eco middleman
buggable Zoffix, IO::MiddleMan 'hijack, capture, or mute writes to an IO::Handle': github.com/zoffixznet/perl6-IO-MiddleMan
Zoffix kyan: but.... IO::Capture::Simple will crash if a method it doesn't capture is called, so at least you have a reliable and known failure mode. 16:40
$ perl6 -e 'use IO::Capture::Simple; sub a() { if ( capture_stdout { $*OUT.say: "meow" }; ) { say "Hi!"; }; }; a;'
Cannot resolve caller say(<anon|32822880>: Str); none of these signatures match:
16:40 headcase left
kyan Interesting. Thanks. 16:40
16:41 hankache joined
Zoffix $ perl6 -e 'use IO::Capture::Simple; sub a { if capture_stdout { say "meow" } { say "Hi! I captured $^captured_stuff" } }; a;' 16:41
Hi! I captured meow
kyan Strangely, use IO::Capture::Simple; sub a { if sub { capture_stdout { return True; }; }() { say "Hi!" }; }; a; # prints Hi!
16:41 |oLa| joined
kyan use IO::Capture::Simple; sub a { if sub { capture_stdout { return False; }; }() { say "Hi!" }; }; a; # prints () 16:41
This conditional actually does what I want 16:44
if sub { ! capture_stdout { if ! ( EM.parse($code, :$rule) ) { return False; }; else { return True; }; }; }() {
16:44 Aaronepower joined
kyan I can't say as I'm sure *why* it works, but it does. 16:44
Thanks! 16:45
16:45 grumble left, mcmillhj joined
Zoffix kyan: looks like there's a bug... 16:45
m: sub foo (&code) { code }; foo {return True}
camelia Attempt to return outside of any Routine
in block <unit> at <tmp> line 1
Zoffix The control exception gets thrown from where the code is at, rather than where it's called. 16:46
bisect: sub foo (&code) { dd "Got code"; code }; foo(-> {return True})
bisectable6 Zoffix, On both starting points (old=2015.12 new=045ef44) the exit code is 1 and the output is identical as well
Zoffix, Output on both points: «"Got code"␤Attempt to return outside of any Routine␤ in block <unit> at /tmp/xJdjY9Vub7 line 1␤»
16:47 grumble joined
jnthn return is lexical 16:47
Zoffix kyan: that code doesn't work. It relies on a bug. As I've said, capture_stdout ignores the return value of its block. It returns the captured string 16:48
jnthn So being in dynamic scope ain't enough
Zoffix s/bug/feature/;
kyan Right. I've got a program that does what I want at the moment, though.... 16:49
github.com/ethus3h/ember-informati.../em.p6#L35
output: gist.github.com/ethus3h/1317b46fdc...161a4a3338
that's likely to break, once the bug is fixed? 16:50
Zoffix kyan: sounds all you want is not capture anything, but rather silence output while the method runs.
kyan Zoffix: yup
Zoffix kyan: ther's no bug. jnthn++ clarified that return is lexical.
16:50 mcmillhj left
kyan Oh. Ok. I guess I don't understand exactly (probably I just lack the requisite programming chops), but yay, thanks! 16:51
16:51 jferrero left 16:52 hankache left, stmuk left
kyan Oh, I see! It's because the returns are returning from the enclosing sub, rather than from the brace-enclosed argument to capture_stdout. 16:52
16:52 Aaronepower left
Zoffix kyan: you don't need a module at all: sub noisy { "meow".say; True }; sub silenced (&code) { temp $*OUT = class { method print ($) {} }; code }; say silenced { noisy } 16:52
kyan Iiiinteresting. Thanks!
Zoffix m: sub noisy { "meow".say; 42 }; sub silenced (&code) { temp $*OUT = class { method print ($) {} }; code }; say silenced { noisy }
camelia 42
kyan Cool, thanks! 16:53
16:54 mr-foobar left
kyan Cool, thanks! 16:55
...oops. Was trying to rerun the last command in the terminal. Got IRC instead. 16:56
Zoffix :)
kyan Sorry. Anyway, the silenced sub works great, and is much more elegant. Thanks! :)
Zoffix Any time.
16:57 nadim left 16:58 preaction left, domidumont joined, mr-foobar joined
tbrowder ref ecosystem: i have a new module ready that generates a rudimentary man page from data in the META6.json file. On *NIX machines it would be nice if zef could create and install the man page (assuming there is not another one in, say, the man dir of the module source). 16:59
17:00 domidumont left 17:01 domidumont joined 17:02 leont joined
Zoffix huggable: silence output :is: A sub to silence output: sub run-silenced (&code) { temp $*OUT = temp $*ERR = class { BEGIN { ::?CLASS.^add_method: $_, my method (*@) {} for qw/say put print print-nl/ } }.new; code }; say run-silenced { say "meow"; note "moo"; 42 }; say "look"; note "previous code got silenced" 17:02
huggable Zoffix, Added silence output as A sub to silence output: sub run-silenced (&code) { temp $*OUT = temp $*ERR = class { BEGIN { ::?CLASS.^add_method: $_, my method (*@) {} for qw/say put print print-nl/ } }.new; code }; say run-silenced { say "meow"; note "moo"; 42 }; say "look"; note "previous code got silenced"
17:02 Cabanossi left
tbrowder see the generated troff page at this gist: gist.github.com/tbrowder/9daa98b97...ta6-to-man 17:02
Zoffix ^ a more generic silencing sub that'll work on more methods and silnce STDERR too 17:03
17:03 mcmillhj joined, Cabanossi joined
Zoffix Oh wait, missing a couple methods 17:04
tbrowder see the code at github.com/tbrowder/META6-To-Man-Perl6
Zoffix m: sub run-silenced (&code) { temp $*OUT = temp $*ERR = class { BEGIN { ::?CLASS.^add_method: $_, my method (*@) {} for qw/say put print print-nl printf write/ } }.new; code }; say run-silenced { say "meow"; note "moo"; 42 }; say "look"; note "previous code got silenced" 17:05
camelia 42
previous code got silenced
look
17:05 wamba joined
tbrowder not in ecosystem yet but will be soon 17:05
Zoffix Un 6.d will just need to `class { method print-internal (*@) {} }` or whatever the bikeshedded name will be
jnthn write-internal, though note it does bytes :) 17:06
Zoffix Oh right :)
jnthn But of course, then you cover binary writes too :)
jnthn wanders home after all day doing tricky supply guts stuff 17:07
17:10 stmuk joined, piojo left
tbrowder also ref ecosystem: META6 shows only three keys that are required in the specs (name, version, description); seems to me that a module needs some more required keys to be accepted into the ecosystem, so the specs need updating. 17:11
17:14 Rawriful joined, preaction joined, DerAlex left, kyan left 17:19 Aaronepower joined 17:25 Aaronepower left, mr-foobar left, armin joined, mr-foobar joined 17:26 Aaronepower joined 17:27 Aaronepower left 17:28 |oLa| left, Aaronepower joined 17:30 Aaronepower left 17:31 |oLa| joined 17:34 itaipu left 17:36 Aaronepower joined 17:37 headcase joined 17:41 headcase left 17:43 headcase joined 17:46 itaipu joined 17:47 headcase left 17:49 headcase joined 17:53 Aaronepower left, headcase left 17:54 andrzejku_ joined, Aaronepower joined 18:04 |oLa| left 18:10 AlexDaniel joined 18:11 cdg left 18:14 Aaronepower left 18:18 setty1 left, jonas1 left 18:20 jonas1 joined 18:22 rgrau left 18:23 Roab joined 18:24 ken1 joined, mcmillhj left 18:27 troys joined 18:30 |oLa| joined, |oLa| left
Roab m: <foo>.comb.^methods 18:30
camelia ( no output )
18:30 |oLa| joined
Roab m: say <foo>.comb.^methods 18:30
camelia (new new-consumed iterator Capture elems Numeric Int Bool fmt join sink from-loop item hyper race cache lazy flat lazy-if is-lazy Method+{<anon|76960256>}.new Method+{<anon|76960256>}.new Method+{<anon|76960256>}.new Method+{<anon|76960256>}.new Method+{…
Roab what's with the anon things there? 18:31
is it Seq specific magic somehow?
18:31 cpage_ left 18:33 mcmillhj joined
Zoffix m: say <foo>.comb.^methods».name 18:34
camelia (new new-consumed iterator Capture elems Numeric Int Bool fmt join sink from-loop item hyper race cache lazy flat lazy-if is-lazy eager List Slip Array Seq Str Stringy gist perl AT-POS EXISTS-POS skip Bag MixHash Mix Set BagHash list SetHash)
18:35 ken1 is now known as thunktone
Zoffix s: say <foo>.comb, 'eager', \() 18:35
SourceBaby Zoffix, Something's wrong: (f o o)eager\()␤␤ERR: Cannot resolve caller sourcery(Bool); none of these signatures match:␤ ($thing, Str:D $method, Capture $c)␤ ($thing, Str:D $method)␤ (&code)␤ (&code, Capture $c)␤ in block <unit> at -e line 6␤␤
Zoffix s: <foo>.comb, 'eager', \()
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/045e...Seq.pm#L77
18:36 rngoodn joined
Zoffix s: my method {}, 'gist', \() 18:36
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/045e...thod.pm#L4
timotimo Roab: these "anon" thingies in there are roles that have been mixed into the Method object 18:37
Zoffix timotimo: how come they were mixed?
Also where's the name coming from, if Method's .gist is `.name` and `.name` above works fine
Roab is that something comb does? 18:38
timotimo no, just some methods on the Seq class i guess
m: say Seq.^methods
camelia (new new-consumed iterator Capture elems Numeric Int Bool fmt join sink from-loop item hyper race cache lazy flat lazy-if is-lazy Method+{<anon|76960256>}.new Method+{<anon|76960256>}.new Method+{<anon|76960256>}.new Method+{<anon|76960256>}.new Method+{…
timotimo same thing, but without comb
Roab ah so it is Seq magic :) 18:39
Zoffix Oh, it's nodality stuff 18:40
Roab ?
18:40 rngoodn left
Zoffix m: class Foo { method bar {} }.^methods.say 18:41
camelia (bar)
Zoffix m: class Foo { method bar is nodal {} }.^methods.say
camelia (bar)
Zoffix bah
timotimo interesting, why don't we give the trait that gives things nodality a name, shall we
Zoffix timotimo: well, I don't get why it loses it at all
Roab what is nodality about anyway? :)
Zoffix Roab: whether hypered version of the method descends into iterables 18:42
buggable: eco M
buggable Zoffix, Found 661 results: Bailador, p6doc, panda, 007, zef. See modules.perl6.org/s/M
Zoffix Oh, I deleted that module...
18:43 headcase joined
Zoffix m: (^3, [^4], "5")».elems.say; (^3, [^4], "5")».Numeric.say; 18:43
camelia (3 4 1)
((0 1 2) [0 1 2 3] 5)
Zoffix Roab: ^ .Numeric descended into iterables and called .Numeric on elements, while .elems didn't 18:44
One of them is nodal the other isn't (I forget which :))
Roab I'd guess the one that gets inflicted on the nodes :)
so, .Numeric 18:45
I think I get a grasp of that concept now, thank you. still unclear about how that leads to anon methods on Seq tho...
18:46 Aaronepower joined
Zoffix I'm still raking at it, trying to figure it out. I just traced the weird names to having the role from that trait mixed into them 18:46
m: <foo>.comb.^methods[20].^roles[0].^methods.say
camelia (nodal)
Zoffix And its mixed here: github.com/rakudo/rakudo/blob/nom/...#L355-L359
bartolin pmurias: sorry, didn't spot your message yesterday. regarding the JVM backend, it's a combination of too few tuits and having no idea how to fix things. (though more tuits could help with the latter, too)
18:47 cdg joined
Zoffix m: multi sub trait_mod:<is>(Routine:D $r, :$meow!) { $r.^mixin: role { method nodal(--> True) { } } }; class Foo { method bar is meow {} }; Foo.^methods.say 18:48
camelia (bar)
Zoffix Doesn't happen here,s o perhaps it's something else....
m: <foo>.comb.^methods[20].say; <foo>.comb.^methods[20].name.say 18:49
camelia Method+{<anon|76960256>}.new
eager
Zoffix s: <foo>.comb.^methods[20], 'gist', \()
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/045e...thod.pm#L4
Zoffix ^ just calls .name, yet .name returns a correct name. What's going on :/ 18:50
oh
18:50 Aaronepower left
Zoffix Ah :) 18:50
bartolin pmurias: the thing I'm really clueless about is what to do about the evalserver leaking memory. Also, i have no good idea about the new op (nativecallinvoke) -- apart from adding yet another '#?if jvm' conditional ... 18:51
18:51 cdg left
Zoffix No, still don't get it. 18:52
18:54 kyan joined
Roab m: Seq.^roles.say 18:55
camelia ((PositionalBindFailover) (Iterable))
18:55 perlpilot left
kyan Hi! I'm back again, with another question :P In my grammar, I have: token parameterListItem { <parameter> <parameterListSeparator> } 18:56
Zoffix \o 18:57
kyan Then, I run some tests. 1. 'String qux?' matches 'parameter'. 2. ', ' matches 'parameterListSeparator'. 3. 'String qux?, ' does *not* match 'parameterListItem', despite being a simple concatenation of the previous two. Do I misunderstand the token syntax? 18:58
moritz kyan: it might help if you pasted (via gist.github.com or similar) the grammar, including paramater and parameterListSeparator, and the input strings you've tried 18:59
teatime kyan: read up on the difference between token and rule
kyan: since you're using token, it's putting implicit <.ws> in
19:00 headcase left
teatime wait, no, sorry, I have that backwards 19:00
ignore me
moritz kyan: what you have observed can happen if <parameter> on its own matches more than just 'String qux?' (for example if it also matches the comma)
kyan Here's the grammar and tests: github.com/ethus3h/ember-informati...s/p6/em.p6
19:00 headcase joined
kyan Here is the output of that program: gist.github.com/ethus3h/fada06e1b0...694963a3b8 19:00
This doesn't match: runParserTest('String qux?,', 'parameter'); 19:02
Geth doc: 23b693916f | (Brian Duggan)++ | doc/Language/py-nutshell.pod6
Replace =end with =end code in py-nutshell
19:03 ChoHag left
moritz kyan: this is weird. 19:04
19:04 darutoko left, headcase left
kyan Well, it mystifies me, anyway ¯\_(ツ)_/¯ 19:05
Zoffix kyan: FWIW, `$fail === "f"` is better written as `$fail eq "f"` 19:06
19:06 troys is now known as troys_
kyan Zoffix: cool, thx. 19:06
Zoffix kyan: which test fails when it's supposed to succeed? Which line? 19:07
Does it fail without Grammar::Tracer loaded?
moritz it does
Roab kyan, just a thought, maybe Grammar::Debugger or Grammar::Tracer could point something out
ah nvm, sorry.
kyan This is the simplest case that fails: github.com/ethus3h/ember-informati...em.p6#L125 19:08
(you might need to refresh the page — it is: ok runParserTest('String qux?, ', 'parameterListItem');)
Zoffix moritz: which "it"? The runParserTest('String qux?,', 'parameter'); is meant to pass?
moritz kyan: oh, it's simpler than I thought
Zoffix Backtracking
moritz kyan: EM.subparse('String qux?, ', :rule<parameter>)
parses 'String qux' 19:09
but not the trailing question mark
kyan 'String qux?' does match 'parameter', though...
19:09 AlexDaniel left
moritz Zoffix: I was about to turn it into a miniimal test for you, and found the error in the process :-) 19:09
19:10 AlexDaniel joined, geekosaur left
Zoffix moritz: is it tho? 19:10
moritz Zoffix: I'm not sure anymore... 19:11
Zoffix :D
19:11 headcase joined
moritz Zoffix: perlpunks.de/paste/show/59c40ed5.5723.db 19:11
kyan Zoffix: (runParserTest('String qux?,', 'parameter'); shouldn't pass (and doesn't). runParserTest('String qux?, ', 'parameterListItem'); *should* pass, though, but it also doesn't.)
Zoffix If I change all `token` to `regex` all tests I green, so I'm going with my earlier wild guess: backtracking 19:13
Or lack of it, that is
kyan I thought token did longest-possible-match selection? 19:14
or, oh.... I think I see what you're saying... 19:15
moritz it does, but there are limits
Zoffix Well, moritz would know more about this. I don't know how this stuff works :) 19:16
moritz for example it stops at recursion, or at procedural elements
19:16 Aaronepower joined, nadim joined, troys_ is now known as troys
moritz and bugs are possible too :-) 19:16
kyan Ok, so I need to write tokens in such a way that they don't need to backtrack, or else use regex. Thanks all. <3
moritz so, my understanding of the problem is as follows: on its own, if you let token parameter parse the string, it doesn't include the question mark 19:17
19:18 domidumont left
moritz but if you run EM.parse('String qux?', :rule<parameter>); the "parse" essentially anchors it to the end of the string, forcing the | to try a different branch 19:18
kyan I see. I'm surprised the rule for parameter doesn't choose the longest-possible, because between <type> | [ <declaration> \?? ] | <value>, the middle is longest 19:19
moritz but, since it's a token, it won't do that when the regex engine tries to backtrack into it, and fails instead
19:20 headcase left
Zoffix If I make this change, moritz's codesample passes all tests, without requiring `regex`: token parameter { [ <declaration> \?? ] || [ <type> | <value> ] } 19:20
19:20 headcase joined
moritz kyan: I don't see why it takes the shorter path just by eyeballing the grammar 19:22
and I'm too tired to do anything else :-)
one thing I noticed is that there are several cases where you could factor out common prefixes 19:23
Zoffix moritz: you said it stops LTM at recursion?
moritz Zoffix: yes
Zoffix I see <parameter> eventually going for another <parameter> via <declaration> thing
moritz for example in token declaration, you could put <identifier> at the start, and only then start an alternation 19:24
and identifier is <normalIdentifier> |
kyan I tried adding another option there, with the \? required, but it didn't prefer that one. [ <declaration> \? ]
moritz and identifier is <normalIdentifier> | <routineIdentifier>
but <routineIdentifier> is <normalidentifier> and something else after it
so just make it token identifier { <normalIdentifier> <parameterList>? } 19:25
much easier to reason about, and probably also faster
Zoffix parameter -> declaration -> identifier -> routineIdentifier -> parameterList -> parameterListBody -> parameterListFilledBody -> parameter
That's the recursion chain
moritz Zoffix++ 19:26
19:26 geekosaur joined
moritz token simpleBlock { <line>*<finalLine>? } 19:26
19:26 headcase left
moritz a simpleBlock can be an empty string. Is that desired? 19:26
kyan Thank you! That seems sensible. 19:27
moritz token block { [<simpleBlock>\nblock]|<simpleBlock> } # easier as token block { <SimpleBlock> [\n <block>]? }
kyan moritz: I'm not sure, I'm still at the very beginning of this project
moritz kyan: ok, good luck
kyan started really trying to learn Perl 6 yesterday :P
moritz kyan: I'm kinda writing a book about this stuff right now... want to beta-read a few chapters? 19:28
timotimo oh btw, you can always just put "& .+" at the end of your token or whatever to force the match to be at least one character :)
kyan moritz: Oh, that change to block makes a lot of sense
Sure! I'd love to :) 19:29
moritz timotimo: that is... kinda neat and evil :-)
kyan: perlgeek.de/chapter00.pdf that's the table of contents. Pick up to 3 chapters, and tell me your email address (in private message if you want) 19:30
perigrin /w 53 19:31
buggable perigrin, Thank you for entering Accidental /win Lottery! The next draw will happen in 1 week, 2 days, 4 hours, 28 minutes, and 49 seconds
perigrin yay!
I'm a /winner!
Zoffix :)
moritz /lose everything
kyan moritz: Oh, wow, this looks really useful. When's it coming out?
moritz kyan: with a bit of luck at the of the year 19:32
if not, early Q1 2018
jdv79 moritz: is the mb4 thing fully implemented yet?
moritz and on perl6book.com/ you can sign up for a mailing list that informs you when it's out
19:33 perlpilot joined
moritz jdv79: what mb4 thing? 19:33
jdv79 the irc log utf8mb4 stuff
kyan moritz: Sweet, chapters 9 through 11 look like they'd be my top picks to read for what I'm working on — I'm at [email@hidden.address] Thank you! 19:34
perlpilot futura merlin ? 19:35
kyan (No space, but yup.)
perlpilot The space was needed because it was triggering my "futurama" neurons :) 19:36
kyan has a vague impression that that's a television show 19:37
Zoffix science fiction comedy cartoon 19:38
19:40 ChoHag joined, Aaronepower left 19:41 headcase joined 19:43 student joined
Zoffix OK. Finally reproed the wrong-.gist-on-Method object with my own method. 19:51
Zoffix will poke at it more after relocation
student Anyone know anything about the "Learning Pearl 6" book? I saw that it was crowd funded and raised $40k, but was due out at the end of last year. 19:54
Geth doc: f9d994e8ae | (Robert Lemmen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
Document :Perl5 adverb (#1571)
19:55 kyan left, mcmillhj left
moritz student: www.kickstarter.com/projects/14228...-6/updates has some updates 19:55
Zoffix student: it's taking longer than expected. Last update to preview PDF was in august and last updates to changelog mentioned some more recent additions 19:56
moritz student: and perl6book.com/ lists some alternatives :-)
Zoffix student: there are other books available: perl6book.com
19:56 robertle joined
student Thanks for the links. Which book(s) that are currently out would you most highly recommend? 20:00
20:00 bdmatatu left
moritz student: what's your starting point? 20:00
student: do you know other programming languages?
do you know Perl 5?
timotimo the best books are the one moritz wrote :) 20:01
20:01 Cabanossi left
timotimo also the other books are also the best books 20:01
Zoffix student: I heard good things about Think Perl 6 and its digital version is free, so you could give it a go without risk
student I do not know perl 5. I know some common lisp, java, python, and c++ but are not an expert in any. I basically use what I am required to use at school/work, but am constantly trying out "new" languages for one that I will really enjoy using. 20:03
perlpilot student: very cool.
20:03 AlexDaniel left, Cabanossi joined
moritz then Think Perl 6 might bore you a bit 20:03
20:03 AlexDaniel joined
Zoffix It's good :) I found knowing Perl 5 a hindrance when learning 20:04
student moritz: really?
moritz if you like a very example-driven approach, i'd recommend my own book, "Perl 6 Fundamentals". If you prefer a more feature-oriented approach, "Perl 6 Deep Dive"
perlpilot student: yeah TP6 is more like "this is a variable. this is a loop." etc. 20:05
moritz student: it's for absolute beginners. It teaches programming, and uses Perl 6 as a tool. It doesn't aim to teach Perl 6 directly
what's a variable? what's a conditional? what's a scope? What's a string?
student oh wait... I read your comment wrong.... I read "then I think Perl 6 might bore you a bit." .... not "Think Perl 6" as a book title haha 20:06
moritz student: :-)
Zoffix :)
student I will give "Perl 6 Fundamentals" a google and check it out. Thanks for the recommendation. 20:07
20:07 AlexDaniel left
moritz ebook on www.apress.com/us/book/9781484228982 print on amazon 20:07
if you do read it, please give me feedback afterwards :-) 20:08
student will do
20:08 AlexDaniel joined
perlpilot student: another language you might want to try for fun is Haskell. 20:09
20:09 cdg joined
student I have tried haskell... I think 3 times... haha 20:09
moritz tried twice, without much success
though I got to the point where I thought that I invested a good chunk of time, I'd push through 20:10
student Each time I start I think it is the greatest thing on earth and then get really frustrated when I try to make somthing from scratch and can't do something that is so incredibly simple in another language. 20:11
20:11 mcmillhj joined
perlpilot student: well, at least with Perl 6 you'll learn all of the concepts that other languages have to offer, so after P6 the others will be easier ;) 20:11
moritz like, reading lines from a file, doing something to them, and writing them back to another file
perlpilot: except monads and overzealous type cherks :-)
perlpilot he already mentioned that he knows Java, so one of those is already taken care of. 20:14
20:14 TEttinger joined
perlpilot Isn't there a "monads in perl" thing somewhere? Maybe it could be adapted to Perl 6? 20:15
20:15 mcmillhj left
perlpilot moritz: I mean ... you could write a book about it! ;) 20:15
student Why do you think Kotlin, Scala, Crystal, Julia, Go, Rust.... etc are always being talked about and Perl 6 is not... I stubled across perl 6 looking into perl 5, but wouldn't have really known about it if I wasn't so into looking at what was out there and wanting to try everything... 20:16
perlpilot student: they have better marketing? (though I've never heard of Kotlin)
Zoffix student: because the word on the street is "Perl is dead" and "Perl 6" sounds like just another version of it. No one wants to try dead thinga 20:17
moritz student: many factors... for one, they are younger, so they have the inherent coolness factor attached
student: Rust as a very radical approach *and* has huge first user (Service) *and* comes from Mozilla
Go has obvious reasons (Google, and two C programing giants) 20:18
perlpilot yep, and everyone is always talking about goroutines.
moritz many of these languages have one or two selling points
there's a heap corruption somewhere? Rust to the rescue! 20:19
student If I end up likeing perl 6 and want to really dive into it.... are there many job oppertunities or is it too new and mainly used by hobbiests and those developing it?
Zoffix student: also, it was being designed and re-designed for 15 years, with the first release being just 2 years ago. And it was a rocky release, with people being able to properly "use" it for just over a year.... So in that perspective, it's just a baby language
moritz Perl 6 lacks an obvious tagline
Zoffix student: not many jobs; too new
student: note that Perl 6 is the last language you'll learn. Tread lightly. 20:20
:)
student haha
20:22 cdg_ joined 20:23 mcmillhj joined
perlpilot I guess Perl 6's biggest hooks are grammars and the asynchronous stuff. But ... other languages have very similar things too. 20:23
moritz I'm toying with the idea of learning a high-performance language (maybe Julia?) and explore astronomy data analysis 20:24
perlpilot: and Unicode and roles... :-)
Zoffix To me biggest hook is how consice it is.
And yeah, definitely sane Unicode support
perlpilot I'm not sure how much the rest of the world really cares about Unicode. 20:25
20:25 cdg left, vike left
Zoffix huggable: concise 20:26
huggable Zoffix, Rakudo Concise: raw.githubusercontent.com/perl6/ma...300ppi.png
TEttinger examine that sentence, perlpilot
"the rest of the world" as in not USA?
perlpilot moritz: PDL came to Perl 5 for astronomy data analysis. It would be nice if Perl 6 could have performant vectors/matrices/tensors
Zoffix As the poster says it :)
perlpilot TEttinger: as in "not the denizens of #perl6" 20:27
TEttinger well if world means Earth, then yes the rest of the world cares
20:28 mcmillhj left, ufobat left
Zoffix I'd say they care a lot. I see people complain all the time about glitches in Unicode support; problems that don't exist for us 20:28
TEttinger I hit one in Java a few weeks ago
Zoffix like trying to match e with a ' on top of it
20:29 thunktone left
Zoffix has no idea how to type Unicode fancy things on the phone :) 20:29
moritz -> sleep
good * everybody
Zoffix \o
Zoffix & too
perlpilot Zoffix: if you have an iPhone, you just hold the key down to get a bunch of alternatives. Dunno about the other phones. 20:32
20:33 |oLa| left
student Ok... I just purchased the ebook of Perl 6 Fundamentals... time to have some fun... 20:35
20:36 mcmillhj joined 20:39 andrzejku_ left
tony-o get it 20:40
20:41 mcmillhj left, Ven`` joined 20:42 cpage_ joined, jonas1 left 20:43 vike joined 20:44 wamba left 20:47 Cabanossi left 20:48 Cabanossi joined 20:54 mcmillhj joined 20:56 headcase left 20:58 Roab left, mcmillhj left 20:59 |oLa| joined 21:03 rindolf left 21:04 ChoHag left 21:06 Ven`` left 21:07 skids left
Geth ecosystem: 0c9d4fc131 | (Tom Browder)++ (committed using GitHub Web editor) | META.list
add new module META6::To::Man

generates a rudimentary UNIX man page from data in a META6.json file
21:07
21:08 mcmillhj joined 21:09 itaipu left 21:10 rindolf joined 21:13 mcmillhj left
Zoffix Nah, I'm not hip enough for Apple products. 21:19
21:26 ChoHag joined 21:36 rindolf left
[Coke] (other languages better marketing). Perl is also an oddball in that we aren't some company's project (5 or 6) 21:41
21:42 pompomcrab joined
pompomcrab i am trying to figure out the cleanest idiom for passing a block to a sub as the last param, but can't quite get it 21:43
i.e. sub bash( %args (:$cmd, *%), Block $block?) is export { ... } 21:44
i wish i could mix named params with a positional final param
pmurias if Perl 6 keeps improving marketing it will become easier
pompomcrab maybe there is a way using the obscure rarely used "<--" to reverse the execution flow direction ala Haskell's bind? 21:45
21:45 ccakes left, rodarmor left, Technaton left 21:46 pierrot left, Caelum left, olinkl left, rkitover joined, pierrot joined
jnthn m: sub foo(&block, *%options) { say %options; block() }; foo :bar, :baz, { say 42 } 21:46
camelia {bar => True, baz => True}
42
21:47 Bucciarati left, karthyk left
jnthn Dunno if it helps, but the constraint on positionals having to come first only applies on the parameters side, not on the arguments side (where positional and named can be freely intermixed) 21:47
21:47 S007 left 21:48 peteretep left, skaji left, olinkl joined, sacomo left 21:49 troys is now known as troys_ 21:50 rindolf joined 21:51 peteretep joined
pompomcrab jnthn: thx. i still wish i could put the inline block as the last param, because it's a bit cleaner to not put the rest of the args after a big lambda, but that works for me 21:51
21:51 skaji joined 21:52 Technaton joined, student left, karthyk joined 21:54 S007 joined, ccakes joined 21:57 Ven`` joined 21:58 rkitover is now known as Caelum 22:00 leont left, Bucciarati joined, rodarmor joined 22:01 sacomo joined 22:02 Cabanossi left 22:03 Cabanossi joined 22:04 nadim left
timotimo pompomcrab: but you can do that 22:05
m: sub foo-the-block(&block, *%options) { for %options { say "fooing the block $_.key()ishly" }; block() }; foo-the-block :freak, :greed, :green, { say "woop woop the block!" } 22:06
camelia fooing the block greedishly
fooing the block freakishly
fooing the block greenishly
woop woop the block!
22:11 rindolf left
pompomcrab timotimo: woa i didn't realize it worked that way, awesome 22:17
ha ha everytime i get stuck on some little thing it turns out p6 was designed to DWIM. well done, well done 22:18
timotimo yeah, like jnthn said, you can freely mix positionals and nameds on the caller's side
pompomcrab i just got confused on the difference between the difference between defining the params in the callee and passing args in the caller. d'oh
22:34 troys_ is now known as troys 22:35 okl joined 22:39 dalek left 22:42 okl left 22:44 pompomcrab left 22:45 Rawriful left 22:46 Cabanossi left 22:49 Cabanossi joined 22:54 headcase joined, BenGoldberg joined 22:58 headcase left 22:59 skids joined 23:00 margeas left 23:13 lizmat joined, troys is now known as troys_ 23:24 troys_ is now known as troys 23:29 mcmillhj joined 23:32 Cabanossi left 23:33 Cabanossi joined 23:34 mcmillhj left 23:39 headcase joined 23:45 mcmillhj joined 23:46 headcase left 23:50 mcmillhj left 23:52 pmurias left
AlexDaniel squashable6: status 23:53
squashable6 AlexDaniel, Next SQUASHathon in 14 days and ≈10 hours (2017-10-07 UTC-12⌁UTC+14)
AlexDaniel github.com/perl6/whateverable/issues/237 23:56
holy shit 170 issues… :-S 23:57
23:59 mcmillhj joined
Juerd AlexDaniel: Maybe you should have a talk with this AlexDaniel person, because they seem to keep opening new ones. 23:59