»ö« 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.
Geth doc: 2222abea69 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Socket/Async.pod6
Remove useless `use v6.c`

6.d is around the corner and no point in having 6.c there as I can see
01:00
synopsebot Link: doc.perl6.org/type/IO/Socket/Async
pilne i wonder if a game that duplicated the graphics level of the original quake could be run in something like perl6 these days given the advancements in hardware.... 01:58
i am trying to consolidate my obsessions >.< lol (: 01:59
wander how about delegation? I found little doc of `delegate` itself, only `handles trait` in dir typesystem, is that all of it? 03:08
docs.perl6.org/language/typesystem...it_handles
wander and should we doc delegation in dir object orient? 03:10
Herby_ I'm learning OO 03:50
How do I implement a Class counter? If I have a class Robot, and I create a bunch of Robot objects, how do I keep track of how many robots I have created? 03:51
ugexe m: class Robot { my @robots; submethod TWEAK(|) { push @robots, self; }; method hive-mind { @robots } }; Robot.new; Robot.new; say Robot.new.hive-mind.perl 03:54
camelia [Robot.new, Robot.new, Robot.new]
Herby_ hmmm 03:55
ugexe note it is a `my`, not a `has` like you might be expecting in a class 03:56
Herby_ i havent seen that submethod TWEAK(|) before 03:58
i'll have to look at that
thanks
ugexe it could be inside a BUILD or new, anything called with the constructor
moritz .tell raiph thanks, answered 06:25
yoleaux 24 Oct 2017 23:44Z <raiph> moritz: comment for you at stackoverflow.com/questions/468978...1_46920109 thanks
moritz: I'll pass your message to raiph.
sena_kun o/ 06:27
m: .parse-base(16).say for ('A'..'Z'); 06:28
camelia 10
Cannot convert string to number: malformed base-16 number in '3⏏5G' (indicated by ⏏)
in block <unit> at <tmp> line 1

11
12
13
14
15
sena_kun ah. 06:29
I've got it.
wander surprisingly, just now I read "rakudo" in Japlish way and found it mean 楽土 07:05
wander m: grammar G { rule TOP { <.ws> <external-define>* }; rule external-define { 'int main' }; }; say G.parse(" int main int main"); 08:53
camelia 「 int main int main」
external-define => 「int main 」
external-define => 「int main」
wander m: grammar G { rule TOP { <external-define>* }; rule external-define { 'int main' }; }; say G.parse(" int main int main");
camelia Nil
wander why not add <.ws> at the beginning of rules automatically? 08:54
it's what people want it to do, i think 08:55
moritz no
<.ws> terminates LTM
which is why it tends to be a bad idea to parse it at the start
so the common wisdom is to parse whitespace at the end of each rule 08:56
and add a single <.ws> call inside TOP
wander how it terminates LTM? 08:58
moritz the default ws uses ||, which is sequential 08:59
design.perl6.org/S05.html#Longest-...n_matching
timotimo also default ws has a <ww> in it, doesn't it?
no, not ww
a look-around assertion
moritz <!ww> \s* 09:00
and ww uses ||, iirc
wander bbl
moritz www.reddit.com/r/perl/comments/78l...amed_perl/ has the first naming suggestion for Perl 6 that I kinda like 09:25
"viper", where "vi" is roman for 6, and "per" is 75% of "perl" :-)
lizmat fwiw, I also like it snakiness :-) 09:30
*its
but I also think the ship has sailed, now with so many Perl 6 books out there 09:31
moritz aye, at most something like a nickname for the language 09:40
jast so many nicknames to choose from... 09:41
viperl6lang++
oh, actually I guess that's a mark against the '++', it will create bogus IRC karma :)
moritz hates perl++ as a name 09:42
ilmari can't help but mentally pronounce 6lang as glang 10:14
бlang 10:15
jast δlang... close enough 10:19
Ulti moritz: how about Perl# 10:21
>:3
jast that's nice... and search-friendly
I can do one better, though: Perl##
Ulti the framework instead of .net can be another top level domain like .fun 10:24
Perl#.fun
AlexDaniel` /o\ 10:25
Ulti what, people wanted something they can sell to their managers that sounds really corporate 10:28
pmurias perl# sounds like a .net backend 10:28
wander moritz, <.ws> goes puzzling in this case 10:32
gist.github.com/W4anD0eR96/c064633...8b618630f3
if I remove <.ws> here, the sentence will not be matched
it's too strange to me
wander ok 10:47
my example is not the little exam 10:48
*example
it is wrong, i have another rule | <.ws><identifier> '=' <assignment-expression> before it
wander the because the backtrack strategy, it fails 10:49
wander emmmm..I am reorganizing it, problem still be there 10:51
HoboWithAShotgun does Perl 6 support tail-call optimization? 12:44
lizmat not in the traditional sense, afaik 12:45
HoboWithAShotgun m: sub fact($n) { return $n == 1 ?? 1 !! $n * fact( $n - 1 ); }; say fact(1000); 12:49
camelia 40238726007709377354370243392300398571937486421071463254379991042993851239862902059204420848696940480047998861019719605863166687299480855890132382966994459099742450408707375991882362772718873251977950595099527612087497546249704360141827809464649629105…
moritz just don't do that with fib() 12:50
HoboWithAShotgun well, that didn't blow the stack
why not?
m: multi sub fact(1) { 1; }; multi sub fact($n) { return $n * fact( $n - 1 ); }; say fact(10); 12:52
camelia 3628800
HoboWithAShotgun i love this language :)
jast probably because fib can't be tail call optimized :) 12:55
jast at least not easily. a Sufficiently Smart Compiler (tm) can, of course, add memoization 12:55
but then you don't really need TCO anymore 12:56
HoboWithAShotgun adds the WP page for Memoization to the "to read, some day" list 12:58
raschipi there's "is memoized" and there's also "is pure". 12:59
raschipi is pure memoizes but at compile time 13:00
moritz no 13:06
raschipi what does it do, then?
moritz it gives the optimizer a hint that it's allowed to compile-time-evaluate it if the arguments are known at compile time too
raschipi right
raschipi thanks 13:07
moritz but there is no hard promise that an "is pure" will always inline, or that indeed that is the only semantics attached to it
HoboWithAShotgun i just benchmarked the fact function above with compile time known arguments with and without pure 13:09
no difference
[Coke] there isn't a memoized in p6, I don't think. (just cached) 13:22
HoboWithAShotgun ok so apparently is cached and recursion don't like each other. hastebin.com/gemeviqiba.pl 13:23
also, in that code, when i replace cached by pure, the pure version is reproducably 30% slower
perlpilot that makes some sense at least. You've lied to the compiler and in believing you, it does extra work :) 13:25
HoboWithAShotgun why lie? the sub has no side effects so it is "pure" 13:26
HoboWithAShotgun oh, "always produce the same output" not "always produce the same output (per given input" 13:27
raschipi no, it's for the same input, but the input has to be known at compile time 13:28
HoboWithAShotgun mmh, so an iterative solution should be faster here, because then the compiler could see the 20 and optimize, rather than recurse down to 2 13:31
perlpilot HoboWithAShotgun: "is cached" is almost specifically for recursion. I think it's that "is cached" and multi subs don't get along. 13:36
HoboWithAShotgun yes, iterative fibonacci with pure works, 10000 iterations without 2 seconds and with 0.0002 seconds. but that's not quite zero :) 13:42
HoboWithAShotgun perlpilot: indeed, i replaced the multi with a regular one and now :cached works as expected 13:47
perlpilot Maybe we should throw a NYI error like we do for methods, but I don't know off the top of my head how to determine if a routine is a multi or not. 13:50
(Or maybe, if someone is looking for something to do, they could actually implement these things so that they are no longer NYI :-) 13:51
gfldex .candidates > 1
perlpilot gfldex: oh, of course
perlpilot for some reason that word just wasn't coming to my brain. 13:52
gfldex maybe you suffered a traumatic election :-> 13:53
perlpilot heh
nah, I need to focus on work and get some stuff done rather than divide my brain amongst all of the random ways we have to distract ourselves. 13:54
HoboWithAShotgun what do you think is currently missed most in the ecosytem? name your top 3 please :)
perlpilot See? HoboWithAShotgun just teases my brain a little more :) 13:55
HoboWithAShotgun: there's a most-wanted list somewhere. Are you intending to update it?
HoboWithAShotgun more like taking one point off
it 13:56
raschipi My top three are three additional unicode operators. 13:59
HoboWithAShotgun perlpilot: when a server reboots and nobody is around, does the speaker beep? 14:01
yeah well, what operators?
raschipi take your pick: en.wikipedia.org/wiki/APL_syntax_and_symbols 14:03
DrForr Oh good god, please don't mention that again :)
jdv79 wow, the async bug eludes all that have tried. crazy. 14:05
raschipi Is it really crazy? I think it's the typical experience with async... 14:07
jdv79 i guess considering the subject its less crazy 14:08
it is really cool when it works though 14:09
AlexDaniel` vanilla-js.com/ 14:10
HoboWithAShotgun i think if you really want to be able to write X←4 5⍴⍳20, the solution would better be a mini language than shoehoring that many operators into Perl itself
raschipi HoboWithAShotgun: Sure, I said that in jest. 14:11
jdv79 im not a fan of that name - its pretty confusing
HoboWithAShotgun jest? 14:14
eater samcv: you needed me? 14:15
jast HoboWithAShotgun: =~= not serious 14:18
raschipi jest, not jast 14:19
HoboWithAShotgun no, i mean , what's "jest"? 14:22
huf joke 14:24
mspo what a jester does
huf it was jest a just, bro
jast I guess my explanation was too golfed 14:25
HoboWithAShotgun I think I'll go for implementing Lisp::Format from the most wanted list 14:28
DrForr *cough*
HoboWithAShotgun Looks like a good opportunity to get my hands wet with grammars 14:29
DrForr github.com/drforr/perl6-Format-Lisp
Not trying to dissuade you though.
HoboWithAShotgun lol. no biggie. then someone *cough* should take that off the list 14:30
DrForr Heh.
pmurias AlexDaniel`: that page really seems old looking at the frameworks they are comparing vanilla js too 14:31
HoboWithAShotgun i see you used a grammar as well 14:32
DrForr Yep. I haven't looked at error recovery. 14:36
jdv79 there's no bytes method on Str? 15:01
[Coke] which bytes would you expect? 15:02
sena_kun .encode('utf-8') you want 15:03
jdv79 the bytes it currently has
i want the real size
ok 15:04
raschipi doesn't make sense to talk about bytes without specifying the encoding. 15:05
[Coke] .NFC, .NFD might also be of interest.
jdv79 yeah, just utf8
ilmari jdv79: it can be represented internally in several different forms, which you don't care about
[Coke] m: say "ü".NFC ; say "ü".NFD
camelia NFC:0x<00fc>
NFD:0x<0075 0308>
jdv79 thanks 15:09
raschipi m: say "ü".NFC.encode('utf-8').bytes ; say "ü".NFD.encode('utf-8').bytes 15:22
camelia No such method 'encode' for invocant of type 'NFC'
in block <unit> at <tmp> line 1
raschipi Is this NIY or is there a problem with encoding one specific normalization? 15:23
Geth doc: 7ojo++ created pull request #1628:
Fixed server and client examples for IO::Socket::Async
15:25
[Coke] if you just want the # of bytes, you can use "elems" on the Uni (NFC, NFD), I think. 15:28
m: say "ü".NFD.elems
camelia 2
[Coke] you could also make a Buf out of that list of bytes.
ilmari m: say "ü".encode('utf-8').bytes 15:29
camelia 2
ilmari NFD is a list of codepoints, not bytes in any encoding 15:29
m: say my $ø = "ø\c[COMBINING DIAERESIS]"; say $ø.encode('utf-8').bytes; say $ø.NFD.elems 15:30
camelia ø̈
4
2
[Coke] ah, right, sorry. 15:31
ilmari but yes, they should have .encode methods too 15:32
raschipi thanks 16:03
Geth doc: 99407a4c94 | (Will "Coke" Coleda)++ | htmlify.p6
Remove commented out code, stale comments
16:53
doc: bedf84ac6b | (Will "Coke" Coleda)++ | htmlify.p6
Remove old TODO comment that has ticket.
doc: c46c96b77b | (Will "Coke" Coleda)++ | htmlify.p6
Remove no-proc-async option
Geth doc: 2c3f82f65b | (Will "Coke" Coleda)++ | type-graph.txt
Correct X::Temporal type graph
17:15
Geth doc/W4anD0eR96-patch-1: 0eaa8a8e2f | (Alex Chen)++ (committed using GitHub Web editor) | doc/Type/BagHash.pod6
Improve BagHash.new examples(Close #1629)

  #1629
17:39
doc: W4anD0eR96++ created pull request #1630:
Improve BagHash.new examples(Close #1629)
17:40
travis-ci Doc build passed. Alex Chen 'Improve BagHash.new examples(Close #1629) 18:05
travis-ci.org/perl6/doc/builds/292738013 github.com/perl6/doc/commit/0eaa8a8e2f99
Geth doc: 5ed8953017 | (Alex Chen)++ (committed by Zoffix Znet) | doc/Type/BagHash.pod6
Improve BagHash.new examples(Close #1629) (#1630)

  #1629
18:06
synopsebot Link: doc.perl6.org/type/BagHash
Geth doc: 7679a0cef1 | (Jarkko Haapalainen)++ (committed by Zoffix Znet) | doc/Type/IO/Socket/Async.pod6
Fixed server and client examples for IO::Socket::Async (#1628)

  * IO::Socket::Async server example using heredoc
and maybe more clearer for newcomers
  * IO::Socket::Async client example tweaks
Couple of tweaks:
  - There are issues with libuv when it defaults ipv6 when using localhost name. We can workaround that just using 127.0.0.1 instead of localhost name.
  - Added newline for print
19:04
synopsebot Link: doc.perl6.org/type/IO/Socket/Async
Geth ecosystem: erickjordan++ created pull request #377:
Update META.list
19:54
HoboWithAShotgun mmh. there's no xml sax parser? 19:55
Geth ecosystem: 6a412635af | erickjordan++ (committed using GitHub Web editor) | META.list
Update META.list
19:56
ecosystem: 5d322c3de5 | (Patrick Spek)++ (committed using GitHub Web editor) | META.list
Merge pull request #377 from erickjordan/patch-1

Update META.list
AlexDaniel` m: say <a b c>[1 xx 2] with 1 20:57
camelia (b b)
AlexDaniel` m: say <a b c>[$_ xx 2] with 1
camelia Use of Nil in string context
in block at <tmp> line 1
Unable to call postcircumfix [ (Any) ] with a type object
Indexing requires a defined object
in block <unit> at <tmp> line 1
AlexDaniel` how come $_ is Nil?
geekosaur what would be setting it there? 20:58
geekosaur * would be non-Nil, $_ should be whatever it was originally 20:59
m: dd $_
camelia Any $_ = Any
geekosaur oh, hm
so there is a question there. leak?
gfldex m: say <a b c>[Any] 21:00
camelia Use of Nil in string context
in block <unit> at <tmp> line 1
Unable to call postcircumfix [ (Any) ] with a type object
Indexing requires a defined object
in block <unit> at <tmp> line 1
geekosaur ok, that's not even talking abotu $_ then, and $_ is indeed Any
so it's an internals leak of some kind
gfldex not really
any non initialised container in a Positional defaults to Nil 21:01
AlexDaniel` oh, it's talking about string context. This makes no sense then, yeah 21:02
I was thinking about this 21:03
m: <a b c>[“$_” xx 2] with 1
camelia Use of uninitialized value $_ of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
in code at <tmp> line 1
Use of uninitialized value $_ of type Any in string context.
Met…
perlpilot m: my $x is default(42); say <a b c>[$x]; # gfldex I didn't init that container! ;-)
camelia Nil
AlexDaniel` so $_ is indeed unitialized, but without stringification it blows differently 21:04
is it a null object then or something?
m: my ($x, [$y]) = 24, [40, 50, 60]; say <a b c>[$y] 21:06
camelia Cannot resolve caller postcircumfix:<[ ]>(List, Mu); none of these signatures match:
(\SELF, Any:U $type, |c is raw)
(\SELF, int $pos)
(\SELF, int $pos, Mu \assignee)
(\SELF, int $pos, Mu :$BIND! is raw)
(\SELF, int $pos,…
AlexDaniel` shrugs
AlexDaniel` www.google.com/search?q="unititialized" 21:15
my favorite is from “The Art of Software Security Assessment: Identifying and Preventing Software Vulnerabilities” 21:17
so identifying and preventing software vulnerabilities but forgetting to turn the spell checker on?
AlexDaniel` but yeah, I guess making that mistake in a ticket title is not as bad as having it in a book :) www.google.com/search?q=%22unititi...mp;tbm=bks 21:23
anyway, ticket for the issue mentioned above: GH#1212 21:24
synopsebot GH#1212 [open]: github.com/rakudo/rakudo/issues/1212 Unitialized $_ and weird blowage (<a b c>[$_ xx 2] with 1)
AlexDaniel` wait but… it's wrong
geekosaur wrong misspelling :p
AlexDaniel` GH#1212
synopsebot: aw come on! I fixed it! Show the right version! 21:25
geekosaur synopsebot wont repeat quickly any more
it knows it just showed it
AlexDaniel` I know. Anyway, the last one seems to be much more popular in books!
Herby_ \o 23:22
moritz o/ 23:37