»ö« 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.
cpan-p6 New module released to CPAN! FindBin (0.3.4) by 03LEMBARK 06:11
Xliff m: my enum TriLet <AAA BBB CCC>; my %h = ( AAA => 'aaaaa' ); say TriLet.enums.Hash{'AAA'} 06:16
camelia 0
Geth doc: 9374e16717 | (JJ Merelo)++ | doc/Type/Hash.pod6
Improves examples for Hash, closes #1380, helps #2113
08:04
synopsebot Link: doc.perl6.org/type/Hash
jmerelo squashable6: status 08:12
squashable6 jmerelo, ⚠🍕 Next SQUASHathon in 4 days and ≈19 hours (2019-06-01 UTC-14⌁UTC+20). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
atweiden-air is there a more idiomatic way to do shell('head -c 64 /dev/random > /mnt/boot/volume.key'); 08:18
timotimo atweiden-air: you can build a Proc::Async and .bind-stdout("/mnt/boot/volume.key".IO.open(:w)) 08:23
i mean, you don't have to use proc stuff at all
m: say "/dev/random".IO.open(:bin).read(64) 08:24
camelia Buf[uint8]:0x<46 D9 47 7D 1C 17 BA EA 27 C3 46 5E A0 12 C7 6F 96 78 0F 0D D8 52 11 BE 93 F8 54 3C D7 F3 F2 8F 43 71 E3 44 2C 7F AD 7C 91 E0 2B 95 FC 5F 6D 84 58 36 59 4B 23 9A 58 5A 07 9F EB 49 46 DF 6C ED>
atweiden-air timotimo: thanks. 08:39
jmerelo timotimo: cool 08:40
atweiden-air timotimo: does the fh for /dev/random need to be closed somehow? 08:45
timotimo in a one-liner, no :) 08:46
atweiden-air with my Buf:D $buf = $src.IO.open(:bin).read($bytes); ? 08:47
timotimo m: say (my $fh will LEAVE { .close } = "/dev/random".IO.open(:bin)).read(64)
camelia 5===SORRY!5=== Error while compiling <tmp>
Can't use unknown trait 'will' -> 'LEAVE' in a variable declaration.
at <tmp>:1
------> 3say (my $fh will LEAVE { .close }7⏏5 = "/dev/random".IO.open(:bin)).read(64)
expecting any of:
timotimo m: say (my $fh will leave { .close } = "/dev/random".IO.open(:bin)).read(64)
camelia Buf[uint8]:0x<1F 58 DC 2A B1 2D 29 6D F1 A8 52 DD 46 F9 09 45 F6 DC 01 F9 36 31 02 8D BC CE 92 5D 16 CC F7 F8 0E 87 EE 68 3D 30 6D A1 F3 EE 11 EF 81 BE DC 54 8D 7A 65 0E C8 CD 66 58 E8 1D CC E7 C3 0C 9F AC>
jmerelo timotimo: tch, tch, using undocumented features... 08:48
timotimo: that will force us poor doccers to document them...
timotimo damn, undocumented?
jmerelo timotimo: underdocumented docs.perl6.org/language/phasers#in...will_trait 08:49
timotimo: it's kinda documented under phasers, with an example and a paragraph. Probably deserves more...
timotimo :) 08:50
jmerelo Also, most anchors are not working. I suspect it's because the new setup does not use .htaccess...
xinming_ Anyone here knows which MQ implementation is best to be used in perl6? 09:23
I plan to use rabbit mQ
releasable6: status
releasable6 xinming_, Next release in ≈25 days and ≈9 hours. 2 blockers. 140 out of 464 commits logged (⚠ 2 warnings) 09:24
xinming_, Details: gist.github.com/16542ba049b3275dcc...9e03421000
jmerelo xinming_: seem to remember that there was some AMQP driver. But you'll not have a whole lot of choices, I guess. 09:43
leont isn't fully understanding the $foo does RoleName($argument) syntax 10:22
Is it documented anywhere? 10:23
timotimo do you have an example? 10:25
i know RoleName[$argument]
MasterDuke i think there was some discussion a little while ago about how RoleName($argument) only works for a role with a single argument, you can't use it if there are multiple 10:26
timotimo oh, ok 10:27
leont Yeah, and right now I need to add a second argument :-/
leont I think I can fix in in my case by using two roles, but it's not particularly pretty :-/ 10:30
timotimo then just use [$arg1, $arg2]? 10:31
MasterDuke m: role AB[::T1, ::T2] { has T1 $.a; has T2 $.b; method ab() { dd $.a, $.b }; }; my $a = AB[Int, Str].new(a => 2, b => "cd"); $a.ab 10:38
camelia 2
"cd"
leont m: role AB[::T1, ::T2] { has T1 $.a; has T2 $.b; method ab() { dd $.a, $.b }; }; my $a = "foo" but AB[Int, Str].new(a => 2, b => "cd"); $a.ab 10:42
camelia No such method 'ab' for invocant of type 'Str+{<anon|1>}'. Did you mean 'abs'?
in block <unit> at <tmp> line 1
timotimo m: role AB[::T1, ::T2] { has T1 $.a; has T2 $.b; method ab() { dd $.a, $.b }; }; my $a = "foo" but AB[Int, Str]; $a.a = 2; $a.b = "cd"; say $a.ab 10:49
camelia Cannot modify an immutable 'T1' type object
in block <unit> at <tmp> line 1
timotimo m: role AB[::T1, ::T2] { has T1 $.a is rw; has T2 $.b is rw; method ab() { dd $.a, $.b }; }; my $a = "foo" but AB[Int, Str]; $a.a = 2; $a.b = "cd"; say $a.ab 10:50
camelia Int $!a = 2
Nil
Str $!b = "cd"
timotimo m: role AB[::T1, ::T2] { has T1 $.a is rw; has T2 $.b is rw; method ab() { dd $.a, $.b }; }; my $a = "foo" but AB[Int, Str]; $a.a = 2; $a.b = "cd"; $a.ab
camelia Int $!a = 2
Str $!b = "cd"
timotimo the nil went in the middle because stderr/stdout ordering is funny
timotimo leont: if this isn't acceptable, you can use the arguments to AB to hold your values rather than the types 10:51
of course that will mean that AB with different values but the same types won't type-match 10:52
leont Is there any way to get the short message out of an exception. .message appears to give me the long one including backtrace 11:02
timotimo .message should only give the text of the exception 11:03
maybe you're accidentally not-catching it?
or not marking it as handled when you do catch it?
leont That's what I would think. I'm calling a «say .message» in a catch handler. 11:05
timotimo do you have a default { ... } or some "when" clause? 11:06
leont fg
It's in a when clause, but I also have a default clause after it 11:07
timotimo OK, that should cause the exception to not be rethrown at least
m: die "oh no!"; CATCH { default { .message.say } }
leont Putting a say before and after the message confirms it's blowing up right there
camelia oh no!
timotimo perhaps the exception in question wrongfully puts a backtrace in its message method 11:09
that would be odd, but stranger things have happened
also possible: the message method itself throws an extra exception 11:10
leont It's X::TypeCheck::Assignment
timotimo try writing out the type of the exception before saying the .message
that shouldn't output a stack trace i don't think 11:12
leont Ah, if its $.got argument is a Failure, it does the thing
timotimo oh, haha
that's quite unfortunate :D
my $is-itself := try $.expected =:= $.got; 11:13
that doesn't disarm the failure?
leont It puts the backtrace of the Failure object ahead of the message
I just added a «use fatal» to my code, and then everything works as I would want it to
timotimo oh
that's just part of the stringification, then
a ticket is in order 11:14
including a little investigation of what other exception "message" methods do in the case of Failure being put in unexpected places
leont This is explicitly doing this
github.com/rakudo/rakudo/blob/mast....pm6#L2277 11:15
timotimo oh 11:16
you didn't mention it has the "Earlier Failure:" header
leont Yeah, I should have pasted it. I should have realised what it was. 11:17
timotimo no worries
Xliff m: role AB[::T1, ::T2] { has T1 $.a is rw; has T2 $.b is rw; method ab() { dd $!a, $!b }; }; my $a = "foo" but AB[Int, Str]; $a.a = 2; $a.b = "cd"; $a.ab; sleep 2; $a.say 11:26
camelia Int $!a = 2
foo
Str $!b = "cd"
Xliff WTF??
Why is "foo" in the middle?
timotimo because stdout and stderr 11:28
Xliff O
m: role AB[::T1, ::T2] { has T1 $.a is rw; has T2 $.b is rw; method ab() { dd $!a, $!b }; }; my $a = "foo" but AB[Int, Str]; $a.a = 2; $a.b = "cd"; $a.ab; sleep 2; $*ERR.say: $a 11:29
camelia Int $!a = 2
Str $!b = "cd"
foo
Xliff m: role AB[::T1, ::T2] { has T1 $.a is rw; has T2 $.b is rw; method ab() { dd $!a, $!b }; }; my $a = "foo" but AB[Int, Str]; $a.a = 2; $a.b = "cd"; $a.ab; $*ERR.say: $a
camelia Int $!a = 2
Str $!b = "cd"
foo
Xliff Morning, timotimo 11:30
timotimo m: my $letter = "a"; for ^20 { if Bool.pick { ($letter.=succ).lc.&say } else { ($letter.=succ).uc.&note } }
camelia b
D
c
e
g
j
k
l
n
o
q
t
u
F
H
I
M
P
R
S
timotimo m: my $letter = "a"; for ^20 { if Bool.pick { ($letter.=succ).pred.lc.&say } else { ($letter.=succ).pred.uc.&note } }
camelia A
b
g
i
k
l
m
n
s
C
D
E
F
H
J
O
P
Q
R
T
timotimo that's a funny ordering i guess? 11:31
Xliff Yah
andrzejku hello 11:32
:)
timotimo ohai
andrzejku I am just thinking today as Perl was created also as substitution of sed and awk 11:33
so is it better to learn awk in modern times?
or just programming language which allow to do all those staff
timotimo sed and awk are probably also present in, for example, a busybox installation 11:37
perl on the other hand, probably not
timotimo if you run "execsnoop" while some shell script is running, you'll see an incredible amount of forks/execs for all the little commands, btw. it's kind of amusing 11:44
if you have a munin running, it's quite a firehose
nadim_ timotimo: nice example you gave above, I need to remember that! I had to test of course ddt :flat(0), "/dev/random".IO.open(:bin).read(8) ; 12:49
nadim_ I posted this yesterday, maybe someone can have a look at it. I am not understanding how to use .VAR properly and get an exception, on the other hand dd shows perfectly formated output nopaste.linux-dev.org/?1204113 12:53
m: my @a = [1] ; dd @a ; my $b = 1 ; dd $b ; my $c = [1] ; dd $c ; 12:54
camelia Array @a = [1]
Int $b = 1
Array $c = $[1]
tobs m: my $a = 1; say $a.VAR.name; say $a.VAR.?name 13:05
camelia $a
Nil
tobs that doesn't seem right 13:06
cpan-p6 New module released to CPAN! Getopt::Long (0.1.1) by 03LEONT 13:22
tobs nadim_: I went ahead and filed R#2928 13:27
synopsebot R#2928 [open]: github.com/rakudo/rakudo/issues/2928 .VAR.?name and .VAR.name differ
leont Running into weird issues now on a module that both imports and exports an is trait 13:31
It doesn't appear to be exporting the new one :-/ 13:33
nadim_ tobs: thanks :) 13:40
Altreus I'm playing with Red but I can't figure out how to organise my schema properly. All of the examples use a flat system with no lib directory and no namespaces 14:49
So now I've come along with An::App::Schema::* and I have no idea what Red is trying to do to find things 14:50
e.g. if I have MyApp::Schema::Person with «model Person» I can't elsewhere use «:model<Person>» because it tries to find lib/Person.pm6 14:51
Altreus I was expecting «model Person» to register itself with Red and «:model<Person>» to use that 14:51
Otherwise it's going to be grossly verbose
Altreus uh no wait, it doesn't work even if I put it all in one file 14:59
gist.github.com/Altreus/7007e0eefa...d0c6d72213 # This says Could not find Reward at line 0 in: <list of INC directories>
lizmat weekly: rage.powered.ninja/2019/05/26/uniq...-rank.html 16:56
notable6 lizmat, Noted!
timotimo weekly: gist.github.com/timo/7cfe71a667bbd...0431da45a4 16:57
notable6 timotimo, Noted!
timotimo lizmat: did you already see this? :)
i should upload screenshots to that gist, too
lizmat no, didn't yet 16:58
so what do you need to do to make that work on github ?
timotimo have something like TamperMonkey installed on your browser 17:03
in tampermonkey's "dashboard" there's an "utilities" tab at the top right
it'll let you "import url" where you use the "Raw" url of the script file 17:04
the screenshots are there now
xinming_ How do we create a method with method name contains . ? 17:05
I saw github.com/bbkr/jsonrpc there is a rpc.batch method, which need to be invoked with $obj.'rpc.batch'() 17:06
That makes me curious how to declare the method name with dot.
timotimo probably only with .^add_method
xinming_ I know we can may use .^add_method
Ok, thanks. :-)
timotimo m: class test { method "foo.bar"($a) { say $a } } 17:07
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3class test { method7⏏5 "foo.bar"($a) { say $a } }
sena_kun github.com/bbkr/jsonrpc/blob/ebccb...t.pm6#L151 <-
no?
xinming_ m: class A { ::?CLASS.^add_method("a.b", { "test".say; }); }; A.new."a.b"();
camelia test
xinming_ This does work.
It's ok if no syntax support this.
sena_kun m: class A { method ::('foo.bar') {42.say} }; A.'foo.bar'() 17:08
camelia 42
xinming_ Ok, thanks.
jnthn m: class C { method ::('foo.bar') { say 42 } }; C.'foo.bar' 17:13
camelia 5===SORRY!5=== Error while compiling <tmp>
Quoted method name requires parenthesized arguments. If you meant to concatenate two strings, use '~'.
at <tmp>:1
------> 3 ::('foo.bar') { say 42 } }; C.'foo.bar'7⏏5<EOL>
jnthn m: class C { method ::('foo.bar') { say 42 } }; C.'foo.bar'()
camelia 42
jnthn Don't need .^add_method for that :)
HarmtH m: my @a; my $neg=-1; say @a[$neg;0]:exists 17:14
camelia True
HarmtH Bug or as-intended? 17:15
lizmat HarmtH: feels like a bug
hmmm.. more like a WAT maybe: 17:16
m: my @a; my $neg=-1; say @a[$neg;0]
camelia Index out of range. Is: -1, should be in 0..^Inf
in block <unit> at <tmp> line 1
lizmat m: my @a; my $neg=-1; say @a[$neg;0].Bool 17:17
camelia False
lizmat HarmtH: yeah, bug, please make an issue :-) 17:17
HarmtH Okay, will do
AlexDaniel timotimo: I'd prefer a bot that edits tickets 17:19
timotimo to put the links in? 17:20
AlexDaniel yeah
timotimo i don't think that's possible on github
AlexDaniel timotimo: huh? 17:20
aaaah they're in the code block, dammit
timotimo does GFMD allow that?
yeah
AlexDaniel well, it's possible…
timotimo would it allow putting <pre> in there as html?
AlexDaniel you'll need to use <code></code> I think
timotimo can you experiment a little and get back to me? 17:21
AlexDaniel timotimo: github.com/perl6/whateverable/issu...-496017166 17:23
you'll need to escape things, and nobody knows the exact rules for escaping… 17:24
and it'll work differently in wikis and gists
timotimo don't think i need to support wikis, but figuring out the escaping rules when nobody knows them ... sounds absolutely terrible 17:25
AlexDaniel timotimo: don't worry it'll work most of the time 17:26
timotimo ugh
AlexDaniel :)
hmm what does whateverable use to add links to gists 17:27
like if the bot gets an exception in its own code
timotimo: github.com/perl6/whateverable/blob...es.pm6#L70 17:28
# let's hope for the best ↓ 17:29
“<a href="$href">{$<path>}</a>” ~
timotimo ahahaha
AlexDaniel heh, role Enough 17:31
that codebase is fun to read sometimes 17:32
lizmat weekly: blogs.perl.org/users/laurent_r/2019...-perl.html 17:40
notable6 lizmat, Noted!
nadim_ is there a short notation to check id an array only contains a specific value or type? something like @a ~~ only_one(True) 18:04
ie I want to check if @a only contains True 18:06
xinming_ all?
nadim_ hmm, maybe I check 18:07
timotimo @a.all eqv True 18:08
xinming_ m: my @a = (True xx 5); (@a.unique.elems == 1 and @a[0] == True).perl.say;
camelia Bool::True
xinming_ This is shortest I can get
Can we use == to compare Bool value?
timotimo you can
nadim_ yes
timotimo but then 1 will also match True and 0 will also match False
xinming_ m: my @a = (True xx 5); (@a.all eqv True).perl.say;; 18:09
camelia all(Bool::True, Bool::True, Bool::True, Bool::True, Bool::True)
xinming_ m: my @a = (True xx 5); (@a.all eqv True).perl.say;
camelia all(Bool::True, Bool::True, Bool::True, Bool::True, Bool::True)
nadim_ m: my @a = (True, True) ; @a.all eqv True
camelia WARNINGS for <tmp>:
Useless use of "eqv" in expression ".all eqv True" in sink context (line 1)
xinming_ m: my @a = (True xx 5); ?(@a.all eqv True).perl.say;
camelia WARNINGS for <tmp>:
all(Bool::True, Bool::True, Bool::True, Bool::True, Bool::True)
Useless use of "?" in expression "?(@a.all eqv True).perl.say" in sink context (line 1)
xinming_ m: my @a = (True xx 5); (?(@a.all eqv True)).perl.say;
camelia Bool::True
xinming_ m: my @a = (True xx 5, False); (?(@a.all eqv True)).perl.say; 18:10
camelia Bool::False
xinming_ So, ?(@a.all eqv True) is what we want.
nadim_ m: my @a = (True, True) ; ?(@a.all eqv True) 18:10
camelia WARNINGS for <tmp>:
Useless use of "?" in expression "?(@a.all eqv True)" in sink context (line 1)
nadim_ m: my @a = (True, True) ; (?(@a.all eqv True)).say
camelia True
nadim_ no since more than one True is still true 18:11
m: my @a = (True, True) ; (?(@al eqv [True])).say
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@al' is not declared
at <tmp>:1
------> 3my @a = (True, True) ; (?(7⏏5@al eqv [True])).say
nadim_ m: my @a = (True, True) ; (?(@a eqv [True])).say
camelia False
nadim_ m: my @a = (True) ; (?(@a eqv [True])).say
camelia True
xinming_ m: my @a = (True xx 5, False); (?(@a.all eqv True)).perl.say; 18:12
camelia Bool::False
nadim_ a simple eqv works best
xinming_ m: my @a = (True xx 5); (?(@a eqv True)).perl.say;
camelia Bool::False
nadim_ m: my @a = (True) ; (?(@a ~~ [True])).say
camelia True
nadim_ m: my @a = (True, True) ; (?(@a ~~ [True])).say
camelia False
nadim_ while on this short notition trip, is there a way to write $a ~~ 'x' ?? $a !! 'y' ? 18:16
timotimo if $a is a long variable name you can use postfix given to shorten it to $_ 18:17
nadim_ that's one good idea but what I really meant was another way to write ?? !! but now I write it down I see that it's a bit silly :) 18:19
the real code is this: $clone.flat ~~ [True] ?? [0] !! $clone.flat 18:20
I want to replace a single True with 0
because @.flat, if I set it with :flat gets True inside the array and I want :flat to mean "initialize" the array with a single zero 18:21
timotimo there's "and" and "or", but that might still not be what you want
nadim_ I want :flat to put a singlezeroin flat, not True 18:22
nadim_ at other times :flat can be initialized with more arguments but without arguments I want a single 0 18:22
xinming_ m: sub x ($x) { temp $x = "5"; $x.perl.say; }; x(3); 18:37
camelia Cannot assign to a readonly variable or a value
in sub x at <tmp> line 1
in block <unit> at <tmp> line 1
xinming_ Is this a bug?
or, we can't temp a ro variable is desired behavior.
nadim_ m: sub x ($y) { temp $x = "5"; $x.perl.say; }; x(3); 18:40
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$x' is not declared
at <tmp>:1
------> 3sub x ($y) { temp 7⏏5$x = "5"; $x.perl.say; }; x(3);
xinming_ temp no exist var is definitely error, but to the ro variable, I think we should allow it to be temp'ed 18:41
timotimo that was just a typo i think? 18:42
i thought you can only use temp with a variable name that exists further outside?
nadim_ xinming_: I think it is intended as you can't re assign the variable upon inner scope exit
timotimo: yes it was a typo, I wnated to make a change, removed it but not all of it 18:43
docs says "Upon exiting the scope, the variable will be restored to its original value"
maybe a warning when temporizing a ro would be nice, even though it will generate a fault at scope exit 18:44
xinming_ timotimo: So, it's designed like this, right? 18:45
timotimo i think so? 18:49
xinming_ timotimo: I mean, we can't temp a ro variable, it's not a bug, right? 19:28
timotimo i don't know :( 19:35
xinming_ Is there a way to enter a readline interpreter after the script reaches end? 20:46
I mean set the breakpoint 20:47
zostay m: IO::Socket::Async.udp(:broadcast); 21:13
camelia An operation first awaited:
in block <unit> at <tmp> line 1

Died with the exception:
bad file descriptor
in block <unit> at <tmp> line 1
zostay That's documented on docs.perl6.org, but I don't see the :broadcast flag listed in roast. I can't figure out how to get it to work. 21:14
Geth perl6.org: 079961d179 | lukasvalle++ | 2 files
fix broken links
21:16
Voldenet Why not just: use MONKEY-SEE-NO-EVAL; for lines() { CATCH { .say; next }; EVAL($_) } 21:22
Yeah, it's not readline interpreter, but it probably covers a lot of use cases 21:23
+ rlwrap 21:24
TreyHarris I'm getting warned by the perl6-users ezmlm daemon that some of my messages are bouncing. But the report says Gmail's rejecting them with, "Our system has detected that this message does not meet IPv6 sending guidelines regarding PTR records and authentication. Please review support.google.com/mail/?p=IPv6AuthError for more information." Could someone point me in the direction of the person I should 22:14
direct this to?
timotimo maybe it's a noc.perl.org thing?
TreyHarris timotimo: Thanks 22:18