»ö« 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.
tushar I would like to add an element in an array at specific index. When I add the element, I don't want to replace the old element value with new rather I would like to shift the elements to the right. I hope that make sense. How can I achieve that? E.g. "Input --> my @a = [1,2,3]; --- add element at specific index and shift other elements on right -- @a = [1,4,2,3]" 00:45
timotimo that's what splice is for 00:47
geekosaur docs.perl6.org/type/Array#routine_splice
timotimo splice is really "at index i, remove n elements and replace them with this list: ..."
so you'll just be removing 0 elements
tushar timotimo: I thought so.. Thanks.. 00:48
dalek href="https://perl6.org:">perl6.org: 7b463a5 | (Angelo Compagnucci)++ | includes/menu-nav:
doc.perl6.org not prominent enough

  * Documentation now point to docs.perl6.org
  * Added Resources pointing to /documentation/
Fixes: #48
00:54
href="https://perl6.org:">perl6.org: dc08a96 | (Zoffix Znet)++ | includes/menu-nav:
Merge pull request #56 from angeloc/issue_48

  doc.perl6.org not prominent enough
BenGoldberg m: my @a = 1..3; @a.splice 1, 0, 4; @a.say;
camelia rakudo-moar ed0ced: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3my @a = 1..3; @a.splice7⏏5 1, 0, 4; @a.say;␤ expecting any of:␤ infix␤ infix stopper␤ statement end␤ statement modifi…»
timotimo ^- i am quite okay with that
the perl6.org change, that is
BenGoldberg m: my @a = 1..3; @a.splice: 1, 0, 4; @a.say;
camelia rakudo-moar ed0ced: OUTPUT«[1 4 2 3]␤»
BenGoldberg tushar, ^
tushar BenGoldberg: thanks. Still, I am not quite use to with the syntax without parenthesis. I just followed the syntax that shown in Perl6 doc. But it's good to know. 00:57
tushar m: my @a = [1,2,3]; @a.splice(2,0,4).say; 00:58
camelia rakudo-moar ed0ced: OUTPUT«[]␤»
tushar m: my @a = [1,2,3]; @a.splice(2,0,4); @a;
camelia rakudo-moar ed0ced: OUTPUT«WARNINGS for <tmp>:␤Useless use of @a in sink context (line 1)␤»
tushar m: my @a = [1,2,3]; @a.splice(2,0,4); @a.say;
camelia rakudo-moar ed0ced: OUTPUT«[1 2 4 3]␤»
tushar Can I replace multiple values at the same time? 01:00
Meaning adding multiple values at multiple indexes of an array and shifting the existing values. All at the same time. I hope that make sense. 01:02
tushar m: my @a = [1,2,3]; @a.splice([0..1],0,[4..5]); @a.say; 01:03
camelia rakudo-moar ed0ced: OUTPUT«Memory allocation failed; could not allocate 87040 bytes␤»
tushar uhhh... Here is the output that I got while running above in REPL. Ouptut --> [1 2 4 5 3] 01:04
Looks like it took the last index i.e. 1 in and add new values after it. 01:05
tushar @a; 01:09
tushar m: my @b = [[1..3],[4..6]]; @b.splice[0,0,[7..8]); @b.say; 01:14
camelia rakudo-moar ed0ced: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in subscript; couldn't find final ']' ␤at <tmp>:1␤------> 3 = [[1..3],[4..6]]; @b.splice[0,0,[7..8]7⏏5); @b.say;␤ expecting any of:␤ statement end␤ …»
tushar m: my @b = [[1..3],[4..6]]; ; @b.splice(0,0,[[7..8]]); @b.say; 01:15
camelia rakudo-moar ed0ced: OUTPUT«[7 8 [1 2 3] [4 5 6]]␤»
tushar In above, the array get flatten. I would like to get output like this -- [[7,8],[12,3],[4,5,6]]. How can avoid array flattening? 01:16
I hope I am clear enough
MasterDuke m: my @b = [[1..3],[4..6]]; ; @b.splice(0,0,[[7..8],]); @b.say; 01:18
camelia rakudo-moar ed0ced: OUTPUT«[[7 8] [1 2 3] [4 5 6]]␤»
AlexDaniel Haha. “Definitely there is no need to repeat that 4 four times.” – but apparently there is a need to repeat number 4 two times. // #125596 01:19
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=125596
tushar MasterDuke++ 01:21
AlexDaniel alright, I'm failing to find a bug report 01:21
my gut says that there was one
MasterDuke tushar: that's an example of the single argument rule in action 01:22
which i'm just creating an issue in the docs for now because it should be listed/searchable
tushar MasterDuke: can you be little more expressive? Can I adapt that for my work or is it an issue? 01:23
AlexDaniel /o\ wtf 01:24
m: my @a = < aaa bbbbb cc >; say max @a, :by(*.chars > *.chars)
camelia rakudo-moar ed0ced: OUTPUT«bbbbb␤»
AlexDaniel m: my @a = < aaa bbbbb cc >; say min @a, :by(*.chars > *.chars)
camelia rakudo-moar ed0ced: OUTPUT«aaa␤»
AlexDaniel alright, yes?
m: my @a = < aaa bbbbb cc >; say @a.max: :by(*.chars > *.chars)
camelia rakudo-moar ed0ced: OUTPUT«cc␤»
AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.min: :by(*.chars > *.chars)
camelia rakudo-moar ed0ced: OUTPUT«aaa␤»
AlexDaniel ??
in other words, :by is just ignored 01:25
I've seen that some time ago, can anybody remember a ticket title or something?
MasterDuke tushar: sure you can use that. is isn't really an issue, just something that people don't always realize at first
AlexDaniel by the way, it is even worse: 01:26
m: my @a = < aaa bbbbb cc >; say sort @a, :by(*.chars > *.chars)
camelia rakudo-moar ed0ced: OUTPUT«Unexpected named argument 'by' passed␤ in block <unit> at <tmp> line 1␤␤»
MasterDuke AlexDaniel: i've seen a similar ticket also
rt.perl.org/Ticket/Display.html?id=115758
AlexDaniel if only bisectable was here… perhaps it worked some time ago
tushar MasterDuke: Thanks.. 01:27
AlexDaniel not a bug? Not funny 01:28
BenGoldberg m: < aaa bbbbb cc >; @a.sort(:by(*.chars)).say;
camelia rakudo-moar ed0ced: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '@a' is not declared␤at <tmp>:1␤------> 3< aaa bbbbb cc >; 7⏏5@a.sort(:by(*.chars)).say;␤»
BenGoldberg m: < aaa bbbbb cc >.sort(:by(*.chars)).say;
camelia rakudo-moar ed0ced: OUTPUT«(aaa bbbbb cc)␤»
BenGoldberg m: < aaa bbbbb cc >.sort(*.chars).say; 01:29
camelia rakudo-moar ed0ced: OUTPUT«(cc aaa bbbbb)␤»
bstamour Quick question for anyone who can help me out. What does the line "use v6" actually do?
Does it matter if I only run my scripts through a perl 6 interpreter?
BenGoldberg Nothing, except that it makes perl5 bail out.
bstamour Ah, so in case I accidentally fire it through the wrong program 01:30
Thank you
BenGoldberg Right. Many perl5 and perl6 modules end in .pm or .pl
bstamour Makes sense. 01:30
AlexDaniel it makes sense to use .pm6 and .p6 ;)
BenGoldberg The newest version of perl5 will automatically use the C-level exec() function to replace itself with perl6, if the first line starts with a # and contains 'perl6' somewhere in it. 01:31
AlexDaniel m: my @a = < aaaaa bbbbb cc >; say unique @a, :with(*.chars == *.chars) 01:35
camelia rakudo-moar ed0ced: OUTPUT«(aaaaa cc)␤»
AlexDaniel /o\
so it is :by for some things and :with for others
/o\ 01:36
AlexDaniel my biggest problem with it however is this: 01:36
m: my @a = < aaaaa bbbbb cc >; say unique @a, :as(*.chars)
camelia rakudo-moar ed0ced: OUTPUT«(aaaaa cc)␤»
AlexDaniel unique has a very useful :as parameter
yet nothing else has it, as far as I can see 01:37
just imagine: @a.sort(as => *.chars)
just imagine: @a.max(as => *.chars)
very readable, no *.chars ><= *.chars crap
I will open a few tickets for these. Feel free to start a holy war there. 01:39
AlexDaniel MasterDuke: can you try clicking a “New ticket” button in RT? 01:42
I'm wondering if it is broken for everyone or just for me 01:43
MasterDuke AlexDaniel: blank page
AlexDaniel :(
[Coke] broken here too. i'll ping the rt admins 01:45
AlexDaniel [Coke]: thank you 01:49
MasterDuke m: sub foo($a where {* < 5 and * > 2}) {dd $a}; foo(6) 01:55
camelia rakudo-moar ed0ced: OUTPUT«Int $a = 6␤»
MasterDuke m: sub foo($a where * < 5 and * > 2) {dd $a}; foo(6)
camelia rakudo-moar ed0ced: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed parameter␤at <tmp>:1␤------> 3sub foo($a where * < 57⏏5 and * > 2) {dd $a}; foo(6)␤ expecting any of:␤ constraint␤ infix␤ infix stopper␤»
MasterDuke m: sub foo($a where {* < 5}) {dd $a}; foo(6) 01:56
camelia rakudo-moar ed0ced: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed double closure; WhateverCode is already a closure without curlies, so either remove the curlies or use valid parameter syntax instead of *␤at <tmp>:1␤------> 3sub foo($a where {* < 5}7⏏5) …»
MasterDuke bug that the first one didn't give me the same error as the last?
AlexDaniel MasterDuke: it is less than awesome 02:01
fwiw: github.com/rakudo/rakudo/blob/5f91....nqp#L6034
MasterDuke thanks, hadn't found it yet 02:03
dalek c: c776b84 | MasterDuke17++ | doc/Type/Signature.pod6:
Fix typos and grammaros in Signature
02:16
BenGoldberg m: constant μ = Mu; my μ $x = &say; dd $x; 02:20
camelia rakudo-moar ed0ced: OUTPUT«Sub $x = sub say (| is raw) { #`(Sub|51498416) ... }␤»
[Coke] the "new ticket" button was deliberately disabled following a big spam attack on the p5 queue. 02:56
(today)
abuse prevention measures need to be put into place. (volunteers welcome, but I don't know what skill sets are needed0 02:57
perlawhi1l AlexDaniel: I brought up my concerns with sort about 5 months ago, but it never really went anywhere 03:19
I put up a gist here: gist.github.com/0racle/134921795a6...554492d824
AlexDaniel uhh! 03:19
perlawhi1l the crux of the issue is that unique takes a named parameter, whereas most of these other methods take a code block 03:20
i feel it's not really consistent, and certainly not dwimmy 03:22
AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.max: :by(*.chars > *.chars) 03:36
camelia rakudo-moar ed0ced: OUTPUT«cc␤»
AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.max: *.chars
camelia rakudo-moar ed0ced: OUTPUT«bbbbb␤»
AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.min: *.chars
camelia rakudo-moar ed0ced: OUTPUT«cc␤»
AlexDaniel oh, alright
andrzejku hello my friends x) 06:38
perlawhi1l hello 06:48
andrzejku perlawhirl, are you guy from whirlpool? 06:49
perlawhirl nope.
andrzejku oh okay, your nickname suggest it
perlawhirl well.. i have an account, but i haven't been there in 10 years or so
moritz \o 07:10
ufobat morning perl6 :) 07:11
andrzejku hello :) 07:12
RabidGravy boom! 07:29
andrzejku last days I tried to play with avr chips 07:39
and all failed :(
masak good antenoon, #perl6 08:15
moritz \o masak 08:27
arnsholt mst: I retract any previous statements I have made about OpenSSL. It's precision-engineered to drive people insane >.< 08:34
TEttinger arnsholt, I believe it
why does it have a heartbeat function anyway 08:35
"madness"
zengargoyle TEttinger: firewalls and session timeouts. 08:43
no traffic for X minutes, NAT session times out, remote sends data and fails, session lost. 08:44
TEttinger could that be resolved without exposing a buffer overflow vulnerability for much of the internet? :)
zengargoyle most probably 08:46
masak ...nah :)
Woodi_ hi #perl6 :) 08:56
arnsholt: if someone want simler cryptography would be enought to extract from OpenSSL number generators, algoritms and drop eg. network code, (always buggy) ASN.1, file formats ? 08:59
...drop anything X.50X related ? 09:00
arnsholt Woodi_: Probably 09:12
Of course, the X509 stuff and friends is a core part of SSL/TLS
So you'll only get so far with just the crypto
Woodi_ arnsholt: I just want math parts :) equations, pluses minuses. rest is totally ecosystem... 09:18
but probably I know nothing about network security :)
SSL/TLS is total foobar, it should be replaced 09:21
fubar even :)
zengargoyle i tend to prefer vpn like solutions where possible. vpn or ipsec or wireguard between boxes. then it's sorta a no brainer, remote side IP is just at secure as talking to localhost. 09:22
zengargoyle Woodi_: if you just want crypto, maybe check www.wireguard.io/ ... it's a linux kernel module vpn/ipsec replacement based on pre-shared keys and "WireGuard uses state-of-the-art cryptography, like the Noise protocol framework, Curve25519, ChaCha20, Poly1305, BLAKE2, SipHash24, HKDF, and secure trusted constructions. It makes conservative and reasonable choices and has been reviewed by 09:31
cryptographers."
dalek c: 9008874 | (Tom Browder)++ | doc/Language/modules.pod6:
correct spelling of possessive 'its'
09:35
Woodi_ zengargoyle: would be nice to split that even more, extracting math and numbers calculations into more understendable form. vpns like systems shoould be everydays tools for businesses but as we know vpns was backdored long time ago (in OpenBSD) :) 09:39
dalek c: e5ddbfe | gfldex++ | doc/Language/functions.pod6:
fix typo
09:56
Ulti has anyone reported a borken OSX build? 11:39
noticing its since I updated to the latest XCode
"Symbol not found: _clock_gettime"
I can try and hunt down where this has moved to if no one is already checking it out 11:40
Ulti full output gist.github.com/MattOates/45e87e3a...f396a56c01 11:44
moritz I'm not aware of anybody chasing it down 11:46
Ulti looks like its a problem for a lot of people over a tonne of projects for this version of XCode+OSX 11:47
OSX 10.11.6 XCode 8.0 11:48
the current solution online is update the whole of your OS :Z 11:49
moritz does that make it OS Y? :-) 12:10
El_Che Ulti: be careful when upgrading the OS. The signature needed to downgrade is only valid a short period of time. 12:16
ios :)
oh, I am too early? Give it a few years :)
[Coke] I am on xcode 8.0 (8A218a) and have noticed no issues. 12:43
bdmatatu Is it possible to use nqp::sha1 (or is there a related nqp function) to compute the sha1 of bytes that are not valid UTF-8? 12:51
gfldex m: use nqp; say nqp::sha1("abc"); 12:56
camelia rakudo-moar 5a3df8: OUTPUT«A9993E364706816ABA3E25717850C26C9CD0D89D␤»
gfldex bdmatatu: ^^^ possible but may be unwise
andrzejku hey guys 12:58
why no-one tried to write llvm perl6 interpreter?
perlpilot andrzejku: I think it's because llvm is more of a VM toolkit than a VM 12:59
bdmatatu gfldex: oh, too bad...nqp::sha1 is very fast, was hoping to use it as part of an hmac computation 13:00
gfldex bdmatatu: you can test if you are on rakudo and if not provide a Perl 6 variant or load a module 13:01
bdmatatu: right now it's a little tricky to have automatic tests for not being on Rakudo tho (hence my unwise-remark) 13:02
bdmatatu gfldex: unfortunately it only seems to work for utf-8, so this makes it unsuitable for hmac (since it calls the hash twice, once with potentially invalid utf-8 bytes) 13:03
DrForr bdmatatu: IIRC there's a Digest::HMAC, are you working with that?
bdmatatu I tried that, but was looking to improve performance.
(of the hash part, not the hmac part) 13:04
DrForr Nice.
perlpilot bdmatatu: I'd guess that the underlying sha1 implementation works on arbitrary octets and the only reason nqp::sha1 says anything about UTF-8 is because you have to feed it a str. Maybe someone could change it to be encoding agnostic? 13:11
hackedNODE gfldex: why is it tricky? 13:12
hackedNODE m: $*PERL.compiler.name.say 13:13
camelia rakudo-moar 5a3df8: OUTPUT«rakudo␤»
hackedNODE Oh, you mean at nqp level. Nevermind
gfldex hackedNODE: no i meant testing it against a non-Rakudo 13:14
jnthn fwiw, the nqp::sha1 op is built for the specific purpose of hashing source code for dependency management purposes, and isn't really intended to be exposed/used more widely. 13:14
[Coke] adds that to the docs. 13:22
dalek c: 99a8666 | (Tom Browder)++ | doc/Type/Signature.pod6:
add example of type constraint on an optional argument
13:23
nine 5~/win 13 13:37
masak m: sub infix:<~/win>($l, $r) { $l / $r }; say 5~/win 13 13:40
camelia rakudo-moar 5a3df8: OUTPUT«0.384615␤»
masak irssi window division :) 13:41
jnthn m) 13:44
andrzejku hey should someone explain me 13:47
some details about nap
nqp
timotimo OK, like what?
andrzejku nap is something similar to perl? 13:48
andrzejku nqp 13:48
timotimo "not quite perl6"
it's what we use to implement rakudo 13:49
andrzejku rakudo is perl6?
timotimo rakudo is our perl6 compiler
andrzejku okay
so
timotimo there used to be other projects, but only rakudo remains in active development
andrzejku why nqp was invented at all? 13:50
why just not to write perl6 interpreter
in C or C++
whatever
timotimo rakudo started on Parrot. it would have been terrible to write rakudo completely in parrot's assembly-language
andrzejku and when the basic Perl6 things were implemented "they" will be used to implement standard library 13:51
timotimo there's currently a project that writes a perl6 compiler in C++
andrzejku ohh 13:52
timotimo, I am looking for it
where can I find it?
timotimo good question
timotimo github.com/Itay2805/Perl6-Native-Compiler 13:52
there it is
oh, look at the first line of the readme
i don't see a repo for a native nqp compiler, though 13:53
andrzejku timotimo, sorry [kid] will be soon back 13:58
timotimo i might be AFK when you return
andrzejku ok
hackedNODE andrzejku: one of the benefits is the compiler is more accessible to Perl 6 *users* to hack on. nqp really has a feel of a Perl 6 module for a lot of things. The grammar that parses Perl 6 is pretty much the same grammar users of Perl 6 use, etc. Many parts of Rakudo would require knowledge of Perl 6 only to modify, and the end-goal is to as much as possible of Rakudo in Perl 6. 14:08
s: Hash, 'classify-list'
SourceBaby hackedNODE, Sauce is at github.com/rakudo/rakudo/blob/5a3d...sh.pm#L309
hackedNODE andrzejku: ^ any Perl 6 user can fix a problem in that method. But if Rakudo were written in C, they would need to know C to do so. 14:08
hackedNODE plugs perl6.party/post/Perl-6-is-written-in...-Perl-6 14:09
hackedNODE andrewalker: also: optimizations. It's easier to optimize a subset than a huge language. 14:11
timotimo on top of that, nqp has a few limitations that make optimization a whole lot more feasible 14:12
andrzejku hackedNODE, I don't think to let users modify just for fun 14:15
is good idea
it is better if they write libs which extend language
timotimo this isn't really about "modify perl6 for fun", it's about "please help us with core development" 14:16
skids m: class A { has $!a = Channel.new; sub s($a) { start { my $r = 42; react { whenever $a { "{$r.VAR.name} == {$r.perl} {$r.VAR.WHICH}".note; LAST { "{$r.VAR.name} == {$r.perl} {$r.VAR.WHICH}".note } } } } }; has $!t = s($!a); method f { $!a.send(0) }; method DESTROY {$!a.close} }; use nqp; A.new.f; for 0..5 {sleep 0.1; nqp::force_gc; Rat.new}; # ok 14:17
camelia rakudo-moar 5a3df8: OUTPUT«$r == 42 Scalar|140475831250104␤$r == 42 Scalar|140475831250104␤»
timotimo on the other hand, making it easier for users to change rakudo and nqp for their purposes is also good
skids m: class A { has $!a = Channel.new; sub s($a) { start { my $r = 42; react { whenever $a { "{$r.VAR.name} == {$r.perl} {$r.VAR.WHICH}".note; LAST { "{$r.VAR.name} == {$r.perl} {$r.VAR.WHICH}".note } } } } }; has $!t = s($!a); method f { }; method DESTROY { $!a.close } }; use nqp; A.new.f; for 0..5 {sleep 0.1; nqp::force_gc; Rat.new}; # Where'd my 42 go?
camelia rakudo-moar 5a3df8: OUTPUT«$r == Any Scalar|63362808␤»
skids It seems the local variable scope does not get constructed until the whenever gets normally entered. 14:18
hackedNODE andrzejku: I'm not sure what you mean by "modify for fun". The implication being that making the codebase more accessible somehow makes it more prone to unauthorized edits? :) 14:20
timotimo open source software is super insecure because anyone can just go and edit the code! 14:21
andrzejku I don't mean prone
timotimo imagine all the backdoors and viruses you get!
grondilu is currently writing some javascript and misses a lot of perl6 features, but when he reads about ES6 he realizes that most of these features are in ES6 or will come soon.
hackedNODE andrzejku: making the compiler in Perl 6 makes the number of people capable of improving the compiler proportionate to the number of people interested in those improvements.
andrzejku I think it makes Perl much more slower 14:22
skids Until the compiler is improved, sure :-)
hackedNODE andrzejku: slower to... what?
grondilu basically is wishing whoever designs javascript would just decide ES7 would be Perl 6 :)
andrzejku I think it will be better to implement the basic command staff in native language and then add language extension which can be made in Perl using previously implemented things 14:23
hackedNODE andrzejku: MoarVM is written in C
andrzejku right now thinks looks odd
yeah
but why MoarVM take so strange staff 14:24
moar.nqp
timotimo ?
hackedNODE andrzejku: I'm not understanding what you mean. What strange stuff?
andrzejku moarvm it is just interpreter for nqp 14:25
skids Unfortunately we are a long way off from rewriting MoarVM in Perl6, you just have to look at how much is invested in cc optimization/binfmt handling to see that.
hackedNODE andrzejku: I can put it another way: why aren't you writing EVEYRTHING in C? You know, 'cause the rest of the langs make things slower. There are many benefits.
timotimo for nqp and rakudo
tbrowder m: sub f($a
camelia rakudo-moar 5a3df8: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed parameter␤at <tmp>:1␤------> 3sub f($a7⏏5<EOL>␤ expecting any of:␤ constraint␤»
andrzejku and nqp is core lang design
timotimo "core lang design"? 14:26
tbrowder m: sub a($f? where $f >= 0
camelia rakudo-moar 5a3df8: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed parameter␤at <tmp>:1␤------> 3sub a($f? where $f >= 07⏏5<EOL>␤ expecting any of:␤ constraint␤»
hackedNODE andrzejku: moarvm is a VM that can run QAST generated by nqp. nqp is a compiler tool chain. Rakudo is a compiler written using that toolchain.
andrzejku: and what you're imagining is it's better to write Rakudo in C. Which would be a monstrous effort and would make it accessible to a handful of people, but then we'd have a faster perl. 14:27
andrzejku okay
hackedNODE andrzejku: timotimo already mentioned recent effort to do just that, and the person gave up when they realized the amount of work involved. 14:28
timotimo honestly, having good performance for perl6 is mostly about dynamic optimization
andrzejku so Perl6 should be slower by design?
hackedNODE andrzejku: "slower" than what?
andrzejku slower than Swift for ex.
hackedNODE andrzejku: "slower" at what?
andrzejku slower at all
omg
tadzik the answer to "why don't we write all compilers in C" is really the same as to "why do we not write everything in C in the first place"
timotimo we're already faster at some things compared to perl5, and perl5 is written in C 14:29
arnsholt The basic architecture of Perl 6 is broadly the same as used in most other VM-backed languages 14:30
There's a compiler, and it generates bytecodes for the target VM
mspo timotimo: really?
dalek c: d5272a6 | MasterDuke17++ | doc/Programs/00-running.pod6:
Update the description text for 00-running.pod6

It now matches what Rakudo currently shows.
hackedNODE andrzejku: omg what? What is it faster at? I can write a Perl 6 program twice as fast than the same program in Perl 5, so the person paying me for that job will have to spend half the money to receive the program they want. Comparing fastness of languages is nonsensical. There's a good saying: "Premature optimization is the root of all evil" and you're trying to optimize code you haven't even thought about
writing yet.
tbrowder trying to demo an LTA error msg... 14:31
hackedNODE andrzejku: saying X is faster than Y is useless without context and code's purpose.
andrzejku hackedNODE, okay but think why Perl6 is not used on ARM chips?
arnsholt The presence of NQP as a language specifically for implementing compilers is perhaps a bit different, but that's mostly due to the dynamism of Perl 6 making it really hard to directly implement a bootstrapping Perl 6 compiler
andrzejku and Python? yes
timotimo 6guts.wordpress.com/2016/06/12/gri...rovements/ - mspo, mostly on small examples, though
hackedNODE andrzejku: and think why is a hammer not used to drive screws in? 14:32
and a screwdriver is
tadzik python people tried to write an OS in it too, doesn't mean it was a good idea
mspo timotimo: did that print a string a million times get fixed? :)
tbrowder sub f(Int $i? where $i >= 0){}; f()
hackedNODE andrzejku: and you're comparing apples to oranges there in the first place. Perl 6 has by far less optimization effort. 14:33
*has had
timotimo mspo: we're still using libuv async I/O for synchronous output, so i'm guessing that's still slow
arnsholt m: sub f(Int $i? where $i >= 0){}; f() # tbrowder =) 14:34
camelia rakudo-moar 5a3df8: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
hackedNODE I think that issue was due to parsing, no?
m: ("print 42;" x 10000).EVAL; say now - INIT now;
timotimo oh, was that when we generate a source file that is a million lines of code, each just 'say "some string"'?
camelia rakudo-moar 5a3df8: OUTPUT«4242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242…»
andrzejku ok I won't argue with you
hackedNODE oh oops
mspo timotimo: yes that one
hackedNODE m: ("print '';" x 10000).EVAL; say now - INIT now;
camelia rakudo-moar 5a3df8: OUTPUT«7.3626973␤» 14:35
pmurias andrzejku: the speed of Perl6 programs once they are compiled is not dependent on what the compiler is written in
tbrowder arnsholt: thanks! that error helps not a bit for a newbie; i added an example in the docs this morning to show how to get a type constraint on an optional arg:
hackedNODE Yeah, seems fixed. I think that one took ages to parse even with a few hundred prints and I'm not seeing the ticket on perl6.fail 14:36
pmurias andrzejku: and a huge reason why the Rakudo is written in nqp is to allow extending of Perl 6 language by modules/slangs
timotimo mspo: 6guts.wordpress.com/2016/03/06/dig...lity-work/ this one, too
DrForr andrzejku: Perl6 has been cross-compiled to ARM; there was a talk at YAPC::EU on it.
arnsholt tbrowder: Yeah, it's an odd error! Does adding the where clause implicitly make it Int:D, or something like that? 14:37
tbrowder m: sub f(Int $i where $i >= 0 = 0){}; f()
camelia ( no output )
tbrowder that works but is ugly, i prefer to use a block containing the constraint: 14:38
grondilu is suprised $i >= 0 = 0 is legal 14:40
tbrowder m: sub f(Int $i where {$i >= 0} = 0){}; f()
camelia ( no output )
grondilu o_O
timotimo grondilu: only because it's in a parameter declaration 14:40
hackedNODE grondilu: default value
grondilu oh yeah 14:41
arnsholt Yeah, it took me a while to parse it too 14:42
tbrowder grondilu: i remember seeing that construct somewhere, maybe in the Christmas blogs; anyway, i'm going to file a rakudo bug unless someone objects 14:42
hackedNODE tbrowder: what's the bug? 14:43
tbrowder the default value is the key to making it optional
the bug is the opaque error msg 14:44
hackedNODE m: sub f(Int $i? where {$ // True} ){}; f()
camelia ( no output )
tbrowder the original try was to put a constraint on an optional param 14:45
hackedNODE recalls something about that
tbrowder yr example is weird to a newb
hackedNODE tbrowder: I typoed $_ as $ 14:46
But the error is not due to the contraint. I don't know if it has to run when no args are present though 14:47
m: Int ~~ 42
camelia rakudo-moar 5a3df8: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in block <unit> at <tmp> line 1␤␤»
tbrowder can you splain the block contents?
hackedNODE m: sub f(Int $i? where {$_ // True} ){};
camelia ( no output )
hackedNODE m: sub f(Int $i? where 42 ){};
camelia ( no output ) 14:48
hackedNODE tbrowder: return either the value itself or True if the value is not defined
tbrowder: the issue is the constraint on the parameter is still run, even if it's not provided (not defined), so you end up smartmatching an Int:U against whatever the where is, and in your error case, that ends up being Int ~~ 42, which itself gives a weird error message 14:49
s/weird/not helpful if you don't know how this stuff works under the hood/;
tbrowder ah, ok, but that example i'm not sure could be made to have the numercal constraint i want 14:50
timotimo sure
hackedNODE m: sub f(Int :$i where {$_ // True} ){};
camelia ( no output )
hackedNODE m: sub f(Int :$i where 42 ){}; f()
camelia rakudo-moar 5a3df8: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
timotimo if the value is undefined, you just have to not check against the numeric constraint 14:51
tbrowder see what i mean? LTA, no?
hackedNODE m: sub f(Int $i? where .defined or * >= 0){}; f()
camelia rakudo-moar 5a3df8: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed parameter␤at <tmp>:1␤------> 3sub f(Int $i? where .defined7⏏5 or * >= 0){}; f()␤ expecting any of:␤ constraint␤ infix␤ infix stopper␤»
hackedNODE m: sub f(Int $i? where .defined || * >= 0){}; f()
camelia rakudo-moar 5a3df8: OUTPUT«WARNINGS for <tmp>:␤Useless use of ">=" in expression "* >= 0" in sink context (line 1)␤Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
timotimo the or is too low precedence to go in there
hackedNODE bah
timotimo yeah, don't want a whatever there
hackedNODE m: sub f(Int $i? where { .defined or $_ >= 0 } ){}; f()
camelia rakudo-moar 5a3df8: OUTPUT«Invocant requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
timotimo you're mixing .defined with a whatever code
and need a negation before .defined 14:52
hackedNODE m: sub f(Int $i? where { !.defined or $_ >= 0 } ){}; f()
camelia ( no output )
hackedNODE teamwork :)
timotimo \o/
timotimo BBIAB
hackedNODE tbrowder: fwiw, there's Subset::Helper module
tbrowder part of the problem is the ?
tbrowder yr solution is longer than mine 14:53
hackedNODE tbrowder: what's yours?
tbrowder and not as clear IMHO
dalek c: 7a23103 | MasterDuke17++ | doc/Programs/00-running.pod6:
Another minor formatting change to 00-running.pod6
hackedNODE tbrowder: the problem is optionaliness of parameters. The `where` is run on them even if they're not passed. That's all there is to it, really. The errors you're seeing are a side effect of that. 14:54
m: sub foo ($? where { say "oh hai"; True }) {}() 14:55
camelia rakudo-moar 5a3df8: OUTPUT«oh hai␤»
tbrowder hackedNODE: see my solution earlier, i'll try to repeat:
hackedNODE The $_ >= 0 = 0 one? That's not the same as mine, because it uses 0 default, while mine doesn't 14:55
tbrowder m: sub f(Int $i where {$i >= 0} = 0); f() 14:56
camelia rakudo-moar 5a3df8: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤A unit-scoped sub definition is not allowed except on a MAIN sub;␤Please use the block form.␤at <tmp>:1␤------> 3sub f(Int $i where {$i >= 0} = 0);7⏏5 f()␤»
tbrowder arg, forgot the {};
hackedNODE m: sub f(Int $i where $_ >= 0 = 0) { say "\$i is $i.perl()" }; f() 14:57
camelia rakudo-moar 5a3df8: OUTPUT«$i is 0␤»
hackedNODE m: sub f(Int $i where !.defined || $_ >= 0) { say "\$i is $i.perl()" }; f()
camelia rakudo-moar 5a3df8: OUTPUT«Too few positionals passed; expected 1 argument but got 0␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
hackedNODE m: sub f(Int $i? where !.defined || $_ >= 0) { say "\$i is $i.perl()" }; f()
camelia rakudo-moar 5a3df8: OUTPUT«$i is Int␤»
tbrowder the zero default makes it an optional param which is what i want
hackedNODE OK
tbrowder anyhoo, is the msg LTA or not in y'all's opinion? 14:58
hackedNODE m: sub f(UInt $i = 0) { }; f()
camelia ( no output )
hackedNODE ^ shorter version 14:59
tbrowder: from user's perspective, I'd say there are two issues: (1) where clause is run for optional params, even when they are not provided; (2) Int ~~ 42 gives an LTA error... I don't know whether either can/should be fixed 15:00
tbrowder true!! no wonder you're Zoffix in disguise! 15:00
hackedNODE s: 42, 'ACCEPTS' 15:01
SourceBaby hackedNODE, Sauce is at github.com/rakudo/rakudo/blob/5a3d.../Mu.pm#L12
hackedNODE s: 42, 'ACCEPTS', \(Int)
SourceBaby hackedNODE, Sauce is at github.com/rakudo/rakudo/blob/5a3d...eric.pm#L7
hackedNODE Looks like that one can be fixed by adding another candidate 15:02
hackedNODE & lunch
smls m: my @a = 2, 4, 6; my $b = @a.clone; $b.push(8); dd @a; 15:12
camelia rakudo-moar 5a3df8: OUTPUT«Array @a = [2, 4, 6, 8]␤»
smls ^^ Why does .clone not give a fresh array? 15:13
dj_goku smls: not sure what a shallow clone is: docs.perl6.org/type/Array#(Mu)_method_clone 15:14
smls dj_goku: I thought it meant that it doesn't duplicate the elements of the array, but that the array container itself is independent from the original. 15:15
m: my @a = 2, 4, 6; my $b = @a.clone; say $b.WHICH; say @a.WHICH; @a.push(8); dd $b; 15:16
camelia rakudo-moar 5a3df8: OUTPUT«Array|51333104␤Array|51333168␤Array $b = $[2, 4, 6, 8]␤»
skids Yeah that's kinda messed up IMO.
smls ^^ Looks like it does create a new object, but pushing to one affects the other?
skids Different container, same VM object underneath? 15:17
jnthn An Array is an object, with a bunch of attributes, once of which is the actual storage.
dj_goku m: my @a = 2, 4, 6; my @b = @a; $b.push(8); dd @a; dd @b;
camelia rakudo-moar 5a3df8: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$b' is not declared. Did you mean '@b'?␤at <tmp>:1␤------> 3my @a = 2, 4, 6; my @b = @a; 7⏏5$b.push(8); dd @a; dd @b;␤»
jnthn I'm guessing Array doesn't have a method clone of its own, so it does The Default Thing in Mu
dj_goku m: my @a = 2, 4, 6; my @b = @a; @b.push(8); dd @a; dd @b;
camelia rakudo-moar 5a3df8: OUTPUT«Array @a = [2, 4, 6]␤Array @b = [2, 4, 6, 8]␤»
jnthn Which keeps the storage
It should probably get its own method clone 15:18
smls ah
ok, will RT
jnthn I thought that had already happened. :
:S
But yeah, it wants fixing. The current behavior is crap.
timotimo cue writing spec tests for .clone of pretty much every single class :) 15:21
smls hm, is RT bugged? When I click to create a new ticket, I get an empty page. 15:22
skids Yeah. ISTR noticing there were less clone methods than I expected when reading through.
perlpilot m: my %h = alpha => 1, beta => 2; my $x = %h.clone; $x<gamma> = 17; dd %h; dd $x; # just checking 15:25
camelia rakudo-moar 5a3df8: OUTPUT«Hash %h = {:alpha(1), :beta(2)}␤Hash $x = ${:alpha(1), :beta(2), :gamma(17)}␤»
geekosaur smls, not sure if this is still relevant although it sounds like it 15:31
[29 02:56:37] <[Coke]> the "new ticket" button was deliberately disabled following a big spam attack on the p5 queue.
smls geekosaur: Ah, thanks. I'll send it per email then. 15:32
skids Huh, I just made a new ticket just minutes before... but I don't have perms to the perl5 queue. 15:39
So maybe that's why my button is ok.
skids
.oO(Testing destruction kinda blows)
15:43
timotimo yes, quite. 15:44
skids Gonna have to split things out to different files, once I do one set of force::gc's the stuff I want to test after that is promoted too high to be destroyed, I guess. 15:45
timotimo right, force_gc doesn't force a major collection
timotimo and just running force_gc a few times in a row won't give you a major collection either 15:48
timotimo allocating things that are big that get put into the second generation will cause major collections to occur 15:48
pmurias m: use nqp;say(nqp::iscont(Scalar)); 16:13
camelia rakudo-moar 5a3df8: OUTPUT«1␤»
pmurias jnthn: is that correct?
timotimo for an undefined Scalar object?
or in general?
pmurias for a type object of a thing that is a container 16:14
jnthn pmurias: Believe so
jnthn Otherwise there'd be no way (short of making an object) to ask if a type is a container type 16:15
pmurias ok
jnthn (I can see the temptation to enforce definedness as part of it)
pmurias I was just making sure if a behavior is accidental or something that I should reimplement
timotimo that's very helpful in general, pmurias 16:16
you basically go over everything with a watchful eye
that can also help us find things that may have been useful once, but no longer are
jnthn Yes, it's good to ask. Some things are cruft. :)
hackedNODE RT busted? I'm getting a blank page when I try to create a ticket :/ 16:24
hackedNODE oh well, no ticket then 16:25
timotimo RT got spam-waved recently 16:28
so the "create ticket" button got disabled
smls hackedNODE: Creating a ticket by sending an email to [email@hidden.address] still works 16:30
hackedNODE smls: what is the usual delay between sending an email and seeing the ticket show up? 16:31
moritz minutes to hours
hackedNODE cool
timotimo in my experience it's usually very close to the "minutes" end 16:32
geekosaur I feel like they process them quickly but the outgoing mail queue is only run periodically so the confirming email can take a while 16:36
(because I seem to get mail from it in heterogeneous batches) 16:37
RabidGravy I've just done a programming test in Perl 5 for a recruiter, I'd much rather have done it in 6 :) 17:00
timotimo :) 17:01
perl 6 makes it much too easy to write programs
that's like asking the programmer to push a single button to get the job
Juerd I once almost got a job by answering "dwim();" 17:03
Juerd We decided that we were not compatible. 17:03
RabidGravy I may do it in Perl 6 for fun as it would be much neater
Juerd (Note: if you're ever going to give a programming test, don't provide a list of built-in functions that you're not allowed to use. That's torture, not programming.) 17:04
RabidGravy that would be silly 17:06
Juerd Yes.
TimToady you should'a used Inline::Perl6 to solve it :P 17:18
Ulti El_Che: why would I want to downgrade Siri ;) 17:19
RabidGravy :) That did occur to me
El_Che :) 17:25
dalek line-Perl5: e2d9f94 | niner++ | / (2 files):
Optimize calls to P5 methods without args

No need to set up @args and @svs arrays. Just pass the self $obj instead of the argument list. Saves about 2 % in csv-ip5xs.pl
17:35
harmil_wk From docs "For phasers such as KEEP and POST that are run when exiting a scope normally, the return value (if any) from that scope is available as the current topic within the phaser." 17:42
Is that true today?
jnthn m: { 42 LEAVE { say $_ } } 17:43
camelia rakudo-moar 58cf9d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3{ 427⏏5 LEAVE { say $_ } }␤ expecting any of:␤ infix␤ infix stopper␤ statement end␤ statement modifier␤ stat…»
jnthn m: { 42; LEAVE { say $_ } }
camelia rakudo-moar 58cf9d: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 42 in sink context (line 1)␤(Any)␤»
harmil_wk m: sub test { return (state $x = 0)++; LEAVE {.say; $_++ } }; say test
camelia rakudo-moar 58cf9d: OUTPUT«(Any)␤0␤»
harmil_wk Looks like no, which is why I was asking. I was wondering if I was doing it wrong. 17:44
jnthn m: sub foo { return 42 LEAVE { say $_ } }; foo
camelia rakudo-moar 58cf9d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3sub foo { return 427⏏5 LEAVE { say $_ } }; foo␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ …»
jnthn m: sub foo { return 42; LEAVE { say $_ } }; foo
camelia rakudo-moar 58cf9d: OUTPUT«(Any)␤»
jnthn m: sub foo { return 42; POST { say $_ } }; foo 17:44
camelia rakudo-moar 58cf9d: OUTPUT«42␤»
jnthn Oddness, it works for POST
harmil_wk oh, okay. Welll that's something 17:45
jnthn And I thought LEAVE/KEEP/UNDO were hung off the same hook
andrzejku hi :) 17:48
harmil_wk a very slightly LTA error: 17:51
m: sub test { return (state $x = 0 )++; POST { $_++ } }; say test
camelia rakudo-moar 58cf9d: OUTPUT«Cannot resolve caller postfix:<++>(Int); none of these signatures match:␤ (Mu:D $a is rw)␤ (Mu:U $a is rw)␤ (Int:D $a is rw)␤ (int $a is rw)␤ (Bool:U $a is rw)␤ (Bool:D $a is rw)␤ (Num:D $a is rw)␤ (Num:U $a is rw)…»
harmil_wk It really would be nice if the error simply told me that I was trying to modify a non-read-only rather than making me visually parse the "is rw" on all of those. 17:52
Should I rakudobug that?
masak jnthn: they are, but I'm not sure offhand LEAVE topicalizes something. 17:53
jnthn: POST does because spec says it oughta with the return value. 17:54
masak harmil_wk: sure, why not -- though I'm not sure the verdict will be "we can haz nice error" on that :/ 17:55
harmil_wk masak: my vote is for, "stack hosifiction attempt detected, dumping warp core" 17:56
hackedNODE m: multi foo ($ is rw) { "wrong" }; multi foo ($) {"right"}; foo "42"
camelia ( no output )
smls It could detect that all signature candidates fail to match for the same reason, and then say that reason.
hackedNODE m: multi foo ($ is rw) { "wrong" }; multi foo ($) {"right"}; say foo "42"
camelia rakudo-moar 58cf9d: OUTPUT«wrong␤»
masak harmil_wk: we try to discourage the meme that Perl 6 is a trek :P 17:57
Woodi_ git log is crazy...
hackedNODE m: multi foo ($) { "right" }; multi foo ($ is rw) {"wrong"}; say foo "42"
camelia rakudo-moar 58cf9d: OUTPUT«wrong␤»
hackedNODE really...
m: multi foo ($) { "right" }; multi foo ($ is rw) {"wrong"}; say foo $
camelia rakudo-moar 58cf9d: OUTPUT«wrong␤»
harmil_wk masak: We're calling religious certitude a "meme" now... huh
hackedNODE Why does it like is rw so much that even order doesn't help :/ 17:58
jnthn hackedNODE: By spec, rw is tigheter (and not as a tie-breaker, but for real) 17:59
But it should only do it on a container...
perlpilot though, it still looks like that approach might work for postfix:<++> since it doesn't seem to have an Any candidate 18:00
jnthn So I've no idea what's happening with the "42" 18:00
hackedNODE m: multi foo ($) { "right" }; multi foo ($x is rw) { $x = 72; "wrong"}; say foo "42" 18:01
camelia rakudo-moar 58cf9d: OUTPUT«right␤»
hackedNODE m: multi foo ($) { "right" }; multi foo ($x is rw) {"wrong"}; say foo "42"
camelia rakudo-moar 58cf9d: OUTPUT«wrong␤»
hackedNODE you're kidding me
jnthn m: say nqp::iscont("42")
camelia rakudo-moar 58cf9d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Could not find nqp::iscont, did you forget 'use nqp;' ?␤at <tmp>:1␤------> 3say nqp::iscont("42")7⏏5<EOL>␤»
hackedNODE Well, at least the ++ thing can be fixed :) 18:02
jnthn m: use nqp; say nqp::iscont("42")
camelia rakudo-moar 58cf9d: OUTPUT«0␤»
jnthn wtf
masak harmil_wk: "meme" was coined in the seventies with the current meaning.
moritz m: sub f($ is rw) {}; f 42
camelia rakudo-moar 58cf9d: OUTPUT«Internal error: inconsistent bind result␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
hackedNODE :o
jnthn Yup, that ain't right.
moritz at least that's... *consistent* with the wrong multi dispatch behavior :-)
masak .oO( wrongconsistency.org ) 18:03
jnthn It's even tested... github.com/perl6/roast/blob/master...by-trait.t 18:05
m: m: multi foo ($) { say "right" }; multi foo ($x is rw) {say "wrong"}; foo "42" 18:06
camelia rakudo-moar 58cf9d: OUTPUT«right␤»
jnthn grrr, I wonder if the optimizer is static-inlining it :S
masak is there a way to test whether't is? 18:07
jnthn --optmize=off at the command line 18:08
But I just realized I forgot to make dinner 'cus I was failing to make sense of darn certificate signing request files, so I'm off to do that :/
masak seems wise, yes. 18:09
hackedNODE Yeah, optimizer bug (just tested)
I call dibs! :)
hackedNODE still needs to unlock the "Debugged Optimizer Bug" Achievement 18:10
harmil_wk masak: I was just being silly. I do not, in fact, have a religious conviction that Perl 6 is Trek, but it sounds like a church I'd attend if they had donuts after. 18:11
masak we call them cups, not donuts :P 18:18
masak , plying stale old topological jokes 18:19
perlpilot masak: they offer 2 forms of donuts, one is edible and the other holds coffee
timotimo flying state machine of the yard?! 18:22
hackedNODE If you're in Toronto in 4.5hours, stop by the Toronto Perl Mongers for some lightning talks, including Zoffix's "Perl 6: What Programming in The Future is Like": www.meetup.com/Toronto-Perl-Mongers...233588645/ It's FREE! (may be worth pinging Dave, so he'd have you on the list for security people): twitter.com/meraxes 18:23
masak sounds fantastic. 18:26
unfortunately, I most likely won't be in Toronto in 4.5 hours... :)
timotimo me neither :(
hackedNODE There should be a recording of it :)
timotimo yay 18:27
masak .oO( here we record for posterity how masak and timotimo weren't in Toronto )
timotimo masak: maybe we'll see each other when we'ren't in toronto 18:28
masak you mean, given that "not in Toronto" is a relatively small place? 18:29
...I see your point.
perlpilot
.oO( More of a surface innit? )
18:30
timotimo i'm assuming we're not going to be in outer space or below sea level ... 18:31
in that case i know of a few places that are pretty gigantic in comparison to "not in toronto"
masak the more I think of it, the more likely it seems we'll just bump into each other 18:32
timotimo so if you think real much about it, we'll definitely meet? 18:33
dalek line-Perl5: 0f2805e | niner++ | lib/Inline/Perl5.pm6:
Be smarter about avoiding slurpies when calling P5 methods

This gets rid of quite a bit of unpacking and repacking and setting up slurpy arguments which end up empty.
Saves another ~ 22 % on the csv-ip5xs.pl benchmark.
line-Perl5: 4cb9b18 | niner++ | META.info:
Version 0.16
timotimo holy wow, 22% 18:34
nine Now at 2.994s of which 30 % is just startup.
hackedNODE Does this look like amazed group of people or are they scared? tpm2016-2.zoffix.com/crowd-surprised.jpg 18:35
timotimo i think "surprise" fits pretty well
like, something just happened and nobody expected it, and they're not yet sure if it'd be right to be scared or happy 18:36
hackedNODE OK :)
masak I think some of them already look somewhat scandalized 18:39
hackedNODE Oh, maybe I should change it then :)
hackedNODE They're supposed to be amazed at Perl 6's awesomeness :D 18:40
masak "They used WHAT syntax!?" 18:40
dogbert17 o/ 18:45
according to a table in docs.perl6.org/language/regexes U+000C means CARRIAGE RETURN, this has to be a typo no? 18:46
grondilu what's the P5 equivalent to infix:<xx>? 18:47
hackedNODE grondilu: x in list mode 18:47
masak grondilu: ("elem") x $n
grondilu oh cool
masak grondilu: because parentheses are only for grouping! :P
hackedNODE m: say "\x[000C]".uniname 18:49
camelia rakudo-moar 58cf9d: OUTPUT«FORM FEED (FF)␤»
hackedNODE dogbert17: seems to be
DrForr dogbert17: Submit a pull request?
hackedNODE Commit directly :)
dogbert17 hackedNODE, thanks I'm beginning to suspect that the table describing vertical whitespace characters in P6 is too short, where can I find the im the src? 18:50
dogbert17 s/im/in/ 18:50
hackedNODE m: ^0xFFFFF .grep({.chr ~~ /\v/}).say 18:51
camelia rakudo-moar 58cf9d: OUTPUT«(10 11 12 13 133 8232 8233)␤»
hackedNODE m: ^0xFFFFF .grep({.chr ~~ /\v/})».base(16).say
camelia rakudo-moar 58cf9d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing « or »␤at <tmp>:1␤------> 3^0xFFFFF .grep({.chr ~~ /\v/})».7⏏5base(16).say␤»
hackedNODE m: (^0xFFFFF).grep({.chr ~~ /\v/})».base(16).say 18:52
dogbert17 now we're talking, hackeNODE++
camelia rakudo-moar 58cf9d: OUTPUT«(A B C D 85 2028 2029)␤»
dogbert17 I wonder if these are the same as those supported by P5, checks ...
hahainternet you can uniname them can't you? 18:53
hackedNODE yes 18:53
m: (^0xFFFFF).grep({.chr ~~ /\v/})».uniname.say
camelia rakudo-moar 58cf9d: OUTPUT«(LINE FEED (LF) LINE TABULATION FORM FEED (FF) CARRIAGE RETURN (CR) NEXT LINE (NEL) LINE SEPARATOR PARAGRAPH SEPARATOR)␤»
hahainternet nice
dogbert17 DrForr.: the table will be fixed :-)
SmokeMachine____ hi! how can I create a Regex from a string?
moritz rx/<$string>/ 18:54
dogbert17 excellent
hackedNODE Note that you won't get the matches
*captures
smls you do if you name the capture, as in <foo=$string> 18:55
SmokeMachine____ moritz: thanks! 18:57
smls SmokeMachine____, moritz: Note, though, that it technically creates a closure. So if $string is changed afterwards, it affects the regex: 18:58
m: my $string = "a"; my $x = rx/<$string>/; $string = "<[0..9]>"; say "a5".match($x)
camelia rakudo-moar 58cf9d: OUTPUT«「5」␤»
SmokeMachine____ m: my $regex = q{"/account/" $<acc_id> = [\d+]}; say $<acc_id> if "/account/123" ~~ m{<$regex>}' # :(
camelia rakudo-moar 58cf9d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Strange text after block (missing semicolon or comma?)␤at <tmp>:1␤------> 3acc_id> if "/account/123" ~~ m{<$regex>}7⏏5' # :(␤ expecting any of:␤ infix␤ infix stopper␤»
dalek c: 5d8221c | (Jan-Olof Hendig)++ | doc/Language/regexes.pod6:
Corrected the table of vertical whitespace characters. hackedNODE++
SmokeMachine____ m: my $regex = q{"/account/" $<acc_id> = [\d+]}; say $<acc_id> if "/account/123" ~~ m{<$regex>} # :(
camelia rakudo-moar 58cf9d: OUTPUT«Nil␤»
SmokeMachine____ m: say $<acc_id> if "/account/123" ~~ m{/account/" $<acc_id> = [\d+]} # :( 18:59
camelia rakudo-moar 58cf9d: OUTPUT«5===SORRY!5===␤Unrecognized regex metacharacter / (must be quoted to match literally)␤at <tmp>:1␤------> 3say $<acc_id> if "/account/123" ~~ m{7⏏5/account/" $<acc_id> = [\d+]} # :(␤Regex not terminated.␤at <tmp>:1␤------> 3say $<acc_…» 19:00
SmokeMachine____ m: say $<acc_id> if "/account/123" ~~ m{"/account/" $<acc_id> = [\d+]} # :(
camelia rakudo-moar 58cf9d: OUTPUT«「123」␤»
smls SmokeMachine____: That's what hackedNODE mentioned earlier.
SmokeMachine____ yes... thats it... 19:01
smls m: my $regex = q{"/account/" $<acc_id> = [\d+]}; say $<a><acc_id> if "/account/123" ~~ m{<a=$regex>}
camelia rakudo-moar 58cf9d: OUTPUT«「123」␤»
SmokeMachine____ any way to do that?
smls ^^
SmokeMachine____ smls: thanks!
smls The general rule is that <> only captures if the syntax inside it starts with an alphanumeric character. So <subrule> captures, but <.subrule> or <$subrule> doesn't. 19:02
hackedNODE smls: TIL! (that it creates a closure)
I meant... smls++ :) 19:03
dalek line-Perl5: 61473e4 | niner++ | lib/Inline/Perl5.pm6:
Speed up calling P6 methods a bit

Getting rid of the intermediary array saves about 4 % in csv-ip5xsio.pl
19:04
hackedNODE Is there a way to avoid the closure and use the value that it's at at the time?
timotimo make it a parameter and pass it? 19:05
a closure is what stores "what value it's at at the time"
moritz hackedNODE: or are you mixing captures and closures right now?
moritz confused
SmokeMachine____ m: my $regex = q{"/account/" $<acc_id> = [\d+]}; say $<a><acc_id> if "/account/123" ~~ m{<a={$regex.clone}>} # this would "fix" the "closure problem"?
camelia rakudo-moar 58cf9d: OUTPUT«「123」␤»
moritz doesn't see closures, just captures 19:06
SmokeMachine____ smls: ^^
hackedNODE moritz: I dunno. That's what smls said, that rx/<$foo>/ is a closure
timotimo: parameter to what tho?
moritz m: my $foo = 'a'; my $rx = rx/$foo/; $foo = 'b'; say 'ab' ~~ $rx 19:07
camelia rakudo-moar 58cf9d: OUTPUT«True␤»
moritz m: my $foo = 'a'; my $rx = rx/$foo/; $foo = 'b'; say 'b' ~~ $rx
camelia rakudo-moar 58cf9d: OUTPUT«True␤»
moritz m: my $foo = 'a'; my $rx = rx/$foo/; $foo = 'b'; say 'a' ~~ $rx
camelia rakudo-moar 58cf9d: OUTPUT«False␤»
smls moritz: regexes are just routines written in a funny syntax, and routines that use outside lexical variables close over them.
moritz hm, right, that's a closure right there
timotimo hackedNODE: whatever you'd like 19:09
hackedNODE m: my $string = "a"; my $x = {rx/<$^v>/}($string); $string = "<[0..9]>"; say "a5".match($x)
camelia rakudo-moar 58cf9d: OUTPUT«「a」␤»
timotimo if you want to freeze the value, might want to us EVAL to create the regex instead?
smls SmokeMachine____: No, that'll call $regex.clone again on every match. 19:10
SmokeMachine____ :( 19:10
hackedNODE SmokeMachine____: my example avoids the issue
smls timotimo: Or just not modify the variable again...
timotimo fair enough
hackedNODE SmokeMachine____: calls a block with the string and returns a regex with that value
smls Right, letting the variable fall out of scope like hackedNODE showed, makes sure you don't accidentally modify it again. 19:11
SmokeMachine____ hackedNODE: makes sense...
tbrowder .tell hackedNODE yr solution is excellent and I will use it to replace the doc change i made; see it shortly 19:28
yoleaux tbrowder: I'll pass your message to hackedNODE.
hackedNODE
.oO( what solution... )
19:30
yoleaux 19:28Z <tbrowder> hackedNODE: yr solution is excellent and I will use it to replace the doc change i made; see it shortly
hackedNODE The UInt, I'm guessing...
m: say Int ~~ 42 19:31
camelia rakudo-moar 58cf9d: OUTPUT«False␤»
hackedNODE ^ that's fixed now, btw
hackedNODE m: sub (Int $x? where 42) {}() 19:32
camelia rakudo-moar 58cf9d: OUTPUT«Constraint type check failed for parameter '$x'␤ in sub at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
hackedNODE heh
m: sub (Int:D $x?) {}() 19:33
camelia rakudo-moar 58cf9d: OUTPUT«Parameter '$x' requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in sub at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
hackedNODE I guess that's not a bug at all. It has to check optional parameters, because they're still available inside the sub and have values, even though they've not been passed to the sub. 19:34
dalek c: 05c700e | (Tom Browder)++ | doc/Type/Signature.pod6:
better example per [email@hidden.address]
19:38
tbrowder i did test the new examples, BTW 19:49
moritz I wonder if a default that doesn't pass the type constraint should be a compile-time error 19:55
ah, but not all defaults can be compile-time evaluated 19:56
arnsholt And constraints donæt have to be pure functions 19:56
*don't
gfldex m: class A { has $.name = 'body' }; say A.new.&{ say .?name, 'body' ~~ .?name } 21:00
camelia rakudo-moar 58cf9d: OUTPUT«bodyFalse␤True␤»
gfldex ^^^ mean trap
gfldex m: class A { has $.name = 'body' }; A.new.&{ say .?name, 'body' ~~ .?name } 21:01
camelia rakudo-moar 58cf9d: OUTPUT«bodyFalse␤»
masak m: class A { has $.name = 'body' }; given A.new { say .name; say "body" eq .name; say "body" ~~ .name } 21:03
camelia rakudo-moar 58cf9d: OUTPUT«body␤True␤No such method 'name' for invocant of type 'Str'␤ in block <unit> at <tmp> line 1␤␤»
masak there you go.
infix:<~~> topicalizes on "body" (the lhs) for you.
gfldex i know that now. Took me only an hour to figure that one out :) 21:04
masak serves your right for writing such clever code :P 21:05
you* 21:06
masak .oO( Donald Trump serves your right )
gfldex at least I didn't doc that myself 21:07
[Coke] m: sub a ($a where {say 4}) { say $a } ; a(3) 21:09
camelia rakudo-moar 58cf9d: OUTPUT«4␤3␤»
masak m: multi sub a ($a where {say 4}) { say $a } ; a(3) 21:10
camelia rakudo-moar 58cf9d: OUTPUT«4␤4␤3␤»
masak .oO( one 4 for mommy... one 4 for daddy... ) 21:11
gfldex is there a good reason why sub say returns True?
masak gfldex: hysterical raisins.
gfldex: in Perl 5, it returns whether the file handle was happy about being printed to.
"Returns true if successful." -- `perldoc -f print`
gfldex m: $*IN = Nil; say say('happy'); 21:12
camelia rakudo-moar 58cf9d: OUTPUT«happy␤True␤»
gfldex m: $*OUT = Nil; say say('happy');
camelia rakudo-moar 58cf9d: OUTPUT«Too many positionals passed; expected 1 argument but got 2␤ in block <unit> at <tmp> line 1␤␤»
gfldex m: $*OUT = Mu; say say('happy'); 21:13
camelia rakudo-moar 58cf9d: OUTPUT«No such method 'nl-out' for invocant of type 'Mu'␤ in block <unit> at <tmp> line 1␤␤»
gfldex at least it doesn't return True anymore :->
dalek c: 41a7f6e | gfldex++ | doc/Language/traps.pod6:
doc trap of ~~ in conjunction with .method-name
21:28
gfldex are there any other operators that set $_ besides ~~ ? 21:31
timotimo "andthen" and "orelse" 21:33
well, maybe only "andthen"
dalek c: d730103 | (Jan-Olof Hendig)++ | doc/Language/regexes.pod6:
Fixed broken code example and added a few missing ;
21:38
c: b70c423 | gfldex++ | doc/Language/traps.pod6:
add andthen to ~~ trap
masak gfldex: the infix:<ff> family of operators topicalize nowadays. 21:54
masak wow, the rustc errors are lovely. blog.rust-lang.org/2016/09/29/Rust-1.12.html 21:56
masak (on topic because we like lovely error messages) :) 21:56
timotimo they have so many contributors 22:04
i'm a tiny bit jealous :)
SmokeMachine____ hi! 22:30
why this is true:
m: say {:a($0)} ~~ :(Int(Match) :$a) if "abc" ~~ /(.*)/ 22:31
camelia rakudo-moar 58cf9d: OUTPUT«True␤»
SmokeMachine____ and this gives an error? 22:31
m: sub f(Int(Match) :$a) {say $a}; say f(|$/) if "abc" ~~ /$<a>=.*/
camelia rakudo-moar 58cf9d: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5abc' (indicated by ⏏)␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in sub f at <tmp> line 1␤ in block <uni…»
SmokeMachine____ better: 22:32
m: say $/ ~~ :(Int(Match) :$a) if "abc" ~~ /$<a>=.*/
camelia rakudo-moar 58cf9d: OUTPUT«True␤»
SmokeMachine____ m: say $/ ~~ :(Int(Match) :$a!) if "abc" ~~ /$<a>=.*/ 22:33
camelia rakudo-moar 58cf9d: OUTPUT«True␤»
SmokeMachine____ m: say \(|$/) ~~ :(Int(Match) :$a) if "abc" ~~ /$<a>=.*/ 22:34
camelia rakudo-moar 58cf9d: OUTPUT«True␤»
SmokeMachine____ I can't get why...
timotimo i suppose just matching the signature doesn't actually *try* to call the coercer? 22:41
and just says "yeah, that matches the type object"
tushar I would like to add values at specific indexes of an array at the same time. Can I do that? Input --> [[1..3],[4..6]], Output --> [[9..11],[1..3], [7..8],[4..6]]. I am inserting [9..11] at index 0 and [7..8] at index 2. Is this even possible? Or I am just thinking crazy 22:47
SmokeMachine____ timotimo: don't you think that it would be more useful if it tried? 22:55
dalek c: 3707053 | skids++ | doc/Language/traps.pod6:
Give topicalizing operators a header.
22:57
SmokeMachine____ I am writing a regex where Id like to match the same of a parameter in a function signature, i mean: $a or Int $a or Ins(Str) $a or $a where !*, etc... so I think that would be a good idea to use the regex that perl6 uses to parse a parameter... so, how can I use that? 22:59
timotimo try looking into %*LANG or what it's called to get at the grammar 23:00
there's a module in the works by DrForr if i'm not mistaken that makes accessing the perl6 grammar easier 23:01
for perl6 programs themselves
SmokeMachine____ timotimo: thanks! 23:02
raiph m: sub insert (\array, \inserts) { for inserts { array.splice: 2*$++,0,@=$_ }; array }; say insert [[1..3],[4..6]], [[9..11],[7..8]]; # tushar; is this what you mean by "at the same time"? 23:37
camelia rakudo-moar 58cf9d: OUTPUT«[[9 10 11] [1 2 3] [7 8] [4 5 6]]␤»
tushar ralph: yes. But, the indexes can be any. Not restricted to even. It can be 1 and 2 or 1,2,4,5. Thanks for your help. What does $++ mean? 23:42
timotimo it's an anonymous state variable that gets incremented 23:43
tushar timotimo: thanks 23:44
tushar m: my @a = [[1..3], [4..6], [7..9]]; @a[2]:delete; @a.say; @a[0]:delete; @a.say; 23:53
camelia rakudo-moar 58cf9d: OUTPUT«[[1 2 3] [4 5 6]]␤[(Any) [4 5 6]]␤»
tushar Can someone explain why the last delete operation keep (Any) though I deleted that one. I was expecting to see @a = [[4,5,6]]. And why the first operation doesn't keep (Any). I hope this make sense. 23:55