»ö« 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.
[equa] uh oh, looks like the string '\\\'' breaks vim perl highlighting 00:01
timotimo comments are also very, very bad for it :( 00:02
long comments, at least
[equa] that was fixed in latest version I think 00:03
timotimo oh, nice! 00:03
i might have to update that
[equa] I got a lot of issues with it before i updated. vim mainline ships with a very old version of vimperl iirc
timotimo i somehow have a vim-perl submodule, but inside it the remote is actually the exact same repo and branch that the containing repo has, what have i done? 00:07
timotimo huh, the vim-perl one i see here links to vim-perl6 for perl6 support 00:10
am i looking at the wrong thing?
timotimo anyway, i ought to go to bed, seeya! 00:19
AlexDaniel- offtopic: what was the repo with a list of companies that promised to open-source stuff but didn't? 01:22
TEttinger wall of shame thing? 01:39
AlexDaniel- TEttinger: definitely *not* this repo: github.com/Alir3z4/oss-wall-of-shame 01:45
the repo I'm talking about had a list like “On 201X-XX-XX project Y was promised to be open-sourced, as of today it's still not open-source” 01:47
TEttinger hmm
well a different thing that's a total failure list: codecurmudgeon.com/wp/iot-hall-shame/ 01:48
"smart lock bricked by update"
"smart"
NotZoffix Zoffix, stop messing around!! 05:26
NotZoffix Zoffix, stop messing around!! 05:26
perigrin oO 05:26
NotZoffix Zoffix, stop messing around!! 05:26
NotZoffix Zoffix, stop messing around!! 05:26
tyil TEttinger: anything that gets marketed with a "smart" prefix should be avoided 08:28
TEttinger "smart suppositories" 08:37
pr1_ hello, has anyone ever used p6 on Windows on an USB stick? 08:42
smls Is it possible that `Lock.protect` malfunctions when called from inside `submethod DESTROY`? 10:13
That would explain a weird bug I'm seeing in one of my scripts. 10:14
smls tries to golf it
jnthn smls: That's highly unlikely, but remember that just about *anything* can be on the call stack at the point a DESTROY is called. 10:19
smls: I had a bug in IO::Socket::Async where it deadlocked occasionally because DESTROY ran, tried to take a lock, but another lock was already held by that thread, and it set up a circular wait with another thread. 10:20
jnthn (Which was easily solved by writing my DESTROY as `start $!lock.protect: { ... }` so it scheduled the cleanup work on the pool, where we have a "clean" stack and nothing held 10:23
smls jnthn: gist.github.com/smls/dbbc512df13d1...3eb3e187f5 10:25
That pretty reliably throws "$current-action should be 'foo' but is 'DESTROY'" for me.
jnthn (Easily solved, but not easily found... :))
smls jnthn: With `DESTROY { start ... }`, won't the `...` part get an already destroyed object? 10:27
i.e. can't do clean-up that relies on attribute values anymore? 10:28
timotimo DESTROY will keep it alive a bit longer
there's no other way to properly do destructors in a gc-having language, because of potential resurrections
smls timotimo: But `start` returns immediately.
timotimo yes 10:29
it survives until the next gc run
in which case it might be held alive by whatever references the start block's closure
i'm not sure if there's something to prevent DESTROY firing multiple times for an object that got resurrected?
jnthn There is
Objects with a DESTROY method are put on a special queue at the point they are created
smls timotimo: Ah. So the `start`ed code may not get an already destroyed object then? 10:30
jnthn After each GC run, this queue is walked to see if there are any objects on it that are dead
If they are, then they are removed from the queue and and marked
So, it's "you only live twice" semantics
timotimo it's not possible to handle an "already destroyed" object in perl6. unless of course there's a bug, in which case you'll get a segfault, or internal error
jnthn The next time it becomes unreachable, then it's not in the finalize queue, and so just dies an ordinary death 10:31
Oh, and since the start block closes over self, you can clear up the attributes just fine that way :)
smls jnthn: Ah right, closures FTW once again... :) 10:32
jnthn (As in, access them, call any native code, etc.)
That's actually the reason I needed the lock in destroy in the first place: calling down to a C library
jnthn As for the gist...that looks odd 10:32
smls: ohhh 10:36
It's the very same problem I just told you about that I had in IO::Socket::Async::SSL I think ;)
smls Oh.. is the DESTROY calling `.lock` on a thread which already holds that lock, and succeeds because of `Lock` idempotence? 10:39
jnthn Correct :)
'tis a recursive lock
Yeah, given that `start atomic-action "DESTROY"` makes it go away, seems very likely 10:40
At least now I know the coffee started working :) 10:41
smls :)
smls jnthn: I openened a doc issue for the DESTROY trap: github.com/perl6/doc/issues/1606 11:18
In case you want to add someting...
jnthn Added one more thing, but looks good :) 11:24
Zoffix PSA: Geth now lives on hack, in /home/geth/geth There's a service setup, so if a restart of it is needed, you'd just do `sudo service geth restart` 12:12
tyil in a for loop, can I get the current iteration number by some default var, or do I need to add a my $i and just $i++ 12:14
jnthn for @things.kv -> $i, $value { } 12:16
moritz you can also do for @list.kv -> $index, $v { ... }
moritz too slow
tyil thanks :3 12:17
.hug moritz
huggable hugs moritz
tyil dont worry, youre still appreciated 12:18
moritz awww 12:26
smls tyil: You can also use ++$ : 12:43
m: for "a".."e" { say ++$ ~ $_ }
camelia 1a
2b
3c
4d
5e
tyil :o
now that is fancy
smls just be aware that it is not specifically tied to the loop, but rather a state variable attached to the block it's in.
$++ also works, if you want to start from 0. 12:44
tyil seems to always return 2 in my loop :(
timotimo yeah, depending on how the scope is treated, if it's nested or something, for example 12:45
smls tyil: Its state is attached to the block (curly braces) it's in 12:46
timotimo m: for ^3 { for <a b c> { say $++ ~ $_ } }
camelia 0a
1b
2c
0a
1b
2c
0a
1b
2c
timotimo see how it goes back to 0 once the outer loop runs again
m: for ^3 { state $nom; for <a b c> { say $nom++ ~ $_ } } 12:47
camelia 0a
1b
2c
3a
4b
5c
6a
7b
8c
smls tyil: So if you want it to be a loop counter, you have to put it directly in the loop block, not into a nested block inside the loop block 12:47
timotimo you can give the state variable a name and explicit scope (rather than implicitly hanging onto the innermost scope)
smls Right, as timotimo demontrated it's really just a short way to declare a state variable and increment it. 12:48
ChoHag Is Zef still the package manager du jour? 12:59
MasterDuke ChoHag: yep 13:02
ChoHag Thanks. 13:03
ChoHag Does it still attempt to byte-compile into read-only directories? 13:08
No wait that was the runtime, not the package manager. I think. 13:09
Perl6Robot OHAI! 13:14
Perl6Robot OHAI! 13:15
moritz all hail our nwo Perl 6 overrobots!
moritz *new 13:15
Perl6Robot OHAI! 13:15
Perl6Robot OHAI! 13:15
HoboWithAShotgun m: sub x { return gather { my @a = 1,2,3; take |@a }.flat; }; say x 13:17
camelia (1 2 3)
HoboWithAShotgun any way to get rid of the flat at the end?
moritz m: sub x { return gather { my @a = 1,2,3; .take for @a }}; say x() 13:19
camelia (1 2 3)
BenGoldberg m: sub x { |gather { my @a = 1,2,3; take |@a } }; say x
camelia ((1 2 3))
BenGoldberg m: sub x { |gather { my @a = 1,2,3; .take for @a } }; say x 13:20
camelia (1 2 3)
HoboWithAShotgun exactly ben :)
BenGoldberg m: sub x { gather { my @a = 1,2,3; .take for @a } }; say x
camelia (1 2 3)
HoboWithAShotgun m: sub x { gather { my @a = 1,2,3; take for @a } }; say x 13:21
camelia take without parameters doesn't make sense
in block at <tmp> line 1
in block <unit> at <tmp> line 1
HoboWithAShotgun m: sub x { gather { my @a = 1,2,3; take * for @a } }; say x 13:22
camelia (* * *)
HoboWithAShotgun m: sub x { gather { my @a = 1,2,3; take $_ for @a } }; say x
camelia (1 2 3)
BenGoldberg thinks we need some sort of .take-all method, and perhaps a matching sub
HoboWithAShotgun my gut feeling was that .take should just take a list and put its elements in the result analogous to .push 13:24
moritz it's analogous to .push, not to append 13:25
so it's not flat
HoboWithAShotgun i was surprised by its behaviour
m: my @a; my @b = 1,2,3; @a.push( |@b ); @a.say 13:26
camelia [1 2 3]
BenGoldberg m: my @a; my @b = 1,2,3; @a.append( @b ); @a.say
camelia [1 2 3]
HoboWithAShotgun and take is like neiter of those 13:27
m: sub x { return gather { my @a = 1,2,3; take |@a } }; say x 13:28
camelia ((1 2 3))
moritz m: say gather { take 1, 2, 3; take 4, 5, 6 }
camelia ((1 2 3) (4 5 6))
moritz that's pretty much how push works
moritz my @a; @a.push: (1, 2, 3); @a.push: (4, 5, 6); say @a 13:29
m: my @a; @a.push: (1, 2, 3); @a.push: (4, 5, 6); say @a
camelia [(1 2 3) (4 5 6)]
moritz m: my @a; @a.push: 1, 2, 3; @a.push: (4, 5, 6); say @a
camelia [1 2 3 (4 5 6)]
HoboWithAShotgun m: say gather { take |1, 2, 3; take |4, 5, 6 }
camelia ((1 2 3) (4 5 6))
moritz m: my @a; @a.push: 1, 2, 3; @a.push: 4, 5, 6; say @a
camelia [1 2 3 4 5 6]
moritz right, it's a bit different
HoboWithAShotgun yes, but if i do push(|something) it flattens
if i do take |something it doesnt 13:30
HoboWithAShotgun yes, and since i see take as a sugarcoated .push or maybe .append i was surprised and probably not alone so 13:31
but hey, this is good for my a new "small discoveries" post over at perlmonks 13:32
BenGoldberg The | prefix is syntactic sugar for doing slip() around the expression. 13:37
buggable New CPAN upload: Config-Parser-toml-1.0.1.tar.gz by TYIL cpan.metacpan.org/authors/id/T/TY/...0.1.tar.gz 13:50
New CPAN upload: Config-Parser-yaml-1.0.1.tar.gz by TYIL cpan.metacpan.org/authors/id/T/TY/...0.1.tar.gz
Zoffix Nah, there are two variants: prefix:<|> that's just does .Slip on the args and the | in routine args, which slips the args in. There's no slip() involved. If you'd done slip() you'd just pass one positional arg, the Slip 13:56
oh 13:57
perigrin Zoffix: Stop messing around!! 13:58
Zoffix m: sub z(|c) { dd c }; my @a = <a b c>; z |@a; z prefix:<|>(@a); z @a.Slip
camelia \("a", "b", "c")
\("a", "b", "c")
\(slip("a", "b", "c"))
perigrin (sorry ... couldn't contain myself)
Zoffix The grammar relies on prefix:<|> to use the prefix:<|> presence to do the magic?
perigrin: ?
perigrin goes to find public logs 13:59
irclog.perlgeek.de/perl6/2017-10-14#i_15301161
Zoffix Ah, yeah, it cheats and rewrites prefix:<|> call: github.com/rakudo/rakudo/blob/nom/....nqp#L6196 14:00
I thought it was just matching for `|`
perigrin: it's AlexDaniel messing around with code evals :(
perigrin Zoffix: it's confusing as hell at 3am (localtime) :)
BenGoldberg m: sub MONKEY-SEE-NO-EVAL { Bool.pick }; say EVAL '42' 14:34
camelia 42
BenGoldberg m: sub MONKEY-SEE-NO-EVAL { Bool.pick }; say EVAL "$_" for ^10;
camelia 0
1
2
3
4
5
6
7
8
9
BenGoldberg m: sub MONKEY-SEE-NO-EVAL { Bool.pick }; say EVAL "$_" for ^100;
camelia 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
5…
BenGoldberg m: sub MONKEY-SEE-NO-EVAL { False }; say EVAL "$_" for ^100; 14: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
------> 3SEE-NO-EV…
BenGoldberg m: sub MONKEY-SEE-NO-EVAL { True }; say EVAL "$_" for ^100;
camelia 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
5…
BenGoldberg m: sub MONKEY-SEE-NO-EVAL { so $++ }; say EVAL "$_" for ^100; 14:36
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
------> 3EE-NO-EVA…
BenGoldberg m: sub MONKEY-SEE-NO-EVAL { so !$++ }; say EVAL "$_" for ^100;
camelia 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
5…
BenGoldberg Derp, it's called each time EVAL is seen in the code, not each time the bit with the EVAL in it is run.
m: sub MONKEY-SEE-NO-EVAL { so !$++ }; say EVAL "'first'"; say EVAL "'second'" 14:37
camelia first
second
BenGoldberg Oh not. Hmm.
scovit Hello, I made some bindings to the DRMAA library just for fun and learning the language, v6.d.PREVIEW in this case. github.com/scovit/Scheduler-DRMAA I will add it to the ecosystem, but also like to hear some feedback maybe on the API. I took lot of freedoms. 20:39
scovit If Perl 6 will keep developing in this directions, it will take decades but will do wonders 20:40
El_Che University Cluster soft? 20:41
timotimo "in order to lunch one, or more jobs", om nom nom jobs 20:42
scovit El_Che to push stuff on those 20:43
timotimo "q:to/⬅ 完/" ♥
scovit should find more excuses to use unicode :) 20:45
jnthn scovit++ # first ecosystem implementation of the Awaitable role that I'm aware :) 21:11
timotimo jnthn: will you push the commit that introduces Sequence? or did you already do it and i missed it? 21:13
HoboWithAShotgun I can't find the code for infix:<.> 21:14
timotimo you mean method invocation? 21:15
HoboWithAShotgun aye
timotimo it's something in the grammar, not an "operator"
in a similar vein, the ! in self!foo is a method called dispatch:<!>
well, the grammar turns the syntax into a call to that
scovit jnthn++ thanks, you are doing an amazing job on concurrency 21:17
jnthn timotimo: Ahh... It's on my machien at the office, so Monday 21:19
*machine
Funnily enough, that's the one that doesn't run like a dog... :)
timotimo i'm not sure how to interpret that 21:23
isn't it good that your work machine runs great?
jnthn timotimo: Yes, it is. Sorry, it was a bad pun on my typo; chien is French for dog :) 21:39
timotimo oh!
right, i recently looked that up for some reason 21:40
timotimo i think some pun related to chat vs chien 21:41
bbiab 21:42
HoboWithAShotgun is there a nicer way to get hold of a method object other than .^methods.first({ .name ~~ $b }) ? 21:49
AlexDaniel- what about .^can($name) ? 21:51
jnthn .^lookup($b) 21:52
jnthn If you want the Method object that was declared 21:52
.^find_method($b) if you want something to invoke 21:53
Sometimes they give you the same
But sometimes not
As a rule, if you're introspecting use .^lookup, if you're messing around with intercepting dispatch, use .^find_method 21:54
AlexDaniel- that's also what the docs say here docs.perl6.org/type/Metamodel::Cla...hod_lookup
jnthn Yay, docs :) 21:56
AlexDaniel- m: say Nil.WHY 21:58
camelia No documentation available for type 'Nil'.
Perhaps it can be found at docs.perl6.org/type/Nil
»
AlexDaniel- TIL
AlexDaniel- .seen Skarsnik 22:09
yoleaux I saw Skarsnik 7 Oct 2017 20:49Z in #perl6-dev: <Skarsnik> [Alexdanielable]
HoboWithAShotgun this works hastebin.com/urudozuhem.php but is too ugly 22:10
i'd rathere have < $a^^^parent > instead of < $a^^^<parent> > 22:11
if that is at all possible with a simple operator
since the RHS is a bareword
geekosaur that would require mutating the grammar, not just tweaking an operator definition 22:13
HoboWithAShotgun that's what i thought. i'd be happy with ^^^$a.parent too but that calls the method 22:15
can't i just get a hard ref like with \ in p5?
HoboWithAShotgun and why by the sweet legs of holy sister mary poppins is there no ^invoke method? 22:19
geekosaur you may be able to use & there. alternately the value of .^can(mth) is a reference to the method mth 22:24
tyil lizmat: www.meetup.com/DomCode/events/244171361/ might be interesting to join to show off some cool stuff in perl 6 22:26
gfldex m: class C { method m {} }; C.new.^can('m')[0].CALL-ME(); 22:29
camelia No such method 'CALL-ME' for invocant of type 'Method'
in block <unit> at <tmp> line 1
gfldex HoboWithAShotgun: the problem with the .^invoke method is that it's a submethod :->
HoboWithAShotgun itt doesn't matter, i know have this 22:30
hastebin.com/bakofateke.php
way nicer. please try to break it
HoboWithAShotgun someone must come up with a good idea for this guy: unicode-table.com/de/2BED/ 22:35
we can call it the christmas tree operator 22:36
tyil makes output on STDOUT green, and on STDERR red
HoboWithAShotgun :-) 22:37
HoboWithAShotgun m: my $ດຕຖທ = 1; $ດຕຖທ.say 22:40
camelia 1
HoboWithAShotgun m: my $😕😖😗😘 = 1; $😕😖😗😘.say 22:41
camelia 5===SORRY!5=== Error while compiling <tmp>
Name must begin with alphabetic character
at <tmp>:1
------> 3my $7⏏5😕😖😗😘 = 1; $😕😖😗😘.say
expecting any of:
constraint
infix
infix st…
HoboWithAShotgun is the side arrow used in p6? <- 22:44
HoboWithAShotgun m: say 1 <- 2 22:46
camelia False
HoboWithAShotgun m: say 2 <- 1
camelia False
HoboWithAShotgun what does that do? 22:47
geekosaur that looks to me like it parsed as 1 < -2 and 2 < -1 respectively 22:52
note that perl 6 syntax is a bit context dependent, though, so that is bo guarantee that <- doesn't have a special meaning somewhere 22:53
(but the only possibility I can think of off the top of my head is one that doesn't make much sense: in a pointy block there is -> and <-> but <- would represent a write-only binding) 22:54
*no guarantee
timotimo funny enough that we call that --> rather than <--
buggable New CPAN upload: App-Bob-0.2.2.tar.gz by TYIL cpan.metacpan.org/authors/id/T/TY/...2.2.tar.gz 23:20
New CPAN upload: Hash-Merge-0.1.1.tar.gz by TYIL cpan.metacpan.org/authors/id/T/TY/...1.1.tar.gz
New CPAN upload: IRC-Client-Plugin-Github-0.1.4.tar.gz by TYIL cpan.metacpan.org/authors/id/T/TY/...1.4.tar.gz
New CPAN upload: MPD-Client-0.1.3.tar.gz by TYIL cpan.metacpan.org/authors/id/T/TY/...1.3.tar.gz
HoboWithAShotgun ha ha : imgur.com/a/rlHgg 23:23
HoboWithAShotgun i think i'll settle with 𝄆 and |: 23:31
the symbol means repeat which kinda fits
ipatrol Are the things that look like adverbs on protoregexes actual adverbs, or do they just syntactically look like them? 23:58