»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
timotimo wakelift.de/p/542f3440-7e5e-4371-b2...782e02f09/ - i'd be thankful for some proofreaders :) 01:53
leont tadzik: a blast from the past. Not my happiest past TBH 01:54
MasterDuke timotimo: cool, looks good 02:04
Nick12 hello. I read somewhere that this is *probably* the most active perl6 community space. I'm a complete newbie to perl/perl5/perl6, thinking of maybe learning a bit about it. Is this a wrong place to ask for learning material and/or ask basic questions? 04:26
leont This is the right place 04:52
Nick12 Is there a de-facto book for newcomers? (Something like the rust book) 04:53
Nick12 I found a bunch of books referenced in the faq, but is any of them fine 04:54
Nick12 I was also wondering if there are any particular use cases for the language (That it's currently used for, or that it's designed to cater to) 04:54
leont There's a graph that is supposed to help you choose at perl6book.com/
Nick12 Thank you, that's super helpful. Are there any benchmarks on how perl6 currently performs? Or guidelines on which scenarios you want to run with the jvm as back end 04:58
AlexDaniel Nick12: it is the most active space, but not in that timezone :) 05:05
Nick12: I think this is the greatest way to start: learnxinyminutes.com/docs/perl6/ 05:06
Nick12: I think you're assuming that rakudo on jvm is faster in some cases, but I don't think it is the case 05:08
if you're using the latest version of rakudo, moarvm is pretty fast. Benchmarks are weird, some short snippets are surprisingly fast sometimes (faster than other similar languages)
on average, however, it is noticeably slower than other languages :) 05:09
cpan-p6 03cpan-p6 reporting for duty! [Perl 6] 02git.tyil.nl/perl6/app-cpan-uploadnotifierbot 07:32
New module released to CPAN! App-Mi6 (0.2.6) by 03SKAJI
cpan-p6_ 03cpan-p6_ reporting for duty! [Perl 6] 02git.tyil.nl/perl6/app-cpan-uploadnotifierbot 07:57
tyil neat 07:58
tyil it's now running on my k8s infra, instead of the desktop at home 08:02
jmerelo tyil: where did you deploy the k8s infra? 08:45
tyil jmerelo: servers at leaseweb.nl 08:47
got 3 minions, a master, and a server at kimsufi to act as file storage 08:48
the master node also hosts a postgres database
jmerelo tyil: great :-) 08:51
tyil it should restart the bot automatically when errors happen now ^_^ 08:53
El_Che tyil: we opted for Nomad at work as a orchestrator. I was at DockerCon in Barcelona in december and I must say I wasn't very impressed with the Kubernetes setups I saw, it felt way overengineered almost as it was meant for setups the size of, let's say, Google. :) (I realize Kubernetes is the most popular option.) 09:17
tyil it is overengineered
I set it up because work uses it, so I wanted to learn it
jmerelo I'll check Nomad.
El_Che (and I realize that If I switch jobs, I need to get more into Kubernetes)
jmerelo El_Che: will you?
El_Che tyil: ah, ok, we have a similar stance then
jmerelo: no plans in that direction, no, but you never know when you get bored :) 09:18
so far, I can spend time on our devops infra while not being a Linux admin
so it's fun
jmerelo El_Che: there's a point in which you _wish_ you could get bored
El_Che hehe 09:19
I like to keep learning, once that is gone, I'll be a dull boy 09:20
getting older is something to take into account when changing jobs of course
and when I wanted to swiched jobs last time, there was a lot of consultancy places, I was not thrilled by it 09:21
jmerelo There's always some learning in every job. In university it's mostly things you _do_ want to learn (bar bureaucracy). In other jobs, well... 09:22
El_Che yes, I want to finished the other univeristy thing as well :) 09:23
then have a long think about what I want to do
Geth doc: 053715b3fb | (JJ Merelo)++ | doc/Language/objects.pod6
Rephrasing slightly
10:18
synopsebot Link: doc.perl6.org/language/objects
doc: 39575cc79f | (JJ Merelo)++ | 3 files
Adds target destination and some reflow

Added back /syntax/role, which disappeared due to obscure indexing rules (see #2575). Either when indexing for `does` was added (apparently, adding an index term behind or before a header suppresses the creation of a new page), or simply when the X<|declarator,role> was changed, it disappeared. It's added back, refs #2568
jmerelo releasable6: status 10:19
releasable6 jmerelo, Next release in ≈8 hours. 4 blockers. 112 out of 238 commits logged (⚠ 41 warnings)
jmerelo, Details: gist.github.com/0b6041517690058417...66105a3ad6
Geth doc: 804e4b01ca | (JJ Merelo)++ | doc/Type/Cool.pod6
Reflow and some rephrasing
10:25
synopsebot Link: doc.perl6.org/type/Cool
cpan-p6_ New module released to CPAN! Test-Util-ServerPort (0.0.2) by 03JSTOWE 10:41
Xliff m: class A { has Hash $.b is rw; method c() { %!b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a 10:52
camelia 5===SORRY!5=== Error while compiling <tmp>
Attribute %!b not declared in class A
at <tmp>:1
------> 3 rw; method c() { %!b = %( a => 42 ) } }7⏏5; my $a = A.new; $a.c; dd $a
expecting any of:
horizontal whitespace
Xliff m: class A { has Hash $.b is rw; method c() { $!b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a 10:53
camelia A $a = A.new(b => ${:a(42)})
Xliff m: class A { has Hash $.b is rw; method c() { $.b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a
camelia Cannot assign to a readonly variable or a value
in method c at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: class A { has Hash $.b is rw; method c() { self.foo = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a
camelia No such method 'foo' for invocant of type 'A'
in method c at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: class A { has Hash $.b is rw; method c() { self.b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a
camelia A $a = A.new(b => ${:a(42)})
Xliff Hmmm! 10:54
Do we really want people to be able to set an attribute using the $. form?
.tell timotimo Do we really want people to be able to set an attribute using the $. form? 10:55
yoleaux Xliff: I'll pass your message to timotimo.
jmerelo Xliff: why not? 11:12
Xliff jmerelo: $.a is for accessing only, if you want to write, you use $!a. That's what I've always known and it is in the docs. 11:17
IIRC, there used to be an error message to that effect in rakudo. 11:18
Note that self.foo works, becuase "method foo is rw"... 11:19
jmerelo Xliff: maybe you can check if there's been a regression...
Xliff jmerelo: lizmat ran a bisectable, earlier and didn't find one.
jmerelo Xliff: I'll check the docs anyway. Maybe the error is just there.
Xliff So I must be mistaken. I am also dead on my feet, so It's bedtime. 11:20
jmerelo: Thanks!
o7
jmerelo Xliff: my pleasure. Have a good rest.
.tell Xliff I have looked up the documentation, here docs.perl6.org/language/classtut#i..._accessors and it does not seem to discourage that kind of thing. However, self is not actually documented 11:27
yoleaux jmerelo: I'll pass your message to Xliff.
jmerelo m: class A { has Hash $.b is rw; method c() { $.b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a
camelia Cannot assign to a readonly variable or a value
in method c at <tmp> line 1
in block <unit> at <tmp> line 1
jmerelo m: class A { has Hash $.b is rw; method c() { $!b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a 11:28
camelia A $a = A.new(b => ${:a(42)})
jmerelo .tell Xliff self.b is actually the same as $!b
yoleaux jmerelo: I'll pass your message to Xliff.
jmerelo m: class A { has Hash $.b is rw; method c() { $!b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a; $a.b( þ => 33 ); dd $a 11:29
camelia A $a = A.new(b => ${:a(42)})
A $a = A.new(b => ${:a(42)})
jmerelo m: class A { has Hash $.b is rw; method c() { $!b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a; $a.b = þ => 33 ; dd $a
camelia A $a = A.new(b => ${:a(42)})
Type check failed in assignment to $!b; expected Hash but got Pair (:þ(33))
in block <unit> at <tmp> line 1
jmerelo m: class A { has Hash $.b is rw; method c() { $!b = %( a => 42 ) } }; my $a = A.new; $a.c; dd $a; $a.b = {þ => 33} ; dd $a 11:30
camelia A $a = A.new(b => ${:a(42)})
A $a = A.new(b => ${:þ(33)})
jmerelo m: class A { has Hash $.b is rw; method c() { $!b = %( a => 42 ); say $.b } }; my $a = A.new; $a.c; dd $a; $a.b = {þ => 33} ; dd $a 11:37
camelia {a => 42}
A $a = A.new(b => ${:a(42)})
A $a = A.new(b => ${:þ(33)})
jmerelo m: class A { has Hash $.b is rw; method c() { $!b = %( a => 42 ); say $!b } }; my $a = A.new; $a.c; dd $a; $a.b = {þ => 33} ; dd $a
camelia {a => 42}
A $a = A.new(b => ${:a(42)})
A $a = A.new(b => ${:þ(33)})
jmerelo m: class A { has $.þ is rw; method c() { $!þ = 42; say $!þ; $.þ=42; say $þ } }; my $a = A.new; $a.c; 11:43
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$þ' is not declared. Did you mean '$!þ'?
at <tmp>:1
------> 3od c() { $!þ = 42; say $!þ; $.þ=42; say 7⏏5$þ } }; my $a = A.new; $a.c;
jmerelo m: class A { has $.þ is rw; method c() { $!þ = 42; say $!þ; $.þ=42; say $.þ } }; my $a = A.new; $a.c;
camelia 42
42
jmerelo m: class A { has $.þ; method c() { $!þ = 42; say $!þ; $.þ=42; say $.þ } }; my $a = A.new; $a.c; 11:44
camelia 42
Cannot modify an immutable Int (42)
in method c at <tmp> line 1
in block <unit> at <tmp> line 1
jmerelo m: class A { has $!þ is rw; method c() { $!þ = 42; say $!þ; $.þ=42; say $.þ } }; my $a = A.new; $a.c;
camelia Potential difficulties:
useless use of 'is rw' on $!þ
at <tmp>:1
------> 3class A { has $!þ 7⏏5is rw; method c() { $!þ = 42; say $!þ; $
42
No such method 'þ' for invocant of type 'A'. Did you mean 'c'?
in method c …
jmerelo m: class A { has $!þ; method c() { $!þ = 42; say $!þ; $.þ=42; say $.þ } }; my $a = A.new; $a.c; 11:46
camelia 42
No such method 'þ' for invocant of type 'A'. Did you mean 'c'?
in method c at <tmp> line 1
in block <unit> at <tmp> line 1
jmerelo m: class A { has $!þ; method c() { $!þ = 42; say $!þ; } }; my $a = A.new; $a.c;
camelia 42
jmerelo m: class A { has $.þ; method c() { $!þ = 42; say $!þ; say $.þ } }; my $a = A.new; $a.c; 11:46
camelia 42
42
Geth doc: e18c537e1e | (JJ Merelo)++ | 2 files
Minor rephrasing and reflow
11:53
doc: 10b329f951 | (JJ Merelo)++ | doc/Language/objects.pod6
Adds self to index, and rephrases, closes #2581
synopsebot Link: doc.perl6.org/language/objects
jmerelo New wiki page in the documentation repo, just in case someone wants to have a look: github.com/perl6/doc/wiki/Document...cification 12:54
smallick a very little typo on that wiki page link, looks like *topic" 13:02
smallick what is the smallest quine in perl6? 13:06
jmerelo smallick: right. Thankis. 13:10
smallick :)
lucasb m: say $*PROGRAM.slurp 13:11
camelia say $*PROGRAM.slurp
smallick it looks like "echo $(cat $0)" 13:12
but, well
sjn funny. running that with -e fails :)
perl6 -e 'say $*PROGRAM.slurp'
jmerelo ditto in REPL 13:13
smallick m: say $*PROGRAM
camelia "<tmp>".IO
sjn echo "haxx0rd!" > -e ; perl -e 'say $*PROGRAM.slurp' # :-D 13:14
smallick sjn: s/perl(?=\ -e)/perl6/ 13:16
sjn ah yes
smallick what are the other ways, as per TIMTOWTDI 13:18
lucasb m: {.fmt($_).say}(<{.fmt($_).say}(<%s>)>) 13:19
camelia {.fmt($_).say}(<{.fmt($_).say}(<%s>)>)
lucasb haha, copied from rosettacode.org/wiki/Quine#Perl_6
jmerelo More complete document file specs: github.com/perl6/doc/wiki/Document...cification 13:20
smallick m: say "$_'$_'" given 'say "$_'$_'" given ' 13:31
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say "$_'$_'" given 'say "$_'7⏏5$_'" given '
expecting any of:
infix
infix stopper
smallick m: say "$_\\'$_\\'" given 'say "$_\'$_\'" given ' 13:33
camelia say "$_'$_'" given \'say "$_'$_'" given \'
smallick m: EVAL $_ given 'EVAL $_' 13:35
camelia 5===SORRY!5=== Error while compiling <tmp>
EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma to override this error,
but only if you're VERY sure your data contains no injection attacks)
at <tmp>:1
------> 3EVAL $_ g…
smallick every language i have seen that has eval, none of them gives such beautiful warning. 13:37
s/warning/error/
smallick m: $_ = q{$_ = q{h}; say TR/h/$_/}; say TR/h/$_/ 13:41
camelia $_ = q{$}; say TR/$/$_/
smallick m: my $a = q{my $a = q{h}; $a ~~ s/h/$a/; say $a}; $a ~~ s/h/$a/; say $a 13:45
camelia my $a = q{my $a = q{h}; $a ~~ s/h/$a/; say $a}; $a ~~ s/h/$a/; say $a
smallick can you make it more small than this 13:46
cpan-p6 03cpan-p6 reporting for duty! [Perl 6] 02git.tyil.nl/perl6/app-cpan-uploadnotifierbot 13:50
b2gills `$.b` can be thought of as `(my $ := self.b())` 16:53
jmerelo squashable6: status 17:28
squashable6 jmerelo, Next SQUASHathon in 12 days and ≈16 hours (2019-02-02 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
jmerelo releasable6: status
releasable6 jmerelo, Next release in ≈1 hour. 4 blockers. 113 out of 239 commits logged (⚠ 41 warnings) 17:29
jmerelo, Details: gist.github.com/aa3607d149919066bb...d9dd778357
jmerelo m: constant ⲧ = " " xx 4; say "{ⲧ}Tabbed" 17:57
camelia Tabbed
jmerelo m: say "π is {π}":c 18:03
camelia Unexpected named argument 'c' passed
in block <unit> at <tmp> line 1
jmerelo m: say q:c"π is {π}"
camelia π is 3.141592653589793
jmerelo m: say q"π is {π}" 18:04
camelia π is {π}
jmerelo m: say "π is {π}" 18:05
camelia π is 3.141592653589793
Geth doc: c7f7a2fb52 | (JJ Merelo)++ | 2 files
Rewriting and reflow
18:11
doc: ea96840d4c | (JJ Merelo)++ | doc/Language/objects.pod6
Changes example for role closes #2580
synopsebot Link: doc.perl6.org/language/objects
jmerelo releasable6: status 18:19
releasable6 jmerelo, Next release is just a few moments away. 4 blockers. 113 out of 239 commits logged (⚠ 41 warnings)
jmerelo, Details: gist.github.com/4fcfb10ff03c73f5d6...cf8b054e3f
Geth doc: 911f6a1183 | (JJ Merelo)++ | doc/Language/objects.pod6
Deletes tabs
18:28
synopsebot Link: doc.perl6.org/language/objects
Kaypie if i have a method that calls another method that calls the first method using $*SCHEDULER.cue with a limit on how many times it'll recurse, is there still a possibility of a stack overflow if the limit is too large? 18:40
jmerelo Kaypie: the stack overflow shouldn't be related to the Scheduler. Thread pool and stack are two different things. 18:44
Kaypie cool, thanks 18:46
jmerelo m: my @seq= 1,10,100 ... (* / (* + 1)).^name ~~ Rat; say @seq 18:47
camelia MoarVM panic: Memory allocation failed; could not allocate 24 bytes
jmerelo Er
m: my @seq= 1,10,100 ... 1e9; say ($_/($_+1)).^name for @seq 18:48
camelia Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
jmerelo m: my @seq= 1,10,100 ... 1e12; say ($_/($_+1)).^name for @seq
camelia Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
jmerelo m: my @seq= 1,10,100 ... 1e18; say ($_/($_+1)).^name for @seq
camelia Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
jmerelo m: my @seq= 1,10,100 ... 1e50; say ($_/($_+1)).^name for @seq 18:49
camelia Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num
Num…
jmerelo m: my @seq= 1,10,100 ... 1e20; say ($_/($_+1)).^name for @seq
camelia Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Rat
Num
jmerelo m: my @seq= 1,10,100 ... (* / (* + 1)).^name ~~ Num; say @seq 18:50
camelia MoarVM panic: Memory allocation failed; could not allocate 24 bytes
jmerelo m: my @seq= 1,10,100 ... (* / * ).^name ~~ Num; say @seq 18:51
jnthn .^name returns a Str, which'll never match Num
jmerelo m: my @seq= 1,10,100 ... (* / * ).WHAT ~~ Num; say @seq
jnthn Just `* / * ~~ Num` would probably do it 18:52
jmerelo jnthn: thanks. So the error is because it's simply creating an infinite sequence. But shouldn't that be lazy?
jnthn The sequence is, but assignment into an array isn't unless the thing is explicilty marked lazy 18:53
camelia (timeout)
MoarVM panic: Memory allocation failed; could not allocate 24 bytes
jmerelo m: my @seq = lazy 1,10,100 ... * / * ~~ Num; say @seq
camelia [...]
jmerelo m: my @seq = lazy 1,10,100 ... * / * ~~ Num; say @seq[30]
camelia 1000000000000000000000000000000
jmerelo m: my @seq = lazy 1,10,100 ... * / * ~~ Num; say @seq[30] .^name
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed postfix call (only alphabetic methods may be detached)
at <tmp>:1
------> 030,100 ... * / * ~~ Num; say @seq[30] .7⏏5^name
jmerelo m: my @seq = lazy 1,10,100 ... * / * ~~ Num; say @seq.elems
camelia Cannot .elems a lazy list
in block <unit> at <tmp> line 1
jmerelo m: my @seq = 1,10,100 ... * / * ~~ Num; say @seq
camelia MoarVM panic: Memory allocation failed; could not allocate 24 bytes
Xliff ., 18:55
yoleaux 11:27Z <jmerelo> Xliff: I have looked up the documentation, here docs.perl6.org/language/classtut#i..._accessors and it does not seem to discourage that kind of thing. However, self is not actually documented
11:28Z <jmerelo> Xliff: self.b is actually the same as $!b
jmerelo Hi! 18:56
El_Che jmerelo: is it? Isn't one just reading a container and the other executing a method (slower?) 19:06
bartolin Hi #perl6! 19:09
long time no see
I've heard that 6.d was released \o/ great work!
El_Che \o/ 19:10
jmerelo hi, bartolin 19:11
bartolin hopes he'll have more time for Perl 6 this year ;) 19:12
jmerelo El_Che: hum. The container must be $!
El_Che I suspect that $! is faster than self.
but I may be terrible wrong :)
jmerelo El_Che: I haven't seen any kind of discouragement, anyway.
El_Che: I seem to remember that $! is just syntactic sugar for self 19:13
bartolin: we'll be here to help, should you need it
El_Che en that case, I am wrong
sena_kun if nothing has changed lately, $! is a variable and is(or, at least, was) faster than $.foo, which is a method call. 19:14
there were talks about optimizing $.foo calls to be the same as $! when there is no custom accessor, but this stuff is tricky. I might be wrong if there were some latest changes in this regard though. 19:15
jmerelo sena_kun: and self.foo is equivalent to $.foo
sena_kun jmerelo, yes.
bartolin jmerelo: thanks (also for all the work on the docs!) 19:16
zachk uhhh, I have a perl6 chat service I wrote using cro, it listens on port 8000, I can only reach it via 127.0.0.1 not over the lan, is there a reason for this?
sena_kun jnthn, ping? ^
jmerelo m: class Foo { has $!bar; method c() { self.bar = 33; say $!bar }; my $foo = Foo.new; $foo.c() 19:17
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3ay $!bar }; my $foo = Foo.new; $foo.c()7⏏5<EOL>
expecting any of:
statement end
statement modifier
statement modifier loo…
jmerelo m: class Foo { has $!bar; method c() { self.bar = 33; say $!bar; }; my $foo = Foo.new; $foo.c()
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3y $!bar; }; my $foo = Foo.new; $foo.c()7⏏5<EOL>
expecting any of:
statement end
statement modifier
statement modifier loo…
jmerelo m: class Foo { has $!bar; method c() { self.bar = 33; say $!bar; }}; my $foo = Foo.new; $foo.c
camelia No such method 'bar' for invocant of type 'Foo'
in method c at <tmp> line 1
in block <unit> at <tmp> line 1
jmerelo m: class Foo { has $.bar; method c() { self.bar = 33; say $!bar; }}; my $foo = Foo.new; $foo.c 19:18
camelia Cannot modify an immutable 'Any' type object
in method c at <tmp> line 1
in block <unit> at <tmp> line 1
jmerelo m: class Foo { has $.bar is rw; method c() { self.bar = 33; say $!bar; }}; my $foo = Foo.new; $foo.c
camelia 33
zachk I tried shuttinf off my firewall, doesnt seem to help, on port 8000 to the lan ip I get connection refused, on another port I am not hosting on in netcat It just waits to timeout
jmerelo m: class Foo { has $!bar is rw; method c() { self.bar = 33; say $!bar; }}; my $foo = Foo.new; $foo.c 19:19
camelia Potential difficulties:
useless use of 'is rw' on $!bar
at <tmp>:1
------> 3class Foo { has $!bar 7⏏5is rw; method c() { self.bar = 33; say $
No such method 'bar' for invocant of type 'Foo'
in method c at <tmp> line 1
jmerelo m: class Foo { has $!bar; method c() { self.bar = 33; say $!bar; }}; my $foo = Foo.new; $foo.c
camelia No such method 'bar' for invocant of type 'Foo'
in method c at <tmp> line 1
in block <unit> at <tmp> line 1
jmerelo m: class Foo { has $!bar; method c() { !bar = 33; say $!bar; }}; my $foo = Foo.new; $foo.c
camelia 5===SORRY!5=== Error while compiling <tmp>
Preceding context expects a term, but found infix = instead.
Did you make a mistake in Pod syntax?
at <tmp>:1
------> 3ass Foo { has $!bar; method c() { !bar =7⏏5 33; say $!bar; }}; my $foo …
jnthn zachk: Did you pass a host to the listener? 19:20
sena_kun m: my $now = now; class A { has $.a = 0; method foo { $!a = $!a + 1 }; }; my $a = A.new; for ^100_000_00 { $a.foo; }; say now - $now; 19:21
camelia 5.1943777
sena_kun m: my $now = now; class A { has $.a = 0; method foo { $!a = $.a + 1 }; }; my $a = A.new; for ^100_000_00 { $a.foo; }; say now - $now
camelia 2.45323231
zachk oh, how would I do that? will it still listen on localhost?
jnthn zachk: `host => '0.0.0.0'` should listen on all interfaces
jmerelo sena_kun: thanks! 19:22
jnthn Just pass it in the same place you're passing the port number
zachk alright thanks, I will try that
when I make the TCP.Listener?
jmerelo m: my $now = now; class A { has $.a = 0; method foo { $!a = self.a + 1 }; }; my $a = A.new; for ^100_000_00 { $a.foo; }; say now - $now
camelia 0.7902556
jmerelo m: my $now = now; class A { has $.a = 0; method foo { $!a = $.a + 1 }; }; my $a = A.new; for ^100_000_00 { $a.foo; }; say now - $now 19:23
camelia 0.8244693
jmerelo m: my $now = now; class A { has $.a = 0; method foo { $!a = $!a + 1 }; }; my $a = A.new; for ^100_000_00 { $a.foo; }; say now - $now
camelia 0.7968864
sena_kun jmerelo, well, this "bench" is crap, so don't trust it in any bit please. :) on my machine I don't see a significant difference between those too, so I think that rule `using $!a is always faster than $.a` is not so important now.
zachk thanks jnthn , works perfectly now! is that documented anywhere? 19:24
jnthn Using $.a instead of $!a mostly means "if I'm subclassed I want to call the method a on the subclass"
jmerelo jnthn: but self.a is always exactly the same as $.a 19:25
jnthn jmerelo: Is it?
jmerelo jnthn: am asking.
jnthn Oh :)
Then use a question mark! ;-)
moritz I think $.a is itemized
jnthn No, it's $(self.a) which is self.a.item 19:26
Though the default item is a no-op
It'll only make a difference on something iterable
moritz m: class A { method x() { 1, 2, 3 }; method b() { .say for self.x; .say for $.x } }; A.b
camelia 1
2
3
(1 2 3)
moritz this demonstrates the difference
jnthn moritz++ # nice example
About performance: accessors will be inlined, and the .item will be too 19:27
jnthn And we're getting increasingly aggressive at chopping away instructions rewritten from argument handling after an inline 19:27
sena_kun was wrong for years 19:28
jnthn So it's not likely you'll see much of a difference
sena_kun: Actually some years ago there was a more significant performance difference between $!a and self.a
That there isn't now is because our optimization has got smarter
jmerelo moritz, jnthn: I don't think that itemization part is documented anywhere... 19:29
jnthn zachk: The host argument is documented in cro.services/docs/reference/cro-http-server if it's a HTTP service you're doing
Or at least, it's featured in the code example :)
Maybe we could suggest other things to try than localhost though; feel free to open an issue 19:30
sena_kun jnthn, well, I know it from your words from early Cro days, so... :) Yet I thought that $.foo is when you want to call possible accessor implemented instead of just "give me that attribute now".
jnthn sena_kun: Yes, most of the time $!a is actually the *correct* thing to use, just for its behavoir
jmerelo moritz: that's so going to the docs
El_Che so, we all ended to be kind of right :) 19:32
jmerelo m: class A { has $.x = 1, 2, 3; method b() { .say for self.x; .say for $.x } }; A.b
camelia WARNINGS for <tmp>:
Useless use of constant integer 2 in sink context (lines 1, 1)
Useless use of constant integer 3 in sink context (lines 1, 1)
Cannot look up attributes in a A type object
in method x at <tmp> line 1
in method b at <tm…
jmerelo m: class A { has $.x = (1, 2, 3); method b() { .say for self.x; .say for $.x } }; A.b 19:33
camelia Cannot look up attributes in a A type object
in method x at <tmp> line 1
in method b at <tmp> line 1
in block <unit> at <tmp> line 1
jnthn A.new.b
jmerelo m: class A { has $.x = (1, 2, 3); method b() { .say for self.x; .say for $.x } }; A.new.b
camelia 1
2
3
(1 2 3)
jmerelo jnthn++
Geth doc: 6b58e8f2a6 | (JJ Merelo)++ | doc/Language/objects.pod6
Clarifies self.a and $.a

Thanks to moritz, jnthn and El_che for clarifications
19:35
synopsebot Link: doc.perl6.org/language/objects
Kaiepi m: role A { has $!a; submethod TWEAK(:$!a) {} }; role B does A { has $!b; submethod TWEAK(:$!b) {} }; B.new.a 21:06
camelia MoarVM panic: Memory allocation failed; could not allocate 6394501 bytes
Kaiepi m: role A { has $!a; submethod TWEAK(:$!a) {} }; role B is A { has $!b; submethod TWEAK(:$!b) {} }; B.new.a
camelia No such method 'a' for invocant of type 'B'
in block <unit> at <tmp> line 1
Kaiepi m: role A { has $!a; submethod TWEAK(*%args) { callwith %args } }; role B does A { has $!b; submethod TWEAK(:$!b) {} }; B.new.a 21:07
camelia MoarVM panic: Memory allocation failed; could not allocate 6392717 bytes
Kaiepi is this a bug?
if not, how do i do this properly?
moritz I don't think callwith can ever work with a submethod 21:15
a submethod is not part of the normal method dispatch
you can expliclty call another method with self.Type::methodname() syntax 21:21
Kaiepi m: role A { has $!a; submethod TWEAK(:$!a) {} }; role B is A { has $!b; submethod TWEAK(:$a, :$!b) { self.A::TWEAK: :$a } }; B.new(:1a, :2b).a 21:39
camelia No concretization found for A
in submethod TWEAK at <tmp> line 1
in block <unit> at <tmp> line 1
b2gills m: role A { has $!a; submethod BUILD(:$!a) {}; method a {$!a<>} }; role B is A { has $!b; submethod BUILD(:$!b) {}; method b {$!b<>} }; $_ = B.new(:a(3),:b(4)); say .a; say .b 21:46
camelia 3
4
b2gills There is a reason they are submethods not methods 21:47
If they were methods then only one would get called, instead one from each part gets called
m: role A { has $!a; method a {$!a<>} }; role B is A { has $!b; method b {$!b<>} }; $_ = B.new(:a(3),:b(4)); say .a; say .b 21:48
camelia (Any)
(Any)
cpan-p6 New module released to CPAN! MessagePack-Class (0.0.2) by 03JSTOWE
b2gills `.new()` → `.bless()` → `.BUILDALL` → (`.*BUILD` & `.*TWEAK`) 21:50
b2gills Kaiepi: There is no need to have a BUILD or TWEAK call another one in another role or class because the other one will also get called anyway 21:53
Kaiepi oh 21:57
thanks
moritz m: role A { submethod TWEAK { say 'TWEAK A' } }; role B does A { submethod TWEAK { say 'TWEAK B' } }; B.new() 22:05
camelia MoarVM panic: Memory allocation failed; could not allocate 6392717 bytes
moritz b2gills: that is certainly true for classes, but doesn't seem to work with roles
b2gills m: role A { submethod BUILD { say 'TWEAK A' } }; role B does A { submethod BUILD { say 'TWEAK B' } }; B.new() 22:14
camelia MoarVM panic: Memory allocation failed; could not allocate 6392717 bytes
leont Yeah, it isn't for roles, and that can be annoying 22:17
b2gills m: role A { has $!a; submethod BUILD(:$!a) { say 'BUILD B' } }; role B is A { has $!b; submethod BUILD(:$!b) { say 'BUILD B'} }; B.new(:a(3),:b(4))
camelia BUILD B
BUILD B
b2gills m: role A { has $!a; submethod BUILD(:$!a) { say 'BUILD A' } }; role B is A { has $!b; submethod BUILD(:$!b) { say 'BUILD B'} }; B.new(:a(3),:b(4)) 22:18
camelia BUILD A
BUILD B
b2gills m: role A { submethod BUILD() { say 'BUILD A' } }; role B is A { submethod BUILD() { say 'BUILD B'} }; B.new() 22:20
camelia BUILD A
BUILD B
b2gills m: role A { submethod BUILD() { say 'BUILD A' }; submethod TWEAK() { say 'TWEAK A' } }; role B is A { submethod BUILD() { say 'BUILD B'}; submethod TWEAK() { say 'TWEAK B' } }; B.new() 22:21
camelia BUILD A
TWEAK A
BUILD B
TWEAK B
b2gills `submethod TWEAK` only seems to fail if there isn't a `submethod BUILD`. Either one you write, or one that is auto-generated. 22:23
b2gills m: role A { submethod fubar () {} }; role B does A { submethod fubar () {} }; B.new() # This is the problem 22:46
camelia MoarVM panic: Memory allocation failed; could not allocate 6407723 bytes
b2gills moritz: It is an instance of this bug: github.com/rakudo/rakudo/issues/2250 22:47
(didn't see the `is` vs `does`) 22:48