Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-11-29

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 donaldh joined #perl6
00:13 konsolebox joined #perl6
00:20 kerframil joined #perl6
00:20 Cabanossi joined #perl6
00:34 konsolebox joined #perl6
00:41 konsolebox joined #perl6
00:55 aborazmeh joined #perl6
00:55 aborazmeh joined #perl6
00:58 lookatme o/
01:02 cpage_ joined #perl6
01:06 cdg joined #perl6
01:08 konsolebox joined #perl6
01:20 cdg joined #perl6
01:30 sivoais joined #perl6
01:35 Cabanossi joined #perl6
01:37 konsolebox joined #perl6
01:43 rouking joined #perl6
01:54 cdg joined #perl6
01:56 Herby_ lookatme: \o/
01:57 konsolebox joined #perl6
02:01 AlexDaniel squashable6: next
02:01 squashable6 AlexDaniel, ⚠🍕 Next SQUASHathon in 2 days and ≈7 hours (2017-12-02 UTC-12⌁UTC+14). See https://github.com/rakudo/rakudo/wiki/Monthly-Bug-Squash-Day
02:04 zakharyas joined #perl6
02:12 BenGoldberg joined #perl6
02:13 BrianOn99 joined #perl6
02:15 mcmillhj joined #perl6
02:31 cdg joined #perl6
02:35 Cabanossi joined #perl6
02:57 ilbot3 joined #perl6
02:57 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!
03:04 ufobat_ joined #perl6
03:05 konsolebox joined #perl6
03:08 travis-ci joined #perl6
03:08 travis-ci Doc build failed. Jeremy Studer 'Make eager examples showcase "eager" eval more
03:08 travis-ci https://travis-ci.org/perl6/doc/builds/308770157 https://github.com/perl6/doc/compare/dcb567d7e598...64121a95f1f0
03:08 travis-ci left #perl6
03:09 buggable [travis build above] ☠ Did not recognize some failures. Check results manually.
03:13 uhmhe joined #perl6
03:20 Cabanossi joined #perl6
03:20 stmuk joined #perl6
03:24 cpage_ joined #perl6
03:37 Herby__ joined #perl6
03:43 konsolebox joined #perl6
03:45 cdg joined #perl6
03:49 konsolebox joined #perl6
03:50 Cabanossi joined #perl6
03:55 konsolebox joined #perl6
04:07 konsolebox joined #perl6
04:16 releasable6 joined #perl6
04:18 konsolebox joined #perl6
04:19 Cabanossi joined #perl6
04:23 wamba joined #perl6
04:27 Actualeyes joined #perl6
04:30 sivoais joined #perl6
04:34 llfourn joined #perl6
04:36 Herby__ exit
04:36 Herby__ whoops!
04:40 sivoais joined #perl6
04:58 aindilis joined #perl6
04:59 konsolebox joined #perl6
05:05 konsolebox joined #perl6
05:16 kerframil joined #perl6
05:17 konsolebox joined #perl6
05:29 astronavt joined #perl6
05:33 aborazmeh joined #perl6
05:33 aborazmeh joined #perl6
05:33 wander joined #perl6
05:34 wander afternoon #perl6
05:37 wander Recently I attempt to understand how our re-dispatching system works, and learned many of it by reading the blog ↓
05:37 wander https://rakudo.party/post/Perl6-But-Heres-My-Dispatch-So-Callwith-Maybe
05:37 wander however, some questions still remain
05:38 wander the main is, "how to decide who is the next candidate?"
05:39 wander I know some examples and how they work (https://github.com/perl6/doc/issues/1689), but is there a complete rule how it choose the next candidate?
05:40 AlexDaniel that's not just about nextsame and friends, the same order is used when you just call something (I think)
05:41 AlexDaniel another piece of the puzzle: https://docs.perl6.org/type/Routine#Trait_is_default
05:43 AlexDaniel generally stuff with stricter signatures has higher priority, but I don't know what are these rules exactly
05:44 AlexDaniel relevant code: https://github.com/perl6/nqp/blob/8c3aedcc97a5f148c2863c3126f97b518c842f38/src/core/NQPRoutine.nqp#L59
05:45 wander huh, what it comes to external-defined functions, we can use "which is more narrow".  But how about when it intersects with class inherit?
05:46 wander see the interesting example
05:46 wander https://gist.github.com/W4anD0eR96/0121e301cf3ee0aa41b2a824018ef163
05:47 AlexDaniel eval: https://gist.githubusercontent.com/W4anD0eR96/0121e301cf3ee0aa41b2a824018ef163/raw/0374b97e89082722267535ef783356096b05a4ee/redispatch.p6
05:47 evalable6 AlexDaniel, Successfully fetched the code from the provided URL.
05:47 evalable6 AlexDaniel, rakudo-moar e7c0a6447: OUTPUT: «b.f.i␤a.f.i␤b.f.a␤a.f.a»
05:47 perlbot AlexDaniel: [31m===[0mSORRY![31m===[0m Error while compiling /tmp/PVevymQFrX Confused at /tmp/PVevymQFrX:1 ------> [32mhttps:[33mâ��[31m//gist.githubusercontent.com/W4anD0eR96/[0m     expecting any of:         colon pair [Exited 1]
05:47 AlexDaniel simcop2387: can it react on something different?
05:48 AlexDaniel wander: actually that's probably not the right piece of code, but that's all my sleepy mind can find at the moment :)
05:50 wander what does "not the right piece of code" mean? User is not recommended to write code like this?
05:52 mcmillhj joined #perl6
05:52 lookatme m: class A { multi method b() { say "A"; }; }; class B is A { multi method b() { nextsame; }; }; say B.new.^lookup("b").candidates>>.signature; B.new.b
05:52 camelia rakudo-moar e7c0a6447: OUTPUT: «((A $: *%_) (B $: *%_))␤A␤»
05:53 AlexDaniel wander: I'm talking about the link to nqp sources
05:54 wander see, sorry for misunderstanding
05:58 lookatme m: class A {  method b() { say "A"; }; }; class B is A {  method b() { nextsame; }; }; say B.new.^lookup("b").candidates>>.signature; B.new.b
05:58 camelia rakudo-moar e7c0a6447: OUTPUT: «((B $: *%_))␤A␤»
06:09 konsolebox joined #perl6
06:11 wander re-dispatching is a sub-topic of multi-dispatching, i think
06:12 TimToady any dispatcher can re-dispatch, so what 'nextsame' et al. mean depends on the current dispatcher (and they can be nested)
06:13 b2gills joined #perl6
06:14 TimToady one could be in the single-dispatcher, the multi-dispatcher, and the wrap dispatcher all at the same time
06:15 TimToady if you don't like the current dispatcher anymore, you can say 'lastcall' to throw it away, and the 'nextsame' will talk to the next innermost dispatcher
06:16 itaylor57 joined #perl6
06:21 mson joined #perl6
06:30 itaylor57 joined #perl6
06:32 epony joined #perl6
06:33 konsolebox joined #perl6
06:37 robertle_ joined #perl6
06:40 konsolebox joined #perl6
06:42 darutoko joined #perl6
06:43 cdg joined #perl6
06:46 wander I'm supposed to learn what dispatcher is, looks interesting :-)
06:52 wander joined #perl6
06:53 dayangkun joined #perl6
06:53 wander how about "single-dispatcher"? and in which dispatch the example intersecting re-dispatching with class inherit is
06:55 konsolebox joined #perl6
06:57 TimToady those are the same; the class dispatcher finds a single method in a class, but within that class you might have the method defined as several multi methods, so that would turn around and use the multi-dispatcher inside the normal class dispatcher
06:58 TimToady and since methods are routines, one of those could have had .wrap called on it, maybe for Aspect Oriented Programming, so that dispatcher might also come into play
07:04 wander emmmmm..got something. So how can we explain this example(https://gist.github.com/W4anD0eR96/0121e301cf3ee0aa41b2a824018ef163)? I tried to do that but end with losing myself.
07:05 dayangkun joined #perl6
07:06 wander Here is no wrapper dispatch. As you mention a new concept "class dispatcher", how does it communicates with multi-dispatcher?
07:09 wander It calls 'b.f.i' at first, which looks well; the next is a.f.i, huh, no problem; then it back to b.f.a, which messes up logic
07:09 u-ou what is dispatch in programming
07:10 u-ou I mean, what does the word mean in programming context
07:11 BenGoldberg In general, dispatch in programming means a lookup table of some sort which is keyed by a name, with functions as values.
07:12 u-ou ok
07:13 wander Preamble `sub f(Int) { ... }; sub f(Any) { ... };`, then calls `f(42)`. dispatch is to choose which one to be called, for example.
07:13 BenGoldberg If you hear "multi dispatch", usuaully that means that each value from the lookup table is, instead of a single function, a list of functions... typically with different signatures.  Like wander's example ^
07:14 TimToady there is only one single-method dispatch there, which goes to an anonymouse proto method that is generated around the most general multi method
07:14 TimToady the purpose of that proto is to dispatch to all the multis within its scope, which in this case is all four of them
07:15 faraco joined #perl6
07:15 faraco joined #perl6
07:15 wander u-ou: my lexical example miss `multi`
07:15 TimToady so the ordering you see is merely picking based on which parameter types are closer to the actual argument type, and which parameter types are more generic
07:16 TimToady B is more specific than A, and Int is more specific than Any
07:17 TimToady if you only want to redispatch to the multis in a given class, you can provide an explicit proto that can see only those multi methods
07:19 TimToady without that, the autogenerated proto will see all the multis from the object's class, as well as any parent classes of that class
07:21 sena_kun joined #perl6
07:21 TimToady the rules in a grammar dispatch by exactly the same visibility rules, but use yet another dispatcher that is smart about LTM (longest token matching), so it calls the methods in order of how much they match
07:21 geospeck joined #perl6
07:22 TimToady this is all pluggable underneath, so you could write your own dispatcher too, but we don't advertise that heavily :)
07:25 TimToady but basically, this is how we unify methods and functions and such; everything is a function, but a method is merely a function that happens to be called by a method dispatcher via the class hierarchy
07:26 konsolebox joined #perl6
07:26 TimToady bed &
07:27 lookatme good night
07:28 domidumont joined #perl6
07:28 u-ou night :)
07:28 dayangkun joined #perl6
07:29 wander I tried adding 'proto' and saw the difference. Now I could explain the very example, in fact I have four multi method whose signatures are (B, Int), (A, Int), (B, Any) and (A, Any). They are flatten so can be sorted from narrow to wide.
07:30 wander could I write my own dispatcher directly? sounds cool. or it means I can manipulate dispatcher by adding proto properly
07:31 klapperl joined #perl6
07:31 BrianOn99 joined #perl6
07:32 wander good night, thanks a lot for your explanation :)
07:34 domidumont joined #perl6
07:37 abraxxa joined #perl6
07:56 konsolebox joined #perl6
08:02 konsolebox joined #perl6
08:03 buggable New CPAN upload: PDF-Font-0.0.1.tar.gz by WARRINGD https://cpan.metacpan.org/authors/id/W/WA/WARRINGD/Perl6/PDF-Font-0.0.1.tar.gz
08:08 konsolebox joined #perl6
08:10 dayangkun joined #perl6
08:10 wamba joined #perl6
08:16 cpage_ joined #perl6
08:17 cdg joined #perl6
08:18 dayangkun joined #perl6
08:26 cpage_ joined #perl6
08:28 philomath joined #perl6
08:40 dayangkun joined #perl6
08:49 Cabanossi joined #perl6
08:52 konsolebox joined #perl6
08:52 wander joined #perl6
08:55 * wander suggest fixing this issue as soon as possible(https://github.com/perl6/doc/issues/1692)
08:57 wander I cannot work it out because everything goes well locally. It has nothing to do with our commit, maybe.
08:59 konsolebox joined #perl6
08:59 domidumont joined #perl6
09:04 cdg joined #perl6
09:13 lowbro joined #perl6
09:13 lowbro joined #perl6
09:13 scimon joined #perl6
09:18 konsolebox joined #perl6
09:19 Cabanossi joined #perl6
09:28 wander joined #perl6
09:31 cschwenz joined #perl6
09:31 cschwenz left #perl6
09:32 dakkar joined #perl6
09:52 mcmillhj joined #perl6
09:56 konsolebox joined #perl6
09:59 gregf_ joined #perl6
10:01 cgfbee joined #perl6
10:07 konsolebox joined #perl6
10:19 konsolebox joined #perl6
10:19 Cabanossi joined #perl6
10:26 evalable6 joined #perl6
10:34 eater joined #perl6
10:35 eater joined #perl6
10:41 rindolf joined #perl6
10:43 eater joined #perl6
10:45 philomath joined #perl6
11:00 wamba joined #perl6
11:06 Aaronepower joined #perl6
11:07 konsolebox joined #perl6
11:10 markong joined #perl6
11:13 cschwenz joined #perl6
11:18 cschwenz left #perl6
11:19 Cabanossi joined #perl6
11:24 DrForr I'd forgotten how well perl symbols and LaTeX don't play together.
11:33 BrianOn99 joined #perl6
11:43 konsolebox joined #perl6
11:55 koto joined #perl6
12:04 eliasr joined #perl6
12:06 cdg joined #perl6
12:18 wander .ask TimToady could you please reply this(https://irclog.perlgeek.de/perl6/2017-11-29#i_15506760) when you're free? I'm quite curious. thanks.
12:18 yoleaux wander: I'll pass your message to TimToady.
12:19 Zoffix joined #perl6
12:19 Cabanossi joined #perl6
12:21 Zoffix What was it that aren't closures? classes/roles or methods too?
12:23 wander huh?
12:25 Zoffix Yeah, I think it's just classe/roles; methods do close over class body but not stuff beyond
12:25 cdg joined #perl6
12:27 DrForr Ah, wrong package, forgot.
12:27 Zoffix man, can't look at AST on this dumb phone :(
12:30 Zoffix jnthn: you around? What was it that aren't closures? Methods aren't closures? Was just looking at the Proxy examples here and see methods closing over a variable; is that fine? https://docs.perl6.org/type/Proxy
12:38 geospeck joined #perl6
12:38 Zoffix m: my ($m, $s) = do { my $x = 42; my method { $x }, { $x = $^v } }; $s(100); say $m($)
12:38 camelia rakudo-moar 4a32089fd: OUTPUT: «100␤»
12:38 * Zoffix shrugs
12:43 Zoffix Methods ain't closures based on this: https://github.com/rakudo/rakudo/commit/231cb3f5fe8f024ce1a3694560a4cf50ec570b9d
12:43 Zoffix But I don't understand how above example works if they're not and also whether the Proxy example is goo
12:48 Zoffix wander: "latest version" is what exactly?
12:48 Zoffix To me it means latest Rakudo release, to some, latest Star release, to others, the HEAD commit when you wrote that Issue
12:49 Cabanossi joined #perl6
12:49 Zoffix That's for D#1692
12:49 synopsebot D#1692 [open]: https://github.com/perl6/doc/issues/1692 [build] Build fail strange
12:50 Zoffix Gotta be rakudo issue. Latest pod changes, likely
12:51 wander as mention"latest version", I mean the latest perl6/doc version(at that time, 81de65a ).
12:52 wander ok, let me pull the latest Rakudo and try it again
12:53 Zoffix Ah, I thought you meant latest rakudo version
12:54 * Zoffix &
12:54 Zoffix left #perl6
12:54 wander :P
12:56 pmurias joined #perl6
12:57 pmurias hi
13:03 jnthn .tell Zoffix Anonymous methods actually are closures. The thing that makes things "not a closure" is when they are installed somewhere at compile time. A type has a single meta-object with a single method table.
13:03 yoleaux jnthn: I'll pass your message to Zoffix.
13:05 Altreus What is the ($) for in zoffix's bot example?
13:12 astj joined #perl6
13:19 Cabanossi joined #perl6
13:22 dasfagggdhkjh joined #perl6
13:22 sergot joined #perl6
13:24 dasfagggdhkjh Altreus: $m has a Callable in it, the $m() calls it, and the $ is a anonymous state variable that in this case just serves to provide a dummy value for a routine that expects one positional argument. https://docs.perl6.org/language/variables#The_$_Variable
13:26 wamba joined #perl6
13:35 BrianOn99 joined #perl6
13:35 bloatable6 joined #perl6
13:37 perlawhirl is there any reason why argless .classify() shouldn't just classify against the value?
13:37 perlawhirl m: say <A A A A B B B C C D>.classify({ $_ })
13:37 camelia rakudo-moar 4a32089fd: OUTPUT: «{A => [A A A A], B => [B B B], C => [C C], D => [D]}␤»
13:37 perlawhirl m: say <A A A A B B B C C D>.classify(*)
13:37 camelia rakudo-moar 4a32089fd: OUTPUT: «Doesn't make sense to classify with itself␤  in block <unit> at <tmp> line 1␤␤»
13:37 perlawhirl it does tho
13:37 perlawhirl m: say <A A A A B B B C C D>.classify() # :(
13:37 camelia rakudo-moar 4a32089fd: OUTPUT: «Must specify something to classify with, a Callable, Hash or List␤  in block <unit> at <tmp> line 1␤␤»
13:45 timotimo zoffix, it's very problematic to show methods being passed to the proxy constructor; you can't use $!foo syntax in there without making things explode rather violently in most cases
13:46 timotimo m: class test { has $.something; has $!foo; method getfoo is rw { Proxy.new(FETCH => method() { $!foo }; STORE => method($n) { $!foo = $n } } }; test.new.getfoo = 99
13:46 camelia rakudo-moar 4a32089fd: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)␤at <tmp>:1␤------> 3tfoo is rw { Proxy.new(FETCH => method()7⏏5 { $!foo }; STORE => me…»
13:46 timotimo m: class test { has $.something; has $!foo; method getfoo is rw { Proxy.new(FETCH => method () { $!foo }; STORE => method ($n) { $!foo = $n }) } }; test.new.getfoo = 99
13:46 camelia rakudo-moar 4a32089fd: OUTPUT: «Unexpected named argument 'FETCH' passed␤  in method getfoo at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
13:46 timotimo m: class test { has $.something; has $!foo; method getfoo is rw { Proxy.new(FETCH => method () { $!foo }, STORE => method ($n) { $!foo = $n }) } }; test.new.getfoo = 99
13:46 camelia rakudo-moar 4a32089fd: OUTPUT: «Cannot assign to an immutable value␤  in method <anon> at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
13:46 timotimo m: class test { has $.something; has $.blah; has $.flob; has $!foo; method getfoo is rw { Proxy.new(FETCH => method () { $!foo }, STORE => method ($n) { $!foo = $n }) } }; test.new.getfoo = 99
13:46 camelia rakudo-moar 4a32089fd: OUTPUT: «P6opaque: no such attribute '$!foo' on type test in a Proxy when trying to get a value␤  in method <anon> at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
13:48 konsolebox joined #perl6
13:49 Cabanossi joined #perl6
13:56 Altreus Is it because it was declared as a method so it expects a $self?
13:58 timotimo it's a little more tricky than that
13:58 timotimo when code for $!foo is generated it'll look around itself to the innermost class definition
13:58 timotimo that lets it know what type to put into the generated code
13:58 timotimo but STORE and FETCH are called on the proxy object
13:59 timotimo so there's code to grab (or set) attribute $!foo in a test object, but the object the method is called on isn't a test at all
13:59 timotimo m: class test { has $.something; has $.blah; has $.flob; has $!foo; method getfoo is rw { Proxy.new(FETCH => sub ($p) { $!foo }, STORE => sub ($p, $n) { $!foo = $n }) } }; test.new.getfoo = 99
13:59 camelia rakudo-moar 4a32089fd: ( no output )
14:00 timotimo here it closes over "self" from the "getfoo" method, which is the test object
14:00 domidumont joined #perl6
14:00 timotimo so now the type of the innermost class definition and the object stored in "self" match up and everything's good
14:01 timotimo m: class test { has $.something; has $.blah; has $.flob; has $!foo; method getfoo is rw { Proxy.new(FETCH => sub (\self:) { $!foo }, STORE => sub (\self: $n) { $!foo = $n }) } }; test.new.getfoo = 99
14:01 camelia rakudo-moar 4a32089fd: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Can only use the : invocant marker in the signature for a method␤at <tmp>:1␤------> 3o is rw { Proxy.new(FETCH => sub (\self:7⏏5) { $!foo }, STORE => sub (\self: $n) { ␤»
14:01 timotimo ah, ok
14:01 timotimo if that were legal syntax, it would have blown up again
14:01 Geth ¦ doc: f4426c44cf | (Alex Chen)++ | 4 files
14:01 Geth ¦ doc: Try to make build OK
14:01 Geth ¦ doc: review: https://github.com/perl6/doc/commit/f4426c44cf
14:01 Zoffix joined #perl6
14:02 Zoffix timotimo: what I don't get is why is it taking methods in the first place?
14:02 cdg joined #perl6
14:03 Zoffix This seems a lot less clunky to use: my $x := do { my @stuff; Proxy.new: :STORE{ @stuff.push: $_ }, :FETCH{ @stuff.join: "|" } };
14:03 Zoffix And is in fact what I first wrote this morning until it gave me wrong results and I realized it's passing the proxy object as the first values
14:04 cdg joined #perl6
14:05 Zoffix Or better yet: my $x := Proxy.new: { my @stuff; :STORE{ @stuff.push: $_ }, :FETCH{ @stuff.join: "|" } };
14:07 Zoffix Especially if you say it's very problematic to show methods; well, if we don't then we have some explanation to do about why first arg is a dud
14:07 moritz i guess we'd have to add a new API
14:08 moritz the old one has annoyed me at times, too
14:08 moritz Proxy.new is in somewhat whitespread use in the ecosystem
14:09 Zoffix I can imagine.
14:09 Zoffix Gonna hack up a Proxee module some time this week and experiment with a few things
14:09 moritz moritz@hack:~/p6/perl6-all-modules$ git grep -wlF Proxy.new|cut -d/ -f 1-3|sort -u|wc -l
14:09 moritz 42
14:09 moritz 42 different distributions use it
14:10 Zoffix m: say WHY "Life, the Universe and Everything":
14:10 camelia rakudo-moar 4a32089fd: OUTPUT: «42␤»
14:11 Zoffix Coincidence? I think NOT!
14:11 Zoffix :)
14:12 cdg_ joined #perl6
14:13 wander https://github.com/rakudo/rakudo/blob/1c387153ea5f0c60934ce2a7e3b0f9669bd7935f/src/core/Str.pm#L21
14:14 Zoffix s: "Life, the Universe and Everything", 'WHY', \()
14:14 SourceBaby Zoffix, Sauce is at https://github.com/rakudo/rakudo/blob/4fca94743/src/core/Str.pm#L21
14:15 wander IIRC moritz picked it up once :P
14:15 sena_kun joined #perl6
14:16 Zoffix I was showing off my cool bot :P
14:16 wander so it is
14:16 wander cool to me too
14:17 Zoffix eco: Sourcery
14:17 buggable Zoffix, CoreHackers::Sourcery 'Helper for showing actual source code locations of core subs and methods': https://github.com/zoffixznet/perl6-CoreHackers-Sourcery
14:17 Zoffix Uses this module
14:17 Zoffix left #perl6
14:22 sena_kun joined #perl6
14:29 travis-ci joined #perl6
14:29 travis-ci Doc build passed. Alex Chen 'Try to make build OK'
14:29 travis-ci https://travis-ci.org/perl6/doc/builds/308983984 https://github.com/perl6/doc/compare/64121a95f1f0...f4426c44cfb7
14:29 travis-ci left #perl6
14:30 wander lucky :P
14:30 Util joined #perl6
14:33 moritz the more you practice, the more luck you have
14:37 Geth ¦ doc: 10a5e8a4a6 | (Alex Chen)++ | doc/Language/functions.pod6
14:37 Geth ¦ doc: Collect sub MAIN into routine
14:37 Geth ¦ doc: review: https://github.com/perl6/doc/commit/10a5e8a4a6
14:37 synopsebot Link: https://doc.perl6.org/language/functions
14:39 Altreus timotimo: but zoffix's original example didn't actually use a class, which is what made me wonder
14:39 Altreus so I guess the reason the call to $m needed a solo $ is that it was declared as a method and therefore needs an invocant?
14:41 wamba joined #perl6
14:43 timotimo what code are you refering to?
14:44 bdmatatu joined #perl6
14:45 philomath joined #perl6
14:56 nebuchadnezzar joined #perl6
15:04 Cabanossi joined #perl6
15:04 Actualeyes joined #perl6
15:08 konsolebox joined #perl6
15:16 Zoffix joined #perl6
15:17 Zoffix Is there any significant difference between `my &foo := {;}` and `my &foo = {;}`? I can see the latter gives true for nqp::iscont, but is there any difference for regular users?
15:20 konsolebox joined #perl6
15:20 moritz not really
15:21 moritz m: my &foo := {;}; &foo = {;}; say 'alive'
15:21 camelia rakudo-moar 4a32089fd: OUTPUT: «Cannot modify an immutable Block (-> ;; $_? is raw { #...)␤  in block <unit> at <tmp> line 1␤␤»
15:21 moritz Zoffix: ^^ that's the most important difference, I think
15:22 Zoffix Oh right. moritz++
15:45 Zoffix left #perl6
15:46 abraxxa is there a way to tell zef to install all requirements of a perl6 script?
15:49 [Coke] zef install --deps-only .
15:49 [Coke] ... but that's more for a project with a META6.json file
15:51 azawawi joined #perl6
15:51 azawawi hi
15:53 Altreus timotimo: zoffix did this: «my ($m, $s) = do { my $x = 42; my method { $x }, { $x = $^v } }; $s(100); say $m($)»
15:54 Altreus $m is declared as a method but isn't run on an object
15:54 Altreus so I guess that's what the $ is for
15:54 azawawi m: grammar G { rule TOP  { ^ <e> $}; rule e { <e> "+" <e> | "a" | "b" | "c" } }; say G.parse('a+c');
15:55 astj joined #perl6
15:55 camelia rakudo-moar 4a32089fd: OUTPUT: «(timeout)»
15:55 azawawi how do i remove recursion (timeout) from that grammar?
15:55 azawawi what's a better way to write: grammar G { rule TOP  { ^ <e> $}; rule e { <e> "+" <e> | "a" | "b" | "c" } }; say G.parse('a+c');
15:57 rgrau joined #perl6
15:59 jast in formal terms this is called left recursion and an easy way to get rid of it is to split the rule in two, e.g.: rule e { <term> "+" <e> | <term> }; rule term { "a" | "b" | "c" };
15:59 DrForr Looks like you want to do mathematics. I'd look at https://github.com/drforr/perl6-Grammar-Common/blob/master/lib/Grammar/Common/Expression/Infix.pm6 but I'm a bit biased :)
16:01 azawawi jast: cool thx
16:01 azawawi jast: im a bit rusty on compiler stuff :)
16:02 jast I was very, very interested in it for a couple of years, a lot of it has stuck :)
16:02 azawawi jast: left recursion elimination right?
16:02 jast yep
16:02 azawawi cool
16:03 azawawi the thing is if you read https://docs.perl6.org/language/grammars, you dont find any mention of left recursion elimination
16:03 jast right
16:03 TimToady we should at least detect it and complain
16:03 jast in *principle* it's not necessary to eliminate left recursion in grammars, it just happens to be necessary if the underlying parsing engine uses top-down parsing (e.g. LL(k) parsers)
16:04 azawawi TimToady: I totally agree
16:05 azawawi it happened to me here... https://github.com/azawawi/perl6-inline-go/blob/master/lib/Inline/Go/Grammar.pm6#L58
16:05 jast I kind of like packrat parsers with PEG instead of standard grammars, but those do take some getting used to
16:06 azawawi also perl6 is not complaining of undefined rules until they're actually used. This is good and bad while developing/debugging a grammar
16:06 TimToady the other way to fix it is the way Perl 6's grammar does, install some kind of bottom-up parser in a layer-cake
16:06 troys joined #perl6
16:06 TimToady p6 just throws an operator precedence parser in under the name EXPR
16:07 jast yeah, that would work for pretty much everything you'd ever want to parse, except maybe natural languages :-)
16:07 azawawi btw what type of parsing are perl6 grammars actually doing (behind the scenes)?
16:08 jast I can guess, but I have to leave anyway so I'll let someone more knowledgeable answer
16:09 TimToady it's just PEG, but not packrat
16:10 azawawi https://en.wikipedia.org/wiki/Parsing_expression_grammar right?
16:10 jast packrat doesn't inherently solve left recursion issues anyway, it needs some extra treatment
16:11 TimToady the power comes from the fact that it writes lexers for you, so you never need to write your own
16:11 TimToady p6 grammmars, I mean
16:11 TimToady and it automatically calculates longest token matching across all the rules that can be a prefix at that spot
16:13 azawawi TimToady: thanks
16:16 azawawi Looking at sample grammar test code https://github.com/albastev/Grammar-Modelica/blob/master/t/ComponentClause.t#L11 , it seems :rule parameter in Grammar.parse is not being used (or known) to perl6 community.
16:16 azawawi or it may have been introduced recently
16:17 azawawi Another problem cross-platform found... go does not generate shared library (DLL) on windows... sigh
16:18 azawawi so no Inline::Go or "Let's Go" for windows :)
16:18 azawawi Error message: "-buildmode=c-shared not supported on windows/amd64" since Go 1.5 when that feature was introduced...
16:18 DrForr Doesn't play well with others?
16:19 El_Che azawawi: what about the gcc compiler?
16:19 mcmillhj joined #perl6
16:19 azawawi DrForr: it is funny given how good is its support on windows
16:20 * azawawi buildmode=c-archive
16:20 El_Che azawawi: https://stackoverflow.com/questions/40573401/building-a-dll-with-go-1-7 <-- a two step solution?
16:23 azawawi El_Che: cool thanks ... will try it now
16:28 El_Che azawawi: for the record, every Go programmer that I talked to told me to keep away of C-go :)
16:29 azawawi El_Che: :)
16:29 El_Che I am only exagerating slightly
16:29 El_Che :)
16:30 [Coke] m: use Telemetry :COLUMNS;
16:30 camelia rakudo-moar 4a32089fd: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Error while importing from 'Telemetry': no such tag 'COLUMNS'␤at <tmp>:1␤------> 3use Telemetry :COLUMNS7⏏5;␤»
16:44 pmurias joined #perl6
16:46 khw joined #perl6
16:49 Zoffix joined #perl6
16:50 Zoffix Altreus: yeah, it's for the invocant. In the `$foo.method(...)` it gets passed as the first arg, so if you got that Method object in a variable, you need to stick the invocant as the first arg, or use the methodop syntax with that variable:
16:50 Zoffix m: my $meth := my method n { self.uc.say }; "meow".$meth; "foos".&n; &n('bars'); $meth('bdasdas')
16:50 camelia rakudo-moar 4a32089fd: OUTPUT: «MEOW␤FOOS␤BARS␤BDASDAS␤»
16:51 Altreus perl5-y
16:51 azawawi El_Che: it is a go for windows Inline::Go. Thanks :)
16:51 Altreus I guess the main difference is that it's in self and not $^a or whatever
16:51 Zoffix Yeah
16:51 Altreus is that the entire purpose of `method`?
16:51 Zoffix Probably
16:52 Zoffix Also, `method`s inside classes will get installed as methods, but `sub`s won't
16:55 Altreus so much to learn :(
16:56 Zoffix You don't need to learn everything in one go :)
16:56 * DrForr scrambles around for peanuts to throw.
16:58 * Zoffix wonders how many ways to call a method we got
16:58 wander azawawi:
16:58 Zoffix I'm gonna guess: 40
16:58 wander m: grammar G { rule TOP  { ^ <e>+ % '+'  $}; rule e { "a" | "b" | "c" } }; say G.parse('a+c');
16:58 camelia rakudo-moar 4a32089fd: OUTPUT: «「a+c」␤ e => 「a」␤ e => 「c」␤»
16:58 Zoffix No, 80
16:59 wander for this special case, I think ^ is elegant enough
16:59 wander and yes, left recursion is common, we should discuss it in doc.
16:59 SmokeMachine Zoffix: is there a list with each way?
17:00 wander TimToady: could you please reply this(https://irclog.perlgeek.de/perl6/2017-11-29#i_15506760) when you're free? I'm quite curious. thanks.
17:00 Zoffix SmokeMachine: I'm making one :)
17:00 SmokeMachine :)
17:01 wander AlexDaniel: please take a look at this(https://irclog.perlgeek.de/perl6/2017-11-29#i_15507634), seems yoleaux doesn't work correctly
17:01 SmokeMachine Zoffix: Id love to see that list... :)
17:01 mniip joined #perl6
17:01 azawawi what about also warnings on non-existing rules? is perl6 lazy on this case? since i didnt encounter while developing the inline::go grammar until it was used.
17:02 El_Che azawawi: glad to be a useful lurker :)
17:03 jnthn azawawi: They're just method calls, and the missing methods could be provided by a subclass, for example
17:03 SmokeMachine m: grammar G {token TOP {<a>}}
17:03 camelia rakudo-moar 4a32089fd: ( no output )
17:03 SmokeMachine m: grammar G {token TOP {<a>}}; G.parse: "bla"
17:03 camelia rakudo-moar 4a32089fd: OUTPUT: «No such method 'a' for invocant of type 'G'. Did you mean 'at'?␤  in regex TOP at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
17:03 azawawi jnthn: ah ok.
17:04 Zoffix wander: by the way, jnthn may know more about your overriding dispatcher question
17:04 jnthn Overriding dispatcher? :)
17:04 Zoffix :)
17:04 * jnthn understands the words but not the meaning ;)
17:05 Zoffix "<wander> could I write my own dispatcher directly? sounds cool. or it means I can manipulate dispatcher by adding proto properly"
17:05 Zoffix m: multi x(Int) { say "here" }; multi x (Any) { say "there" }; x 42
17:05 camelia rakudo-moar 4a32089fd: OUTPUT: «here␤»
17:06 Zoffix I guess the question is, is there a way to change the way that dispatches and, say, prefer an `Any` candidate over all the rest
17:06 jnthn Hmm
17:06 jnthn Not *easily*, but of course all things are possible with sufficient evil
17:07 jnthn Of note, mixing a role into a proto that overrides the !find_best_dispatchee method probably works out
17:07 luiz_lha joined #perl6
17:07 jnthn The multi-dispatch algo is written in NQP code
17:07 Zoffix neat
17:08 jnthn The only reason it goes fast is because it then sticks resolutions it does into a multi-dispatch cache the VM can do fast lookups in
17:08 Zoffix m: my @a = <uc>; "foo".@a
17:08 camelia rakudo-moar 4a32089fd: OUTPUT: «Invocant of method 'CALL-ME' must be a type object of type 'List', not an object instance of type 'Array'.  Did you forget a 'multi'?␤  in block <unit> at <tmp> line 1␤␤»
17:09 Zoffix This form is mentioned in Synopses but isn't implemented. Cuts down on my list :)
17:09 Zoffix ( https://design.perl6.org/S12.html#Fancy_method_calls )
17:09 wander thanks. now I know there is `!find_best_dispatchee`
17:11 wander for the whole story, at first I lost in this code snip(https://gist.github.com/W4anD0eR96/0121e301cf3ee0aa41b2a824018ef163)
17:11 wander then TimToady explained it(https://irclog.perlgeek.de/perl6/2017-11-29#i_15506557), where he mentioned terms 'single-dispatcher', 'multi-dispatcher' and 'class-dispatcher'
17:12 wander still I don't have good understanding about there dispatcher, maybe I can explain why choosing a very candidate to dispatch(which is more narrow), but 'single-' and 'class-' look confusing to me
17:14 wander for what zoffix recurred to, that is because TimToady said one can write his own dispatcher, which I'm curious about, emmm, just curious
17:15 jnthn https://stackoverflow.com/questions/45047202/how-does-a-perl-6-object-find-a-multi-method-that-might-be-in-a-parent-class-or/45123753#45123753
17:15 jnthn I wrote that once to explain the semantics
17:16 Zoffix huggable: dispatch :is: https://stackoverflow.com/questions/45047202/how-does-a-perl-6-object-find-a-multi-method-that-might-be-in-a-parent-class-or/45123753#45123753
17:16 huggable Zoffix, Added dispatch as https://stackoverflow.com/questions/45047202/how-does-a-perl-6-object-find-a-multi-method-that-might-be-in-a-parent-class-or/45123753#45123753
17:17 Altreus Zoffix: yes I do Q_Q
17:18 Altreus anything I don't know when I write code is going to be code I write again later :P
17:18 Zoffix Well, my original guess was spot on... I'm hopping I missed some form that double the amount of variants to 80.
17:18 Zoffix m: https://gist.github.com/zoffixznet/919f75cbe48b2aadeeedf75bc9434176
17:18 camelia rakudo-moar 4a32089fd: OUTPUT: «Saw 40 different ways to call a method␤»
17:18 Zoffix SmokeMachine: ^ you were wondering
17:19 Zoffix There's also a few ways mentioned in the Syn but aren't implemented :)
17:19 Zoffix m: "foo".$$$$$$$("".^lookup: "uc").say
17:19 camelia rakudo-moar 4a32089fd: OUTPUT: «FOO␤»
17:20 Zoffix And if you accept this as a separate variant, then the number is infinite :)
17:20 SmokeMachine :D
17:23 wander jnthn: thanks. let me read the answer.
17:25 uheue joined #perl6
17:27 TimToady Zoffix: there's also arguably function composition
17:27 Zoffix :D
17:29 TimToady also .= mebbe
17:29 simcop2387 AlexDaniel: yea i can make it not react to eval there.  i'll do that today
17:30 * Zoffix o
17:30 Zoffix left #perl6
17:33 buggable New CPAN upload: PDF-Font-0.0.2.tar.gz by WARRINGD https://cpan.metacpan.org/authors/id/W/WA/WARRINGD/Perl6/PDF-Font-0.0.2.tar.gz
17:35 TimToady .tell Zoffix yer also missing the 'meow $o:' form, which definitely belongs in your list
17:35 yoleaux TimToady: I'll pass your message to Zoffix.
17:36 BrianOn99 joined #perl6
17:38 moritz you can also cheat and use the MOP in various ways
17:38 moritz .^find_method, .^method_table<uc>
17:40 AlexDaniel squashable6: next
17:40 yoleaux 13:03Z <tbrowder> AlexDaniel: ref pod tests and lines with ws at end: only way i know how to guarantee retaining the ws is to generate the test file via the test harness somehow. any other ideas?
17:40 squashable6 AlexDaniel, ⚠🍕 Next SQUASHathon in 1 day and ≈16 hours (2017-12-02 UTC-12⌁UTC+14). See https://github.com/rakudo/rakudo/wiki/Monthly-Bug-Squash-Day
17:40 AlexDaniel tbrowder: yea, that's a good idea I think
17:42 wamba joined #perl6
17:49 Cabanossi joined #perl6
17:52 konsolebox joined #perl6
17:55 wander AlexDaniel: please take a look at this(https://irclog.perlgeek.de/perl6/2017-11-29#i_15507634), seems yoleaux doesn't work correctly
17:56 AlexDaniel wander: mmm, why?
17:57 wander yoleaux says 'wander: I'll pass your message to TimToady.', but it didn't pass it, did it?
17:57 AlexDaniel I think you can send a private message to yoleaux
17:57 AlexDaniel and it'll reply to you with messages
17:58 AlexDaniel` .ask AlexDaniel test pm
17:58 yoleaux AlexDaniel`: I'll pass your message to AlexDaniel.
17:58 AlexDaniel there
17:58 AlexDaniel :)
17:58 azawawi El_Che: it is ugly but works :) https://github.com/azawawi/perl6-inline-go/blob/master/lib/Inline/Go.pm6#L30
17:59 azawawi El_Che++
18:01 azawawi Inline::Go passes tests on my windows machine :)
18:10 astj joined #perl6
18:11 timotimo i wonder when larry will introduce us to the rest of the gang: larry wany, larry wone, and larry wnone?
18:16 El_Che azawawi: so the idea is to write go code that is compiled but the modules and callable from the perl code?
18:20 itaylor57 joined #perl6
18:22 azawawi El_Che: yup that's the ultimate goal
18:22 azawawi El_Che: it is actually two-in-one... Grammar + Execution at the end hopefully
18:23 El_Che azawawi: and libraries? go get in the background?
18:23 El_Che or do you count on a vendor directory?
18:23 azawawi to tell you truth i havent thought about it yet :)
18:24 El_Che hehe
18:25 azawawi the builtin go packages are good enough so far :) https://golang.org/pkg/
18:26 El_Che azawawi: dep is getting there being the official tool, so a dep managed directory could be a requirement
18:26 lizmat joined #perl6
18:26 azawawi https://github.com/golang/dep ?
18:28 El_Che yep
18:29 El_Che because golang dependency management is terrible, there are meany third party tools to manage them.
18:30 El_Che dep has the input of many of these third party authors
18:30 El_Che I use it, no probs so far :)
18:32 El_Che the stars it has should give some assurance :)
18:34 Ven`` joined #perl6
18:36 simcop2387 eval: say "Hello World"
18:36 evalable6 simcop2387, rakudo-moar 4a32089fd: OUTPUT: «Hello World»
18:40 simcop2387 perlbot: eval: say "Hello World"
18:40 simcop2387 perlbot: eval: say "Hello World"
18:40 perlbot simcop2387: Hello World
18:40 simcop2387 rkeval: say "Hello World"
18:40 perlbot simcop2387: Hello World
18:40 simcop2387 perlbot: theonion
18:40 perlbot simcop2387: Tips For Holiday Shopping On A Budget https://www.theonion.com/tips-for-holiday-shopping-on-a-budget-1820841649
18:42 simcop2387 ok good.  all working as expected now.  AlexDaniel, it'll now respond to eval: only if you address it, but will also work with rkeval (rakudo eval) without being addressed.  bleval (perl5 blead), and eval5.X (for other perl 5 versions if wanted).  i think i also forgot to mention it supports every perl version, from 1 to 5.26+blead.  so eval1: eval2: eval3: etc
18:43 AlexDaniel cool, although not quite sure why would we possibly need that here :)
18:44 AlexDaniel (perl5 evals I mean)
18:45 simcop2387 compare code? dunno.  :)
18:46 simcop2387 though if anybody here worked with lwall way way way back in the day and had access to (and can get it still) I'd love a copy of perl 0 to put on the bot :)
18:47 AlexDaniel around here we try to compare perl5 with perl 6 as much as we compare perl 6 with ruby, python or whatever… :)
18:47 AlexDaniel fwiw I'd love a universal eval bot for all languages
18:48 simcop2387 that's kind of what the bot has morphed into, it's got rbeval (ruby) and jseval (node).  now that i did the massive rewrite to the sandbox for it, i'll probably add python (mostly for the pastebin, it's a pita for oneliners).  and a few others.
18:48 AlexDaniel rbeval puts 42
18:48 AlexDaniel rbeval: puts 42
18:48 perlbot AlexDaniel: [Died SIGSYS (Illegal Syscall)]
18:49 TimToady eval: put 42
18:49 evalable6 TimToady, rakudo-moar 4a32089fd: OUTPUT: «42»
18:49 TimToady rkeval: put 42
18:49 perlbot TimToady: 42
18:49 simcop2387 ah yes that was one of the things i did this rewrite for,  upgraded ruby and it broken.  give me a moment i need to allow the getrandom syscall
18:49 Cabanossi joined #perl6
18:49 ilmari ceval: int main (void) { return 42; }
18:50 ilmari ;(
18:50 AlexDaniel jseval: console.log('Hello');
18:50 perlbot AlexDaniel: Hello
18:50 AlexDaniel cool
18:50 simcop2387 AlexDaniel: ruby fixed
18:50 AlexDaniel rbeval: puts 42
18:50 perlbot AlexDaniel: 42
18:50 azawawi El_Che: cool thx for info
18:51 simcop2387 ilmari: yea i need to figure out how i want to handle C, it's more easily dangerous since i've got to sandbox the compiler and the program
18:51 ilmari tcc has an -run option
18:51 simcop2387 there's a lot more execve() calls that i can't defend (i basically have to open it up entirely if i want gcc)
18:52 simcop2387 oh neat, i was going to look at tcc but wasn't sure how well it supports newer c standards
18:52 simcop2387 and i kind of want a c++eval too but that's more difficult.
18:52 TimToady rkeval: say dir(".")».basename
18:52 perlbot TimToady: (key.pem README.md hello.txt elib lib married.fwp cert.pem single.fwp template.angular example.html M1qEyehFsH)
18:53 TimToady rkeval: say dir("..")».basename
18:53 perlbot TimToady: (dev eval home perl5 langs bin usr lib lib64 tmp)
18:54 ilmari simcop2387: I just thecked with strace tcc -run doens't need to write anything
18:54 Ven`` TimToady: hi. wanted to know if you had had time to upload the materials of your talk?
18:54 simcop2387 ilmari: writing's not a problem, it's gcc doing execve for linking and such that was.  tcc -run looks great
18:55 unicodable6 joined #perl6
18:55 TimToady Ven``: you mean all the pictures?  there was no text...
18:55 statisfiable6 joined #perl6
18:55 nativecallable6 joined #perl6
18:55 coverable6 joined #perl6
18:55 TimToady there wasn't even a title :)
18:55 simcop2387 perlbot: bleval: open(my $fh, ">/tmp/foo") or die "Can't write $!"; print $fh "Hello world"x100; close($fh);
18:55 perlbot simcop2387: 1
18:56 AlexDaniel benchable6: uptime
18:56 benchable6 AlexDaniel, 1 day, 1 hour, 13 minutes, and 17 seconds, 1101.556MB maxrss. This is Rakudo version 2017.10-215-g85105077a built on MoarVM version 2017.10-86-g89fae17a6 implementing Perl 6.c.
18:56 AlexDaniel geez over 1000 MB…
18:57 TimToady rkeval: print slurp '/tmp/foo'
18:57 perlbot TimToady: Failed to open file /tmp/foo: No such file or directory   in block <unit> at /tmp/WZCnGJ_IzF line 1  [Exited 1]
18:57 simcop2387 TimToady: each eval gets its own container, and they're destroyed after exit
18:57 TimToady cool
18:57 simcop2387 yea a lot of my changes to my eval setup was to reduce memory usage (allowing secure reading from disk, etc.) most evals only take <30mb now.
19:03 timotimo AlexDaniel: i can try that locally; that's in the whateverable repo?
19:04 AlexDaniel timotimo: yes, I can give you some intstructions. Maybe on #whateverable
19:06 rindolf simcop2387: good job
19:08 gambatte64 joined #perl6
19:09 Geth ¦ ecosystem: d84103c91e | (Ahmad M. Zawawi)++ (committed using GitHub Web editor) | META.list
19:09 Geth ¦ ecosystem: Move Inline::Go to CPAN :)
19:09 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/d84103c91e
19:10 kyan joined #perl6
19:13 mson joined #perl6
19:13 buggable New CPAN upload: Go-Inline-0.0.2.tar.gz by AZAWAWI https://cpan.metacpan.org/authors/id/A/AZ/AZAWAWI/Perl6/Go-Inline-0.0.2.tar.gz
19:13 buggable New CPAN upload: Inline-Go-0.0.2.tar.gz by AZAWAWI https://cpan.metacpan.org/authors/id/A/AZ/AZAWAWI/Perl6/Inline-Go-0.0.2.tar.gz
19:14 setty1 joined #perl6
19:14 evalable6 joined #perl6
19:38 masak m: say <A A A A B B B C C D>.classify(*)
19:38 camelia rakudo-moar 4a32089fd: OUTPUT: «Doesn't make sense to classify with itself␤  in block <unit> at <tmp> line 1␤␤»
19:38 masak m: say <A A A A B B B C C D>.classify()
19:38 camelia rakudo-moar 4a32089fd: OUTPUT: «Must specify something to classify with, a Callable, Hash or List␤  in block <unit> at <tmp> line 1␤␤»
19:39 masak perlawhirl: I agree with you one or both of those could work.
19:41 moritz m: say <A A A A B B B C C D>.classify({$_})
19:41 camelia rakudo-moar 4a32089fd: OUTPUT: «{A => [A A A A], B => [B B B], C => [C C], D => [D]}␤»
19:41 [Coke] tcleval: puts 42
19:43 [Coke] if you're self-classifying... why are you doing that?
19:44 [Coke] m: say <A A A A B B B C C D>.Bag<A>; # seems more useful than getting a list of 4 As
19:44 camelia rakudo-moar 4a32089fd: OUTPUT: «4␤»
19:45 [Coke] I agree that if you make it do something, that's probably the best thing to make it do, though.
19:47 masak [Coke]: "why would you ever want to do [a thing that even remotely makes sense]?" usually doesn't hold up as a counterargument in the Perl world :P
19:47 masak "you oughtn't want that in the first place" is more of a Python argument
19:47 [Coke] masak: you're reading waaaay too much into my question
19:49 [Coke] Apologies for any tone issues on my part. I'm curious why someone would want that particular usage of classify, even explicitly.
19:49 Cabanossi joined #perl6
19:50 masak that's fine, as long as we keep separate the curious question itself and its role as a counterargument
19:51 masak apologies for going into overdrive defending a use case I don't fully understand either :P
19:51 perlpilot m: say <A A A A B B B C C D>.classify(*.Str);
19:51 camelia rakudo-moar 4a32089fd: OUTPUT: «{A => [A A A A], B => [B B B], C => [C C], D => [D]}␤»
19:51 perlpilot m: say <A A A A B B B C C D>.classify(*.Str).Bag;
19:51 camelia rakudo-moar 4a32089fd: OUTPUT: «Bag(A(4), B(3), C(2), D)␤»
19:52 perlpilot (just a couple of suggestions for the thing that no one seems to understand ;-)
19:52 masak but I think the error message "Doesn't make sense to classify with itself" could easily just be replaced by logic which carries out the thing
19:52 masak I don't really see why .classify should be the judge of what makes sense or not
19:52 perlpilot masak: +1
19:53 perlpilot (except under the auspices of type constraints)
19:53 masak it "makes sense" at least in the sense that it's clear what it *should* do if it weren't complaining so much! :P
19:56 geospeck joined #perl6
20:01 reportable6 joined #perl6
20:02 TimToady classification by type might be a more reasonable default
20:03 TimToady that is, after all, what classification means :)
20:04 |oLa| joined #perl6
20:06 [Coke] m: say ('A', 'b', e, π, .1, 4).classify(*.WHAT)
20:06 camelia rakudo-moar 4a32089fd: OUTPUT: «Doesn't make sense to classify with itself␤  in block <unit> at <tmp> line 1␤␤»
20:06 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {.WHAT.^name}
20:06 camelia rakudo-moar 4a32089fd: OUTPUT: «{ComplexStr => [4+1i], IntStr => [1 3 4], RatStr => [2.3 1/2], Str => [a z]}␤»
20:07 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {.WHAT}
20:07 camelia rakudo-moar 4a32089fd: OUTPUT: «Use of uninitialized value of type ComplexStr in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤{(ComplexStr) => [4+1i], (RatStr) => [2.3 1/2], (IntStr) => [1 3 4], (Str) => [a z]}␤  in…»
20:07 * [Coke] was tryign to avoid the *Str variants.
20:08 TimToady looks like ComplexStr is doing it rwong
20:08 TimToady m: say (ComplexStr => 42)
20:08 camelia rakudo-moar 4a32089fd: OUTPUT: «ComplexStr => 42␤»
20:08 * [Coke] misses having Readline for the REPL. :(
20:09 TimToady hmm
20:09 TimToady m: quietly say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {.WHAT}
20:09 camelia rakudo-moar 4a32089fd: OUTPUT: «{(RatStr) => [2.3 1/2], (IntStr) => [1 3 4], (ComplexStr) => [4+1i], (Str) => [a z]}␤»
20:10 [Coke] DrForr: Do you have a mac?
20:11 TEttinger joined #perl6
20:11 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {Any}
20:11 camelia rakudo-moar 4a32089fd: OUTPUT: «{(Any) => [a 1 2.3 4+1i 1/2 3 4 z]}␤»
20:11 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {RatStr}
20:11 camelia rakudo-moar 4a32089fd: OUTPUT: «{(RatStr) => [a 1 2.3 4+1i 1/2 3 4 z]}␤»
20:11 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {ComplexStr}
20:11 camelia rakudo-moar 4a32089fd: OUTPUT: «{(ComplexStr) => [a 1 2.3 4+1i 1/2 3 4 z]}␤»
20:12 domidumont joined #perl6
20:12 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {(ComplexStr,RatStr).pick}
20:12 camelia rakudo-moar 4a32089fd: OUTPUT: «Use of uninitialized value of type ComplexStr in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤{(RatStr) => [2.3 1/2 3], (ComplexStr) => [a 1 4+1i 4 z]}␤  in block <unit> at <tmp> line…»
20:12 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {(IntStr,RatStr).pick}
20:12 camelia rakudo-moar 4a32089fd: OUTPUT: «Use of uninitialized value of type IntStr in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤{(RatStr) => [a 1 4+1i 1/2 3 z], (IntStr) => [2.3 4]}␤  in block <unit> at <tmp> line 1␤Use…»
20:13 TimToady ,,
20:13 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify: {(IntStr,RatStr).pick}
20:13 camelia rakudo-moar 4a32089fd: OUTPUT: «Use of uninitialized value of type IntStr in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤{(RatStr) => [2.3 1/2 3 4 z], (IntStr) => [a 1 4+1i]}␤  in block <unit> at <tmp> line 1␤Use…»
20:13 TimToady looks like it's in the rendering, since it's always the one that's sorted first
20:14 TimToady m: say <a 1 2.3 4+1i 1/2 3 4 z>.classify({.WHAT}).perl
20:14 camelia rakudo-moar 4a32089fd: OUTPUT: «Use of uninitialized value of type RatStr in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤(my Any %{Any} = (RatStr) => $[RatStr.new(2.3, "2.3"), RatStr.new(0.5, "1/2")], (Str) => $["a",…»
20:15 TimToady m: quietly say <a 1 2.3 4+1i 1/2 3 4 z>.classify({.WHAT}).perl
20:15 camelia rakudo-moar 4a32089fd: OUTPUT: «(my Any %{Any} = (ComplexStr) => $[ComplexStr.new(<4+1i>, "4+1i")], (Str) => $["a", "z"], (RatStr) => $[RatStr.new(2.3, "2.3"), RatStr.new(0.5, "1/2")], (IntStr) => $[IntStr.new(1, "1"), IntStr.new(3, "3"), IntStr.new(4, "4")])␤»
20:30 kerframil joined #perl6
20:32 s0me0n3-unkn0wn joined #perl6
20:33 patrickz joined #perl6
20:34 evalable6 joined #perl6
20:36 geospeck joined #perl6
20:39 patrickz Hey! I'm trying out cro with TLS. I'm using `cro stub` to initialize a project. `curl https://localhost:20000 -vvv` fails with an "NSS error -5938 (PR_END_OF_FILE_ERROR)". Does anyone have an idea where to look?
20:40 timotimo patrickz: how did you set up a private key for the ssl stuff?
20:41 patrickz I didn't...
20:41 timotimo maybe that error comes from no private key existing or something
20:42 patrickz There is a RESOURCES/fake-tls/ folder with three .pem files. I thought cro set up a working TLS environment...
20:44 perlpilot patrickz: it might be a curl problem.  (at least I think I've heard of this with curl before)
20:45 timotimo oh, hmm
20:45 patrickz firefox fails just as well. Hm...
20:46 mcmillhj joined #perl6
20:46 evalable6 joined #perl6
20:46 AlexDaniel m: say 42; say 43
20:46 camelia rakudo-moar 4a32089fd: OUTPUT: «42␤43␤»
20:46 AlexDaniel eval: say 42; say 43
20:46 evalable6 AlexDaniel, rakudo-moar 4a32089fd: OUTPUT: «42␤43␤»
20:46 tony-o m: 'tmp'.IO.dir.perl.say;
20:46 camelia rakudo-moar 4a32089fd: OUTPUT: «Failure.new(exception => X::IO::Dir.new(path => "/home/camelia/tmp", os-error => "Failed to open dir: 2"), backtrace => Backtrace.new)␤»
20:47 MasterDuke joined #perl6
20:48 jnthn patrickz: Try curl -k
20:49 tony-o m: '/tmp/xyz'.IO.spurt('hello'); '/tmp/xyz'.IO.modified.base(8).say; '/tmp/xyz'.IO.modified.DateTime.posix.base(8).say;
20:49 camelia rakudo-moar 4a32089fd: OUTPUT: «13207616572.10423124␤13207616525␤»
20:49 Cabanossi joined #perl6
20:50 tony-o is there a rounding reason those two don't somewhat agree^ ?
20:54 perlpilot tony-o: leap seconds would be my guess
20:54 perlpilot (but 40-some-odd seconds does sound like a bit much)
20:56 timotimo m: say time - now
20:56 camelia rakudo-moar 4a32089fd: OUTPUT: «-37.1266353130341␤»
20:56 timotimo m: say [min] (time - now) xx 100
20:56 camelia rakudo-moar 4a32089fd: OUTPUT: «-37.0678160190582␤»
20:56 timotimo m: say [min] (time - now) xx 1000
20:56 camelia rakudo-moar 4a32089fd: OUTPUT: «-37.579318523407␤»
20:56 timotimo too fast %)
20:56 timotimo m: say [min] (time - now) xx 100_000
20:57 camelia rakudo-moar 4a32089fd: OUTPUT: «Too many arguments in flattening array.␤  in block <unit> at <tmp> line 1␤␤»
20:57 timotimo d'oh
20:57 patrickz jnthn: did that, gives the same result. That's the full output of `curl -kvvv` : https://gist.github.com/patzim/1549ad2b8d21cea46bd44f9aaca31da2
20:57 timotimo m: say reduce((time - now) xx 100_000, * min *)
20:57 camelia rakudo-moar 4a32089fd: OUTPUT: «Cannot resolve caller reduce(Seq, WhateverCode); none of these signatures match:␤    (&with, + is raw)␤  in block <unit> at <tmp> line 1␤␤»
20:58 timotimo m: say ((time - now) xx 100_000).reduce(&[min])
20:58 camelia rakudo-moar 4a32089fd: OUTPUT: «Too many arguments in flattening array.␤  in block <unit> at <tmp> line 1␤␤»
20:58 timotimo m: say ((time - now) xx 100_000).reduce(* min *)
20:58 camelia rakudo-moar 4a32089fd: OUTPUT: «-37.9999985694885␤»
20:58 timotimo can i just say that "+ is raw" looks weird
20:59 unicodable6_ joined #perl6
21:06 Zoffix joined #perl6
21:06 Zoffix .
21:06 yoleaux 17:35Z <TimToady> Zoffix: yer also missing the 'meow $o:' form, which definitely belongs in your list
21:06 Zoffix Added :) up to 43 ways no and I think I missed some safecall forms :) An Advent article is itching to be written :)
21:07 espadrine joined #perl6
21:07 Zoffix And on that topic.... what's the actual usecase for wanting to use `.+` method call?
21:08 cdg joined #perl6
21:08 Zoffix s/no/now/
21:12 gfldex m: multi f(Int $i){ return .Str }; multi f(Num $i){ return .Str }; 42.&+f
21:12 camelia rakudo-moar 4a32089fd: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Calling f() will never work with any of these multi signatures:␤    (Int $i) ␤    (Num $i)␤at <tmp>:1␤------> 3}; multi f(Num $i){ return .Str }; 42.&+7⏏5f␤»
21:12 s0me0n3-unkn0wn patrickz: Try to reproduce with HTTP::Server::Ogre. If the problem persists, it's some low level stuff with certificates/keys in IO::Socket::Async::SSL, which is common to Cro and HTTP::Server::Ogre. If the problem is gone, it's some problem initializing Cro, probably
21:12 gfldex m: multi f(Int $i){ return $i.Str }; multi f(Num $i){ return $i.Str }; 42.+&f
21:12 camelia rakudo-moar 4a32089fd: ( no output )
21:13 Geth ¦ mu: 91762f3c70 | (Zoffix Znet)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
21:13 Geth ¦ mu: Add "There's a Madness to My Method" to list
21:13 Geth ¦ mu: review: https://github.com/perl6/mu/commit/91762f3c70
21:13 bdmatatu joined #perl6
21:13 gfldex m: multi f(Str(Int) $i){ return $i.Str }; multi f(Str(Num) $i){ return $i.Str }; dd 42.+&f
21:13 camelia rakudo-moar 4a32089fd: OUTPUT: «("42",)␤»
21:14 cdg_ joined #perl6
21:14 Zoffix gfldex: I know what it does, but I don't know why I'd want to do that
21:15 gfldex Zoffix: I'm quite sure at some point somebody will come up with a really clever use case. I'm also quite sure that somebody wont be me. :->
21:16 Zoffix heh
21:16 jnthn patrickz: Hm, no idea. Haven't seen that before. I'd expect it to need -k to work, but to then work.
21:17 patrickz jnthn: I'll look into it further, given it also fails on my RPi (on which I haven't tried yet, and which is where I need it...)
21:17 tony-o that would be useful in tar for padding base 8 numbers ..
21:18 jnthn patrickz: I presume a curl of some other HTTPS service works?
21:18 jnthn I'm guessing yes but
21:18 jnthn * Initializing NSS with certpath: sql:/etc/pki/nssdb
21:18 jnthn * NSS error -5938 (PR_END_OF_FILE_ERROR)
21:18 jnthn I'm wondering what end of file it reached...
21:18 jnthn My guess is "socket was closed unexpectedly"
21:20 Zoffix tony-o: the method call? Got a code example I could steal?
21:21 tony-o working on a tar pp module rn, give me a few and i'll post it
21:21 patrickz I tried it with wireshark, and there it looked like clean connection shutdown. I don't have much raw connection reading skills though...
21:21 tony-o trying to figure out how to get the file owner name
21:21 Zoffix \o/
21:25 patrickz jnthn: That's what it looks in wireshark: >[SYN]  <[SYN,ACK] >[ACK] >[PSH, ACK] <[ACK] <[FIN, ACK] >[FIN,ACK] <[ACK]
21:28 Ven joined #perl6
21:29 geospeck is there any way to get the method's signature? for example if I know the methods name and I want to see what params accepts
21:29 astronavt joined #perl6
21:29 gfldex geospeck: see: https://docs.perl6.org/type/Method#(Code)_method_signature
21:30 Zoffix m: "".^lookup('split').candidates>>.signature.say
21:30 camelia rakudo-moar 4a32089fd: OUTPUT: «((Str:D $: Regex:D $pat, $limit is copy = Inf;; :$v is copy, :$k, :$kv, :$p, :$skip-empty, *%_) (Str:D $: Cool $match;; :$v is copy, :$k, :$kv, :$p, :$skip-empty, *%_) (Str:D $: Cool $match, $limit is copy = Inf;; :$v is copy, :$k, :$kv, :$p, :$skip-e…»
21:32 geospeck yep, that works, thanks guys!
21:32 tony-o m: sub r (Str $x, Int $y) { }; say &r.signature.params.perl;
21:32 camelia rakudo-moar 4a32089fd: OUTPUT: «(Str $x, Int $y)␤»
21:32 * patrickz is off to bed.
21:33 patrickz Thanks so far everyone!
21:33 tony-o m: sub r (Str $x, Int $y) { }; say &r.signature.params.perl; say &r.^name
21:33 camelia rakudo-moar 4a32089fd: OUTPUT: «(Str $x, Int $y)␤Sub␤»
21:33 tony-o oop
21:33 tony-o m: sub r (Str $x, Int $y) { }; say &r.signature.params.perl; say &r.^name
21:33 camelia rakudo-moar 4a32089fd: OUTPUT: «(Str $x, Int $y)␤Sub␤»
21:33 tony-o m: sub r (Str $x, Int $y) { }; say &r.signature.params.perl; say &r.name
21:33 camelia rakudo-moar 4a32089fd: OUTPUT: «(Str $x, Int $y)␤r␤»
21:33 geospeck > "".^lookup('say').candidates>>.signature.say
21:33 geospeck ((Mu $: *%_))
21:33 geospeck > &say.signature
21:33 geospeck (| is raw)
21:33 geospeck why is different?
21:34 geospeck or | == *%_
21:34 Zoffix geospeck: without candidates you get the proto
21:35 tony-o ^
21:35 geospeck oh I see
21:35 Zoffix no, | is a capture, *%_ is a named param slurpy
21:35 geospeck thanks Zoffix!
21:37 Zoffix geospeck: above you're looking up different routines though. .^lookup is a metamethod, so you're looking up method 'say' on Str object, whereas the second call gives you the &say subroutin
21:37 Zoffix e
21:38 BrianOn99 joined #perl6
21:38 geospeck I think I need the second one
21:40 stmuk_ joined #perl6
21:41 tony-o Zoffix: you know of a way to get the uname from the uid in pp6 or nqp ??
21:43 kitsunenokenja joined #perl6
21:46 Zoffix tony-o: no idea what those are
21:49 perlpilot tony-o: you mean uid, uname as "user id" and "user name"?  If so, you may need to use NativeCall to get at the getpwuid() routine
21:50 astronavt joined #perl6
21:53 tony-o ah
21:53 tony-o perlpilot: have you used that in windows at all?  is that comp?
21:57 perlpilot oh, no.  I don't generally use Windows.
21:57 tony-o perlpilot: ty!
21:57 perlpilot I'd guess that there's some other routine that you'd use though.
21:57 * Zoffix calls it a day
21:57 Zoffix But I'll check the backlog for any ideas for examples of the `.+` methodcall op tomorrow
21:57 perlpilot maybe look to Perl 5 and the Win32 namespace to see what's done there?
21:58 perigrin There should be a POSIX call for that I think and win32 has been vaguely POSIX complient for a while
21:59 perigrin perhaps not
21:59 evalable6 joined #perl6
21:59 perigrin I may be vastly overesitmating posix
21:59 niceperl joined #perl6
22:00 bisectable6 joined #perl6
22:00 committable6 joined #perl6
22:01 perlpilot looks like getpwuid() is in POSIX, so ... maybe?
22:01 perlpilot tony-o: where did you get the uid in the first place?
22:04 Cabanossi joined #perl6
22:09 AlexDaniel squashable6: next
22:09 squashable6 AlexDaniel, ⚠🍕 Next SQUASHathon in 1 day and ≈11 hours (2017-12-02 UTC-12⌁UTC+14). See https://github.com/rakudo/rakudo/wiki/Monthly-Bug-Squash-Day
22:11 astj joined #perl6
22:11 s0me0n3-unkn0wn patrickz: I initialized cro stub and after that
22:11 s0me0n3-unkn0wn patrickz: # HELLO_HOST=localhost HELLO_PORT=20000 HELLO_TLS_KEY=/etc/ssl/private/ssl-cert-snakeoil.key HELLO_TLS_CERT=/etc/ssl/certs/ssl-cert-snakeoil.pem perl6 -Ilib service.p6
22:11 titsuki joined #perl6
22:12 s0me0n3-unkn0wn patrickz: (As root, to gain access to /etc/ssal/private; paths are standard Ubuntu certificate/key generated when system is installed)
22:13 s0me0n3-unkn0wn patrickz: After that, I can access https://localhost:20000 with curl
22:15 Ven joined #perl6
22:23 japhb s0me0n3-unkn0wn: But the fake-tls key/cert didn't work for you?
22:23 tony-o perlpilot:
22:24 tony-o m: use nqp; my $io = '/tmp/xyz'.IO; $io.spurt('test'); nqp::stat($io.absolute, 10);
22:24 camelia rakudo-moar 4a32089fd: ( no output )
22:24 tony-o m: use nqp; my $io = '/tmp/xyz'.IO; $io.spurt('test'); nqp::stat($io.absolute, 10).say;
22:24 camelia rakudo-moar 4a32089fd: OUTPUT: «1012␤»
22:25 tony-o m: use nqp; my $io = '/tmp/xyz'.IO; $io.spurt('test'); nqp::stat($io.absolute, 11).say; #gid
22:25 camelia rakudo-moar 4a32089fd: OUTPUT: «100␤»
22:26 s0me0n3-unkn0wn japhb: It didn't, should it? %?RESOURCES<fake-tls/server-key.pem> gives Nil to me
22:27 jeromelanteri joined #perl6
22:28 japhb s0me0n3-unkn0wn: Does the file exist?  I wonder if there's just a bug in finding it.
22:29 evalable6 joined #perl6
22:30 bisectable6 joined #perl6
22:30 committable6 joined #perl6
22:35 s0me0n3-unkn0wn japhb: How do I know if %?RESOURCES<fake-tls/server-key.pem> is Nil? Sorry, I'm not to good in P6 resources yet
22:35 margeas joined #perl6
22:43 konsolebox joined #perl6
22:47 s0me0n3-unkn0wn japhb: Well, I found out that %?RESOURCES is also Nil :)
22:48 timotimo that could happen when you don't have a META6.json perhaps?
22:48 tyil if it doesnt appear in the META6.json's resources key, it'll be Nil afaik
22:48 tyil or if the file doesn't exist in the resources dir
22:49 japhb Should be set up here in the sub template: https://github.com/croservices/cro/blob/master/lib/Cro/Tools/Template/HTTPService.pm6#L205-L207
22:50 tyil also, there's no :exists available on %?RESOURCES to check whether a file is set in the resources, I have looked at possibly adding that, but couldn't think up of a clean way to do it
22:50 s0me0n3-unkn0wn It does exit in filesystem and in META6.json but it is uppercase in filesystem and lowercase in META6.json, I don't know it that matters
22:51 tyil I think that will matter, as filesystems are usually case sensitive
22:51 s0me0n3-unkn0wn Mine ext4 is case-sensitive definitely :)
22:54 SmokeMachine m: use Test; my (@even,@odd); lives-ok { (:@even, :@odd) := classify { $_ % 2 ?? "odd" !! "even" }, 1,2,3,4}, "Can bind result list of classify";
22:54 camelia rakudo-moar f3b1289fd: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Cannot use bind operator with this left-hand side␤at <tmp>:1␤------> 3y { $_ % 2 ?? "odd" !! "even" }, 1,2,3,47⏏5}, "Can bind result list of classify";␤    expecting any of:␤        postfi…»
22:56 SmokeMachine m: use Test; my (@even,@odd);    lives-ok { (:@even, :@odd) := classify { $_ % 2 ?? 'odd' !! 'even' }, 1,2,3,4}, 'Can bind result list of classify';
22:56 camelia rakudo-moar f3b1289fd: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Cannot use bind operator with this left-hand side␤at <tmp>:1␤------> 3y { $_ % 2 ?? 'odd' !! 'even' }, 1,2,3,47⏏5}, 'Can bind result list of classify';␤    expecting any of:␤        postfi…»
22:56 SmokeMachine https://github.com/perl6/roast/blob/fca87f2030d5cab6fc8460e5b195aecd9b7765b2/S32-list/classify.t#L50
22:59 evalable6 joined #perl6
23:00 bisectable6 joined #perl6
23:00 committable6 joined #perl6
23:05 AlexDaniel propdump: Ⅹ
23:05 unicodable6 AlexDaniel, https://gist.github.com/9b75baef6d702454d681d43d47e28358
23:15 donaldh_ joined #perl6
23:29 evalable6 joined #perl6
23:30 bisectable6 joined #perl6
23:30 committable6 joined #perl6
23:56 cdg joined #perl6
23:58 pilne joined #perl6
23:59 evalable6 joined #perl6

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

Perl 6 | Reference Documentation | Rakudo