Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-09-29

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:07 cyphase joined #perl6
00:08 cyphase joined #perl6
00:13 pierre_ joined #perl6
00:14 perlawhirl joined #perl6
00:26 mcmillhj joined #perl6
00:29 dataangel joined #perl6
00:45 mcmillhj joined #perl6
00:45 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:47 timotimo that's what splice is for
00:47 geekosaur https://docs.perl6.org/type/Array#routine_splice
00:47 timotimo splice is really "at index i, remove n elements and replace them with this list: ..."
00:47 timotimo so you'll just be removing 0 elements
00:48 tushar timotimo: I thought so.. Thanks..
00:54 dalek perl6.org: 7b463a5 | (Angelo Compagnucci)++ | includes/menu-nav:
00:54 dalek perl6.org: doc.perl6.org not prominent enough
00:54 dalek perl6.org:
00:54 dalek perl6.org: * Documentation now point to docs.perl6.org
00:54 dalek perl6.org: * Added Resources pointing to /documentation/
00:54 dalek perl6.org:
00:54 dalek perl6.org: Fixes: #48
00:54 dalek perl6.org: review: https://github.com/perl6/perl6.org/commit/7b463a505e
00:54 dalek perl6.org: dc08a96 | (Zoffix Znet)++ | includes/menu-nav:
00:54 dalek perl6.org: Merge pull request #56 from angeloc/issue_48
00:54 dalek perl6.org:
00:54 dalek perl6.org: doc.perl6.org not prominent enough
00:54 dalek perl6.org: review: https://github.com/perl6/perl6.org/commit/dc08a964b8
00:54 BenGoldberg m: my @a = 1..3; @a.splice 1, 0, 4; @a.say;
00:54 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…»
00:54 timotimo ^- i am quite okay with that
00:54 timotimo the perl6.org change, that is
00:54 BenGoldberg m: my @a = 1..3; @a.splice: 1, 0, 4; @a.say;
00:54 camelia rakudo-moar ed0ced: OUTPUT«[1 4 2 3]␤»
00:54 BenGoldberg tushar, ^
00:57 mcmillhj joined #perl6
00:57 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 rgrinberg joined #perl6
00:58 tushar m: my @a = [1,2,3]; @a.splice(2,0,4).say;
00:58 camelia rakudo-moar ed0ced: OUTPUT«[]␤»
00:58 tushar m: my @a = [1,2,3]; @a.splice(2,0,4); @a;
00:58 camelia rakudo-moar ed0ced: OUTPUT«WARNINGS for <tmp>:␤Useless use of @a in sink context (line 1)␤»
00:58 tushar m: my @a = [1,2,3]; @a.splice(2,0,4); @a.say;
00:58 camelia rakudo-moar ed0ced: OUTPUT«[1 2 4 3]␤»
01:00 tushar Can I replace multiple values at the same time?
01:02 tushar 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:03 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␤»
01:04 tushar uhhh... Here is the output that I got while running above in REPL. Ouptut --> [1 2 4 5 3]
01:05 tushar Looks like it took the last index i.e. 1 in and add new values after it.
01:07 noganex joined #perl6
01:09 tushar @a;
01:12 mcmillhj joined #perl6
01:14 canopus joined #perl6
01:14 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␤       …»
01:15 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]]␤»
01:16 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 tushar I hope I am clear enough
01:18 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]]␤»
01:19 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:  https://rt.perl.org/rt3//Public/Bug/Display.html?id=125596
01:20 ponbiki joined #perl6
01:21 tushar MasterDuke++
01:21 AlexDaniel alright, I'm failing to find a bug report
01:21 zakharyas joined #perl6
01:21 AlexDaniel my gut says that there was one
01:22 MasterDuke tushar: that's an example of the single argument rule in action
01:22 MasterDuke which i'm just creating an issue in the docs for now because it should be listed/searchable
01:23 tushar MasterDuke: can you be little more expressive? Can I adapt that for my work or is it an issue?
01:24 AlexDaniel /o\ wtf
01:24 AlexDaniel m: my @a = < aaa bbbbb cc >; say max @a, :by(*.chars > *.chars)
01:24 camelia rakudo-moar ed0ced: OUTPUT«bbbbb␤»
01:24 AlexDaniel m: my @a = < aaa bbbbb cc >; say min @a, :by(*.chars > *.chars)
01:24 camelia rakudo-moar ed0ced: OUTPUT«aaa␤»
01:24 AlexDaniel alright, yes?
01:24 AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.max: :by(*.chars > *.chars)
01:24 camelia rakudo-moar ed0ced: OUTPUT«cc␤»
01:24 AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.min: :by(*.chars > *.chars)
01:24 camelia rakudo-moar ed0ced: OUTPUT«aaa␤»
01:24 AlexDaniel ??
01:25 AlexDaniel in other words, :by is just ignored
01:25 AlexDaniel I've seen that some time ago, can anybody remember a ticket title or something?
01:25 MasterDuke tushar: sure you can use that. is isn't really an issue, just something that people don't always realize at first
01:26 AlexDaniel by the way, it is even worse:
01:26 AlexDaniel m: my @a = < aaa bbbbb cc >; say sort @a, :by(*.chars > *.chars)
01:26 camelia rakudo-moar ed0ced: OUTPUT«Unexpected named argument 'by' passed␤  in block <unit> at <tmp> line 1␤␤»
01:26 MasterDuke AlexDaniel: i've seen a similar ticket also
01:26 MasterDuke https://rt.perl.org/Ticket/Display.html?id=115758
01:26 AlexDaniel if only bisectable was here… perhaps it worked some time ago
01:27 tushar MasterDuke: Thanks..
01:27 mcmillhj joined #perl6
01:28 AlexDaniel not a bug? Not funny
01:28 BenGoldberg m: < aaa bbbbb cc >; @a.sort(:by(*.chars)).say;
01:28 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;␤»
01:28 BenGoldberg m: < aaa bbbbb cc >.sort(:by(*.chars)).say;
01:28 camelia rakudo-moar ed0ced: OUTPUT«(aaa bbbbb cc)␤»
01:28 Actualeyes joined #perl6
01:29 bstamour joined #perl6
01:29 BenGoldberg m: < aaa bbbbb cc >.sort(*.chars).say;
01:29 camelia rakudo-moar ed0ced: OUTPUT«(cc aaa bbbbb)␤»
01:29 bstamour Quick question for anyone who can help me out. What does the line "use v6" actually do?
01:29 bstamour Does it matter if I only run my scripts through a perl 6 interpreter?
01:29 BenGoldberg Nothing, except that it makes perl5 bail out.
01:30 bstamour Ah, so in case I accidentally fire it through the wrong program
01:30 bstamour Thank you
01:30 BenGoldberg Right.  Many perl5 and perl6 modules end in .pm or .pl
01:30 dj_goku joined #perl6
01:30 bstamour Makes sense.
01:30 AlexDaniel it makes sense to use .pm6 and .p6 ;)
01:31 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:35 AlexDaniel m: my @a = < aaaaa bbbbb cc >; say unique @a, :with(*.chars == *.chars)
01:35 camelia rakudo-moar ed0ced: OUTPUT«(aaaaa cc)␤»
01:35 AlexDaniel /o\
01:35 AlexDaniel so it is :by for some things and :with for others
01:36 AlexDaniel /o\
01:36 AlexDaniel my biggest problem with it however is this:
01:36 AlexDaniel m: my @a = < aaaaa bbbbb cc >; say unique @a, :as(*.chars)
01:36 camelia rakudo-moar ed0ced: OUTPUT«(aaaaa cc)␤»
01:36 AlexDaniel unique has a very useful :as parameter
01:37 AlexDaniel yet nothing else has it, as far as I can see
01:37 AlexDaniel just imagine: @a.sort(as => *.chars)
01:37 AlexDaniel just imagine: @a.max(as => *.chars)
01:37 AlexDaniel very readable, no *.chars ><= *.chars crap
01:39 AlexDaniel I will open a few tickets for these. Feel free to start a holy war there.
01:39 mcmillhj joined #perl6
01:41 cyphase joined #perl6
01:46 AlexDaniel MasterDuke: can you try clicking a “New ticket” button in RT?
01:46 AlexDaniel I'm wondering if it is broken for everyone or just for me
01:46 MasterDuke AlexDaniel: blank page
01:46 AlexDaniel :(
01:46 cyphase joined #perl6
01:46 cyphase joined #perl6
01:46 [Coke] broken here too. i'll ping the rt admins
01:47 ilbot3 joined #perl6
01:47 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:49 AlexDaniel [Coke]: thank you
01:55 MasterDuke m: sub foo($a where {* < 5 and * > 2}) {dd $a}; foo(6)
01:55 camelia rakudo-moar ed0ced: OUTPUT«Int $a = 6␤»
01:55 MasterDuke m: sub foo($a where * < 5 and * > 2) {dd $a}; foo(6)
01:55 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␤»
01:56 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) …»
01:56 MasterDuke bug that the first one didn't give me the same error as the last?
02:00 dwarring joined #perl6
02:01 AlexDaniel MasterDuke: it is less than awesome
02:01 AlexDaniel fwiw: https://github.com/rakudo/rakudo/blob/5f910316f983dc0b3251b4ede4219a169e96fd70/src/Perl6/Actions.nqp#L6034
02:02 mcmillhj joined #perl6
02:03 cyphase joined #perl6
02:03 MasterDuke thanks, hadn't found it yet
02:04 cyphase joined #perl6
02:05 cyphase joined #perl6
02:06 cyphase joined #perl6
02:06 noganex_ joined #perl6
02:12 ccakes joined #perl6
02:16 dalek doc: c776b84 | MasterDuke17++ | doc/Type/Signature.pod6:
02:16 dalek doc: Fix typos and grammaros in Signature
02:16 dalek doc: review: https://github.com/perl6/doc/commit/c776b84532
02:19 mcmillhj joined #perl6
02:20 BenGoldberg m: constant μ = Mu; my μ $x = &say; dd $x;
02:20 camelia rakudo-moar ed0ced: OUTPUT«Sub $x = sub say (| is raw) { #`(Sub|51498416) ... }␤»
02:30 mcmillhj joined #perl6
02:31 dj_goku joined #perl6
02:31 dj_goku joined #perl6
02:31 rgrinberg joined #perl6
02:36 cyphase joined #perl6
02:39 cyphase joined #perl6
02:40 cyphase joined #perl6
02:40 cyphase joined #perl6
02:43 cyphase joined #perl6
02:44 cyphase joined #perl6
02:46 mcmillhj joined #perl6
02:48 wamba joined #perl6
02:56 mcmillhj joined #perl6
02:56 [Coke] the "new ticket" button was deliberately disabled following a big spam attack on the p5 queue.
02:56 [Coke] (today)
02:57 [Coke] abuse prevention measures need to be put into place. (volunteers welcome, but I don't know what skill sets are needed0
03:03 mohae joined #perl6
03:07 perlawhi1l joined #perl6
03:08 kaare_ joined #perl6
03:14 labster joined #perl6
03:15 mcmillhj joined #perl6
03:19 perlawhi1l AlexDaniel: I brought up my concerns with sort about 5 months ago, but it never really went anywhere
03:19 perlawhi1l I put up a gist here: https://gist.github.com/0racle/134921795a6d91168f31cd554492d824
03:19 AlexDaniel uhh!
03:20 perlawhi1l the crux of the issue is that unique takes a named parameter, whereas most of these other methods take a code block
03:22 perlawhi1l i feel it's not really consistent, and certainly not dwimmy
03:23 dj_goku joined #perl6
03:23 dj_goku joined #perl6
03:26 mcmillhj joined #perl6
03:31 cyphase joined #perl6
03:36 AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.max: :by(*.chars > *.chars)
03:36 camelia rakudo-moar ed0ced: OUTPUT«cc␤»
03:36 AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.max: *.chars
03:36 camelia rakudo-moar ed0ced: OUTPUT«bbbbb␤»
03:36 AlexDaniel m: my @a = < aaa bbbbb cc >; say @a.min: *.chars
03:36 camelia rakudo-moar ed0ced: OUTPUT«cc␤»
03:36 AlexDaniel oh, alright
03:38 mcmillhj joined #perl6
03:41 pierre_ joined #perl6
03:45 giraffe joined #perl6
03:46 saki joined #perl6
03:49 canopus joined #perl6
03:49 ab5tract joined #perl6
03:50 mtj_ joined #perl6
03:52 wamba joined #perl6
03:52 cyphase joined #perl6
03:53 mcmillhj joined #perl6
03:56 labster joined #perl6
03:57 ruoso joined #perl6
03:58 ufobat joined #perl6
03:59 salva joined #perl6
04:00 spider-mario joined #perl6
04:04 tony-o joined #perl6
04:12 mcmillhj joined #perl6
04:16 aries_liuxueyang joined #perl6
04:19 cyphase joined #perl6
04:21 pierre_ joined #perl6
04:26 mcmillhj joined #perl6
04:36 Actualeyes joined #perl6
04:49 djbkd joined #perl6
04:58 mcmillhj joined #perl6
05:03 pierre_ joined #perl6
05:03 Cabanossi joined #perl6
05:06 pierre_ joined #perl6
05:08 wamba joined #perl6
05:13 mcmillhj joined #perl6
05:13 domidumont joined #perl6
05:18 domidumont joined #perl6
05:22 zengargoyle joined #perl6
05:31 M-Illandan joined #perl6
05:33 cyphase joined #perl6
05:47 mcmillhj joined #perl6
05:56 cyphase joined #perl6
05:56 holyghost joined #perl6
05:57 domidumont joined #perl6
06:12 pierre_ joined #perl6
06:13 canopus joined #perl6
06:13 mcmillhj joined #perl6
06:21 pierre_ joined #perl6
06:24 andrzejku joined #perl6
06:25 darutoko joined #perl6
06:28 darutoko- joined #perl6
06:34 mcmillhj joined #perl6
06:35 wamba joined #perl6
06:38 andrzejku hello my friends x)
06:48 perlawhi1l hello
06:49 andrzejku perlawhirl, are you guy from whirlpool?
06:49 perlawhirl nope.
06:49 andrzejku oh okay, your nickname suggest it
06:49 perlawhirl well.. i have an account, but i haven't been there in 10 years or so
06:58 RabidGravy joined #perl6
06:59 zengargoyle joined #perl6
07:10 moritz \o
07:11 ufobat morning perl6 :)
07:11 andrzejku hello :)
07:12 wamba joined #perl6
07:14 mcmillhj joined #perl6
07:15 djbkd joined #perl6
07:29 mcmillhj joined #perl6
07:29 RabidGravy boom!
07:34 jsimonet joined #perl6
07:34 ccakes joined #perl6
07:39 andrzejku last days I tried to play with avr chips
07:39 andrzejku and all failed :(
07:41 darutoko joined #perl6
07:49 djbkd joined #perl6
08:03 mcmillhj joined #perl6
08:03 jonas1 joined #perl6
08:14 labster joined #perl6
08:14 mcmillhj joined #perl6
08:15 masak good antenoon, #perl6
08:27 moritz \o masak
08:31 mcmillhj joined #perl6
08:34 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
08:35 TEttinger why does it have a heartbeat function anyway
08:35 TEttinger "madness"
08:40 dakkar joined #perl6
08:43 zengargoyle TEttinger: firewalls and session timeouts.
08:44 zengargoyle 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? :)
08:46 zengargoyle most probably
08:46 masak ...nah :)
08:46 mcmillhj joined #perl6
08:52 rindolf joined #perl6
08:54 wamba joined #perl6
08:55 andrzejku joined #perl6
08:56 Woodi_ hi #perl6 :)
08:59 Woodi_ 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 ?
09:00 Woodi_ ...drop anything X.50X related ?
09:03 mcmillhj joined #perl6
09:12 arnsholt Woodi_: Probably
09:12 arnsholt Of course, the X509 stuff and friends is a core part of SSL/TLS
09:12 arnsholt So you'll only get so far with just the crypto
09:18 Woodi_ arnsholt: I just want math parts :)  equations, pluses minuses. rest is totally ecosystem...
09:18 Woodi_ but probably I know nothing about network security :)
09:21 Woodi_ SSL/TLS is total foobar, it should be replaced
09:21 Woodi_ fubar even :)
09:22 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:23 eliasr joined #perl6
09:31 zengargoyle Woodi_: if you just want crypto, maybe check https://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 zengargoyle cryptographers."
09:35 dalek doc: 9008874 | (Tom Browder)++ | doc/Language/modules.pod6:
09:35 dalek doc: correct spelling of possessive 'its'
09:35 dalek doc: review: https://github.com/perl6/doc/commit/9008874004
09:36 mcmillhj joined #perl6
09:36 nadim joined #perl6
09:39 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:45 kurahaupo joined #perl6
09:47 kurahaupo_ joined #perl6
09:50 mcmillhj joined #perl6
09:56 dalek doc: e5ddbfe | gfldex++ | doc/Language/functions.pod6:
09:56 dalek doc: fix typo
09:56 dalek doc: review: https://github.com/perl6/doc/commit/e5ddbfedbd
10:22 labster joined #perl6
10:27 pierre_ joined #perl6
10:30 ocbtec joined #perl6
10:33 mcmillhj joined #perl6
10:49 mcmillhj joined #perl6
11:16 mcmillhj joined #perl6
11:36 mcmillhj joined #perl6
11:39 Ulti has anyone reported a borken OSX build?
11:39 Ulti noticing its since I updated to the latest XCode
11:39 Ulti "Symbol not found: _clock_gettime"
11:40 Ulti I can try and hunt down where this has moved to if no one is already checking it out
11:42 andrzejku joined #perl6
11:44 Ulti full output https://gist.github.com/MattOates/45e87e3aba73ad875fae34f396a56c01
11:45 pierre_ joined #perl6
11:46 moritz I'm not aware of anybody chasing it down
11:47 Ulti looks like its a problem for a lot of people over a tonne of projects for this version of XCode+OSX
11:48 Ulti OSX 10.11.6 XCode 8.0
11:49 Ulti the current solution online is update the whole of your OS :Z
12:07 andrzejku joined #perl6
12:10 moritz does that make it OS Y? :-)
12:15 bjz_ joined #perl6
12:16 El_Che Ulti: be careful when upgrading the OS. The signature needed to downgrade is only valid a short period of time.
12:16 El_Che ios :)
12:16 El_Che oh, I am too early? Give it a few years :)
12:19 bjz__ joined #perl6
12:23 jcallen joined #perl6
12:33 aries_liuxueyang joined #perl6
12:34 Celelibi joined #perl6
12:40 sftp joined #perl6
12:40 rgrinberg joined #perl6
12:43 bjz joined #perl6
12:43 [Coke] I am on xcode 8.0 (8A218a) and have noticed no issues.
12:46 bdmatatu joined #perl6
12:46 andrzejku joined #perl6
12:51 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:53 wamba joined #perl6
12:53 RabidGravy joined #perl6
12:54 djbkd_ joined #perl6
12:56 gfldex m: use nqp; say nqp::sha1("abc");
12:56 camelia rakudo-moar 5a3df8: OUTPUT«A9993E364706816ABA3E25717850C26C9CD0D89D␤»
12:56 gfldex bdmatatu: ^^^ possible but may be unwise
12:58 andrzejku hey guys
12:58 andrzejku why no-one tried to write llvm perl6 interpreter?
12:58 buggable joined #perl6
12:59 perlpilot andrzejku: I think it's because llvm is more of a VM toolkit than a VM
12:59 NeuralAnomaly joined #perl6
13:00 bdmatatu gfldex: oh, too bad...nqp::sha1 is very fast, was hoping to use it as part of an hmac computation
13:01 gfldex bdmatatu: you can test if you are on rakudo and if not provide a Perl 6 variant or load a module
13:02 gfldex bdmatatu: right now it's a little tricky to have automatic tests for not being on Rakudo tho (hence my unwise-remark)
13:03 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?
13:03 bdmatatu I tried that, but was looking to improve performance.
13:04 bdmatatu (of the hash part, not the hmac part)
13:04 DrForr Nice.
13:05 djbkd joined #perl6
13:06 bjz joined #perl6
13:06 mcmillhj joined #perl6
13:07 itaipu joined #perl6
13:08 sftp joined #perl6
13:11 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:12 hackedNODE gfldex: why is it tricky?
13:13 hackedNODE m: $*PERL.compiler.name.say
13:13 camelia rakudo-moar 5a3df8: OUTPUT«rakudo␤»
13:13 hackedNODE Oh, you mean at nqp level. Nevermind
13:14 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:15 djbkd joined #perl6
13:15 andrzejku joined #perl6
13:16 El_Che joined #perl6
13:16 ptolemarch joined #perl6
13:18 cdg joined #perl6
13:21 gregf_ joined #perl6
13:22 * [Coke] adds that to the docs.
13:23 dalek doc: 99a8666 | (Tom Browder)++ | doc/Type/Signature.pod6:
13:23 dalek doc: add example of type constraint on an optional argument
13:23 dalek doc: review: https://github.com/perl6/doc/commit/99a8666dd8
13:26 djbkd_ joined #perl6
13:36 djbkd joined #perl6
13:37 nine 5~/win 13
13:40 masak m: sub infix:<~/win>($l, $r) { $l / $r }; say 5~/win 13
13:40 camelia rakudo-moar 5a3df8: OUTPUT«0.384615␤»
13:41 masak irssi window division :)
13:44 jnthn m)
13:46 djbkd_ joined #perl6
13:47 andrzejku hey should someone explain me
13:47 andrzejku some details about nap
13:47 andrzejku nqp
13:47 timotimo OK, like what?
13:48 andrzejku nap is something similar to perl?
13:48 andrzejku nqp
13:48 timotimo "not quite perl6"
13:49 timotimo it's what we use to implement rakudo
13:49 andrzejku rakudo is perl6?
13:49 timotimo rakudo is our perl6 compiler
13:49 andrzejku okay
13:49 andrzejku so
13:49 timotimo there used to be other projects, but only rakudo remains in active development
13:50 skids joined #perl6
13:50 andrzejku why nqp was invented at all?
13:50 andrzejku why just not to write perl6 interpreter
13:50 andrzejku in C or C++
13:50 andrzejku whatever
13:50 timotimo rakudo started on Parrot. it would have been terrible to write rakudo completely in parrot's assembly-language
13:51 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++
13:52 andrzejku ohh
13:52 andrzejku timotimo, I am looking for it
13:52 andrzejku where can I find it?
13:52 timotimo good question
13:52 timotimo https://github.com/Itay2805/Perl6-Native-Compiler
13:52 timotimo there it is
13:52 timotimo oh, look at the first line of the readme
13:53 timotimo i don't see a repo for a native nqp compiler, though
13:55 andrzejku joined #perl6
13:55 acrussell joined #perl6
13:57 bjz_ joined #perl6
13:57 djbkd joined #perl6
13:58 andrzejku timotimo, sorry [kid] will be soon back
13:58 timotimo i might be AFK when you return
13:58 andrzejku ok
14:08 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 hackedNODE s: Hash, 'classify-list'
14:08 SourceBaby hackedNODE, Sauce is at https://github.com/rakudo/rakudo/blob/5a3df86/src/core/Hash.pm#L309
14:08 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:09 djbkd joined #perl6
14:09 * hackedNODE plugs http://perl6.party/post/Perl-6-is-written-in...-Perl-6
14:10 rindolf joined #perl6
14:11 hackedNODE andrewalker: also: optimizations. It's easier to optimize a subset than a huge language.
14:12 timotimo on top of that, nqp has a few limitations that make optimization a whole lot more feasible
14:12 andrzejku joined #perl6
14:13 itcharlie1 joined #perl6
14:14 khw joined #perl6
14:15 andrzejku hackedNODE, I don't think to let users modify just for fun
14:15 andrzejku is good idea
14:15 andrzejku it is better if they write libs which extend language
14:16 timotimo this isn't really about "modify perl6 for fun", it's about "please help us with core development"
14:17 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␤»
14:17 timotimo on the other hand, making it easier for users to change rakudo and nqp for their purposes is also good
14:17 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?
14:17 camelia rakudo-moar 5a3df8: OUTPUT«$r == Any Scalar|63362808␤»
14:18 skids It seems the local variable scope does not get constructed until the whenever gets normally entered.
14:20 grondilu joined #perl6
14:20 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:21 timotimo open source software is super insecure because anyone can just go and edit the code!
14:21 andrzejku I don't mean prone
14:21 timotimo imagine all the backdoors and viruses you get!
14:21 * 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.
14:21 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.
14:22 andrzejku I think it makes Perl much more slower
14:22 skids Until the compiler is improved, sure :-)
14:22 hackedNODE andrzejku: slower to... what?
14:22 * grondilu basically is wishing whoever designs javascript would just decide ES7 would be Perl 6 :)
14:23 djbkd joined #perl6
14:23 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
14:23 andrzejku right now thinks looks odd
14:23 andrzejku yeah
14:24 andrzejku but why MoarVM take so strange staff
14:24 andrzejku moar.nqp
14:24 timotimo ?
14:24 hackedNODE andrzejku: I'm not understanding what you mean. What strange stuff?
14:25 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.
14:25 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.
14:25 timotimo for nqp and rakudo
14:25 tbrowder m: sub f($a
14:25 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␤»
14:25 andrzejku and nqp is core lang design
14:26 timotimo "core lang design"?
14:26 tbrowder m: sub a($f? where $f >= 0
14:26 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␤»
14:26 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.
14:27 hackedNODE 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
14:28 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
14:28 andrzejku so Perl6 should be slower by design?
14:28 hackedNODE andrzejku: "slower" than what?
14:28 andrzejku slower than Swift for ex.
14:28 hackedNODE andrzejku: "slower" at what?
14:28 andrzejku slower at all
14:28 andrzejku omg
14:28 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"
14:29 timotimo we're already faster at some things compared to perl5, and perl5 is written in C
14:29 pmurias joined #perl6
14:29 arnsholt The basic architecture of Perl 6 is broadly the same as used in most other VM-backed languages
14:30 arnsholt There's a compiler, and it generates bytecodes for the target VM
14:30 mspo timotimo: really?
14:30 dalek doc: d5272a6 | MasterDuke17++ | doc/Programs/00-running.pod6:
14:30 dalek doc: Update the description text for 00-running.pod6
14:30 dalek doc:
14:30 dalek doc: It now matches what Rakudo currently shows.
14:30 dalek doc: review: https://github.com/perl6/doc/commit/d5272a64d1
14:30 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
14:30 hackedNODE writing yet.
14:31 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.
14:31 andrzejku hackedNODE, okay but think why Perl6 is not used on ARM chips?
14:31 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
14:31 andrzejku and Python? yes
14:31 timotimo https://6guts.wordpress.com/2016/06/12/grinding-out-performance-improvements/ - mspo, mostly on small examples, though
14:31 djbkd joined #perl6
14:32 hackedNODE andrzejku: and think why is a hammer not used to drive screws in?
14:32 hackedNODE and a screwdriver is
14:32 tadzik python people tried to write an OS in it too, doesn't mean it was a good idea
14:32 mspo timotimo: did that print a string a million times get fixed? :)
14:32 tbrowder sub f(Int $i? where $i >= 0){}; f()
14:33 hackedNODE andrzejku: and you're comparing apples to oranges there in the first place. Perl 6 has by far less optimization effort.
14:33 hackedNODE *has had
14:33 timotimo mspo: we're still using libuv async I/O for synchronous output, so i'm guessing that's still slow
14:34 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␤␤»
14:34 hackedNODE I think that issue was due to parsing, no?
14:34 hackedNODE m: ("print 42;" x 10000).EVAL; say now - INIT now;
14:34 timotimo oh, was that when we generate a source file that is a million lines of code, each just 'say "some string"'?
14:34 camelia rakudo-moar 5a3df8: OUTPUT«4242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242…»
14:34 andrzejku ok I won't argue with you
14:34 hackedNODE oh oops
14:34 mspo timotimo: yes that one
14:34 hackedNODE m: ("print '';" x 10000).EVAL; say now - INIT now;
14:35 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
14:35 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:
14:36 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
14:36 timotimo mspo: https://6guts.wordpress.com/2016/03/06/digging-into-the-performancereliability-work/ this one, too
14:36 DrForr andrzejku: Perl6 has been cross-compiled to ARM; there was a talk at YAPC::EU on it.
14:37 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()
14:37 camelia rakudo-moar 5a3df8: ( no output )
14:38 tbrowder that works but is ugly, i prefer to use a block containing the constraint:
14:40 * grondilu is suprised $i >= 0 = 0 is legal
14:40 tbrowder m: sub f(Int $i where {$i >= 0} = 0){}; f()
14:40 camelia rakudo-moar 5a3df8: ( no output )
14:40 grondilu o_O
14:40 timotimo grondilu: only because it's in a parameter declaration
14:40 hackedNODE grondilu: default value
14:41 grondilu oh yeah
14:42 arnsholt Yeah, it took me a while to parse it too
14:42 djbkd joined #perl6
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:43 Actualeyes joined #perl6
14:43 hackedNODE tbrowder: what's the bug?
14:43 tbrowder the default value is the key to making it optional
14:44 tbrowder the bug is the opaque error msg
14:44 hackedNODE m: sub f(Int $i? where {$ // True} ){}; f()
14:44 camelia rakudo-moar 5a3df8: ( no output )
14:44 tbrowder the original try was to put a constraint on an optional param
14:45 * hackedNODE recalls something about that
14:45 tbrowder yr example is weird to a newb
14:46 hackedNODE tbrowder: I typoed $_ as $
14:47 hackedNODE 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 hackedNODE m: Int ~~ 42
14:47 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␤␤»
14:47 tbrowder can you splain the block contents?
14:47 hackedNODE m: sub f(Int $i? where {$_ // True} ){};
14:47 camelia rakudo-moar 5a3df8: ( no output )
14:47 hackedNODE m: sub f(Int $i? where 42 ){};
14:47 camelia rakudo-moar 5a3df8: ( no output )
14:48 hackedNODE tbrowder: return either the value itself or True if the value is not defined
14:49 hackedNODE 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 hackedNODE s/weird/not helpful if you don't know how this stuff works under the hood/;
14:50 tbrowder ah, ok, but that example i'm not sure could be made to have the numercal constraint i want
14:50 timotimo sure
14:50 hackedNODE m: sub f(Int :$i where {$_ // True} ){};
14:50 camelia rakudo-moar 5a3df8: ( no output )
14:50 hackedNODE m: sub f(Int :$i where 42 ){}; f()
14:50 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␤␤»
14:51 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?
14:51 hackedNODE m: sub f(Int $i? where .defined or * >= 0){}; f()
14:51 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␤»
14:51 hackedNODE m: sub f(Int $i? where .defined || * >= 0){}; f()
14:51 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␤␤»
14:51 timotimo the or is too low precedence to go in there
14:51 hackedNODE bah
14:51 timotimo yeah, don't want a whatever there
14:51 hackedNODE m: sub f(Int $i? where { .defined or $_ >= 0 } ){}; f()
14:51 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␤␤»
14:51 timotimo you're mixing .defined with a whatever code
14:52 timotimo and need a negation before .defined
14:52 hackedNODE m: sub f(Int $i? where { !.defined or $_ >= 0 } ){}; f()
14:52 camelia rakudo-moar 5a3df8: ( no output )
14:52 hackedNODE teamwork :)
14:52 timotimo \o/
14:52 * timotimo BBIAB
14:52 hackedNODE tbrowder: fwiw, there's Subset::Helper module
14:52 tbrowder part of the problem is the ?
14:53 djbkd_ joined #perl6
14:53 tbrowder yr solution is longer than mine
14:53 hackedNODE tbrowder: what's yours?
14:53 tbrowder and not as clear IMHO
14:53 dalek doc: 7a23103 | MasterDuke17++ | doc/Programs/00-running.pod6:
14:53 dalek doc: Another minor formatting change to 00-running.pod6
14:53 dalek doc: review: https://github.com/perl6/doc/commit/7a23103f57
14:54 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:55 hackedNODE m: sub foo ($? where { say "oh hai"; True }) {}()
14:55 camelia rakudo-moar 5a3df8: OUTPUT«oh hai␤»
14:55 tbrowder hackedNODE: see my solution earlier, i'll try to repeat:
14:55 hackedNODE The $_ >= 0 = 0 one? That's not the same as mine, because it uses 0 default, while mine doesn't
14:56 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()␤»
14:56 tbrowder arg, forgot the {};
14:57 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␤»
14:57 hackedNODE m: sub f(Int $i where !.defined || $_ >= 0) { say "\$i is $i.perl()" }; f()
14:57 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␤␤»
14:57 hackedNODE m: sub f(Int $i? where !.defined || $_ >= 0) { say "\$i is $i.perl()" }; f()
14:57 camelia rakudo-moar 5a3df8: OUTPUT«$i is Int␤»
14:57 tbrowder the zero default makes it an optional param which is what i want
14:57 hackedNODE OK
14:58 tbrowder anyhoo, is the msg LTA or not in y'all's opinion?
14:58 hackedNODE m: sub f(UInt $i = 0) { }; f()
14:58 camelia rakudo-moar 5a3df8: ( no output )
14:59 hackedNODE ^ shorter version
15:00 hackedNODE 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:01 hackedNODE s: 42, 'ACCEPTS'
15:01 SourceBaby hackedNODE, Sauce is at https://github.com/rakudo/rakudo/blob/5a3df86/src/core/Mu.pm#L12
15:01 hackedNODE s: 42, 'ACCEPTS', \(Int)
15:01 SourceBaby hackedNODE, Sauce is at https://github.com/rakudo/rakudo/blob/5a3df86/src/core/Numeric.pm#L7
15:02 hackedNODE Looks like that one can be fixed by adding another candidate
15:02 * hackedNODE & lunch
15:05 djbkd joined #perl6
15:07 sufrostico joined #perl6
15:12 smls joined #perl6
15:12 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]␤»
15:13 smls ^^ Why does .clone not give a fresh array?
15:14 dj_goku smls: not sure what a shallow clone is: https://docs.perl6.org/type/Array#(Mu)_method_clone
15:15 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:16 smls 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]␤»
15:16 skids Yeah that's kinda messed up IMO.
15:16 smls ^^ Looks like it does create a new object, but pushing to one affects the other?
15:16 djbkd joined #perl6
15:17 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.
15:17 dj_goku m:  my @a = 2, 4, 6;  my @b = @a;  $b.push(8);  dd @a; dd @b;
15:17 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;␤»
15:17 jnthn I'm guessing Array doesn't have a method clone of its own, so it does The Default Thing in Mu
15:17 dj_goku m:  my @a = 2, 4, 6;  my @b = @a;  @b.push(8);  dd @a; dd @b;
15:17 camelia rakudo-moar 5a3df8: OUTPUT«Array @a = [2, 4, 6]␤Array @b = [2, 4, 6, 8]␤»
15:17 jnthn Which keeps the storage
15:17 jnthn It should probably get its own method clone
15:17 smls ah
15:18 smls ok, will RT
15:18 jnthn I thought that had already happened. :
15:18 jnthn :S
15:18 jnthn But yeah, it wants fixing. The current behavior is crap.
15:21 timotimo cue writing spec tests for .clone of pretty much every single class :)
15:22 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.
15:25 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)}␤»
15:27 djbkd_ joined #perl6
15:29 girafe joined #perl6
15:29 itcharlie1 left #perl6
15:31 geekosaur smls, not sure if this is still relevant although it sounds like it
15:31 geekosaur [29 02:56:37] <[Coke]> the "new ticket" button was deliberately disabled following a big spam attack on the p5 queue.
15:32 smls geekosaur: Ah, thanks. I'll send it per email then.
15:39 skids Huh, I just made a new ticket just minutes before... but I don't have perms to the perl5 queue.
15:39 skids So maybe that's why my button is ok.
15:39 djbkd joined #perl6
15:43 skids .oO(Testing destruction kinda blows)
15:44 timotimo yes, quite.
15:45 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
15:46 mempko joined #perl6
15:48 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:49 djbkd joined #perl6
15:56 lostinfog joined #perl6
15:56 pdcawley joined #perl6
16:02 djbkd joined #perl6
16:07 woolfy joined #perl6
16:08 domidumont joined #perl6
16:11 itaipu joined #perl6
16:13 pmurias m: use nqp;say(nqp::iscont(Scalar));
16:13 camelia rakudo-moar 5a3df8: OUTPUT«1␤»
16:13 pmurias jnthn: is that correct?
16:13 timotimo for an undefined Scalar object?
16:13 timotimo or in general?
16:14 pmurias for a type object of a thing that is a container
16:14 jnthn pmurias: Believe so
16:15 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
16:15 jnthn (I can see the temptation to enforce definedness as part of it)
16:15 pmurias I was just making sure if a behavior is accidental or something that I should reimplement
16:16 timotimo that's very helpful in general, pmurias
16:16 timotimo you basically go over everything with a watchful eye
16:16 timotimo that can also help us find things that may have been useful once, but no longer are
16:16 jnthn Yes, it's good to ask. Some things are cruft. :)
16:18 djbkd joined #perl6
16:24 hackedNODE RT busted? I'm getting a blank page when I try to create a ticket :/
16:25 hackedNODE oh well, no ticket then
16:25 V-ille joined #perl6
16:26 V-ille left #perl6
16:26 V-ille joined #perl6
16:28 timotimo RT got spam-waved recently
16:28 timotimo so the "create ticket" button got disabled
16:30 smls hackedNODE: Creating a ticket by sending an email to rakudobug@perl.org still works
16:31 hackedNODE smls: what is the usual delay between sending an email and seeing the ticket show up?
16:31 moritz minutes to hours
16:31 hackedNODE cool
16:32 timotimo in my experience it's usually very close to the "minutes" end
16:33 djbkd joined #perl6
16:36 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:37 geekosaur (because I seem to get mail from it in heterogeneous batches)
16:41 V-ille left #perl6
16:57 captain-adequate joined #perl6
16:59 mcmillhj joined #perl6
17:00 RabidGravy I've just done a programming test in Perl 5 for a recruiter, I'd much rather have done it in 6 :)
17:01 timotimo :)
17:01 timotimo perl 6 makes it much too easy to write programs
17:01 timotimo that's like asking the programmer to push a single button to get the job
17:03 Juerd I once almost got a job by answering "dwim();"
17:03 Alikzus joined #perl6
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
17:04 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:06 RabidGravy that would be silly
17:06 Juerd Yes.
17:10 Alikzus joined #perl6
17:15 _slade_ joined #perl6
17:16 cpage_ joined #perl6
17:18 chris2 joined #perl6
17:18 TimToady you should'a used Inline::Perl6 to solve it :P
17:19 Ulti El_Che: why would I want to downgrade Siri ;)
17:19 RabidGravy :)  That did occur to me
17:25 El_Che :)
17:26 Alikzus joined #perl6
17:32 wamba joined #perl6
17:34 andrzejku joined #perl6
17:35 dalek Inline-Perl5: e2d9f94 | niner++ | / (2 files):
17:35 dalek Inline-Perl5: Optimize calls to P5 methods without args
17:35 dalek Inline-Perl5:
17:35 dalek Inline-Perl5: No need to set up @args and @svs arrays. Just pass the self $obj instead of
17:35 dalek Inline-Perl5: the argument list.
17:35 dalek Inline-Perl5: Saves about 2 % in csv-ip5xs.pl
17:35 dalek Inline-Perl5: review: https://github.com/niner/Inline-Perl5/commit/e2d9f94a66
17:42 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 harmil_wk Is that true today?
17:43 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…»
17:43 jnthn m: { 42; LEAVE { say $_ } }
17:43 camelia rakudo-moar 58cf9d: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 42 in sink context (line 1)␤(Any)␤»
17:43 harmil_wk m: sub test { return (state $x = 0)++; LEAVE {.say; $_++ } }; say test
17:43 camelia rakudo-moar 58cf9d: OUTPUT«(Any)␤0␤»
17:44 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
17:44 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␤   …»
17:44 jnthn m: sub foo { return 42; LEAVE { say $_ } }; foo
17:44 camelia rakudo-moar 58cf9d: OUTPUT«(Any)␤»
17:44 FROGGS joined #perl6
17:44 jnthn m: sub foo { return 42; POST { say $_ } }; foo
17:44 camelia rakudo-moar 58cf9d: OUTPUT«42␤»
17:44 jnthn Oddness, it works for POST
17:45 harmil_wk oh, okay. Welll that's something
17:45 jnthn And I thought LEAVE/KEEP/UNDO were hung off the same hook
17:48 andrzejku hi :)
17:51 harmil_wk a very slightly LTA error:
17:51 harmil_wk m: sub test { return (state $x = 0 )++; POST { $_++ } }; say test
17:51 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)…»
17:52 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 harmil_wk Should I rakudobug that?
17:53 masak jnthn: they are, but I'm not sure offhand LEAVE topicalizes something.
17:54 masak jnthn: POST does because spec says it oughta with the return value.
17:55 masak harmil_wk: sure, why not -- though I'm not sure the verdict will be "we can haz nice error" on that :/
17:55 Alikzus joined #perl6
17:56 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"
17:56 camelia rakudo-moar 58cf9d: ( no output )
17:56 smls It could detect that all signature candidates fail to match for the same reason, and then say that reason.
17:56 hackedNODE m: multi foo ($ is rw) { "wrong" }; multi foo ($) {"right"}; say foo "42"
17:56 camelia rakudo-moar 58cf9d: OUTPUT«wrong␤»
17:57 masak harmil_wk: we try to discourage the meme that Perl 6 is a trek :P
17:57 Woodi_ git log is crazy...
17:57 hackedNODE m: multi foo ($) { "right" }; multi foo ($ is rw) {"wrong"}; say foo "42"
17:57 camelia rakudo-moar 58cf9d: OUTPUT«wrong␤»
17:57 hackedNODE really...
17:57 hackedNODE m: multi foo ($) { "right" }; multi foo ($ is rw) {"wrong"}; say foo $
17:57 camelia rakudo-moar 58cf9d: OUTPUT«wrong␤»
17:57 harmil_wk masak: We're calling religious certitude a "meme" now... huh
17:58 hackedNODE Why does it like is rw so much that even order doesn't help :/
17:59 jnthn hackedNODE: By spec, rw is tigheter (and not as a tie-breaker, but for real)
17:59 jnthn But it should only do it on a container...
18:00 perlpilot though, it still looks like that approach might work for postfix:<++> since it doesn't seem to have an Any candidate
18:00 AndyBotwin joined #perl6
18:00 AndyBotwin joined #perl6
18:00 jnthn So I've no idea what's happening with the "42"
18:00 cognominal left #perl6
18:01 hackedNODE m: multi foo ($) { "right" }; multi foo ($x is rw) { $x = 72; "wrong"}; say foo "42"
18:01 camelia rakudo-moar 58cf9d: OUTPUT«right␤»
18:01 hackedNODE m: multi foo ($) { "right" }; multi foo ($x is rw) {"wrong"}; say foo "42"
18:01 camelia rakudo-moar 58cf9d: OUTPUT«wrong␤»
18:01 hackedNODE you're kidding me
18:01 jnthn m: say nqp::iscont("42")
18:01 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>␤»
18:02 hackedNODE Well, at least the ++ thing can be fixed :)
18:02 jnthn m: use nqp; say nqp::iscont("42")
18:02 camelia rakudo-moar 58cf9d: OUTPUT«0␤»
18:02 jnthn wtf
18:02 masak harmil_wk: "meme" was coined in the seventies with the current meaning.
18:02 moritz m: sub f($ is rw) {}; f 42
18:02 camelia rakudo-moar 58cf9d: OUTPUT«Internal error: inconsistent bind result␤  in sub f at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
18:02 hackedNODE :o
18:02 jnthn Yup, that ain't right.
18:02 moritz at least that's... *consistent* with the wrong multi dispatch behavior :-)
18:03 * masak .oO( wrongconsistency.org )
18:05 jnthn It's even tested... https://github.com/perl6/roast/blob/master/S06-multi/by-trait.t
18:06 jnthn m: m: multi foo ($) { say "right" }; multi foo ($x is rw) {say "wrong"}; foo "42"
18:06 camelia rakudo-moar 58cf9d: OUTPUT«right␤»
18:06 jnthn grrr, I wonder if the optimizer is static-inlining it :S
18:07 masak is there a way to test whether't is?
18:08 jnthn --optmize=off at the command line
18:08 jnthn 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 :/
18:09 masak seems wise, yes.
18:09 hackedNODE Yeah, optimizer bug (just tested)
18:09 hackedNODE I call dibs! :)
18:10 * hackedNODE still needs to unlock the "Debugged Optimizer Bug" Achievement
18:11 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:14 Alikzus joined #perl6
18:17 canopus joined #perl6
18:18 masak we call them cups, not donuts :P
18:19 * masak , plying stale old topological jokes
18:19 perlpilot masak: they offer 2 forms of donuts, one is edible and the other holds coffee
18:22 timotimo flying state machine of the yard?!
18:23 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": http://www.meetup.com/Toronto-Perl-Mongers/events/233588645/ It's FREE! (may be worth pinging Dave, so he'd have you on the list for security people): https://twitter.com/meraxes
18:25 masak sounds fantastic.
18:26 masak unfortunately, I most likely won't be in Toronto in 4.5 hours... :)
18:26 timotimo me neither :(
18:26 hackedNODE There should be a recording of it :)
18:27 timotimo yay
18:27 * masak .oO( here we record for posterity how masak and timotimo weren't in Toronto )
18:28 timotimo masak: maybe we'll see each other when we'ren't in toronto
18:29 masak you mean, given that "not in Toronto" is a relatively small place?
18:29 masak ...I see your point.
18:30 perlpilot .oO( More of a surface innit? )
18:31 timotimo i'm assuming we're not going to be in outer space or below sea level ...
18:31 timotimo in that case i know of a few places that are pretty gigantic in comparison to "not in toronto"
18:32 masak the more I think of it, the more likely it seems we'll just bump into each other
18:33 timotimo so if you think real much about it, we'll definitely meet?
18:33 dalek Inline-Perl5: 0f2805e | niner++ | lib/Inline/Perl5.pm6:
18:33 dalek Inline-Perl5: Be smarter about avoiding slurpies when calling P5 methods
18:33 dalek Inline-Perl5:
18:33 dalek Inline-Perl5: This gets rid of quite a bit of unpacking and repacking and setting up slurpy
18:33 dalek Inline-Perl5: arguments which end up empty.
18:33 dalek Inline-Perl5:
18:33 dalek Inline-Perl5: Saves another ~ 22 % on the csv-ip5xs.pl benchmark.
18:33 dalek Inline-Perl5: review: https://github.com/niner/Inline-Perl5/commit/0f2805e44e
18:33 dalek Inline-Perl5: 4cb9b18 | niner++ | META.info:
18:33 dalek Inline-Perl5: Version 0.16
18:33 dalek Inline-Perl5: review: https://github.com/niner/Inline-Perl5/commit/4cb9b18444
18:33 timotimo holy wow, 22%
18:34 nine Now at 2.994s of which 30 % is just startup.
18:35 hackedNODE Does this look like amazed group of people or are they scared? http://tpm2016-2.zoffix.com/crowd-surprised.jpg
18:35 timotimo i think "surprise" fits pretty well
18:36 timotimo 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 :)
18:37 perlpilot_ joined #perl6
18:39 masak I think some of them already look somewhat scandalized
18:39 hackedNODE Oh, maybe I should change it then :)
18:40 hackedNODE They're supposed to be amazed at Perl 6's awesomeness :D
18:40 itaipu joined #perl6
18:40 masak "They used WHAT syntax!?"
18:43 dogbert17 joined #perl6
18:45 dogbert17 o/
18:46 dogbert17 according to a table in https://docs.perl6.org/language/regexes  U+000C means CARRIAGE RETURN, this has to be a typo no?
18:47 grondilu joined #perl6
18:47 grondilu what's the P5 equivalent to infix:<xx>?
18:47 hackedNODE grondilu: x in list mode
18:47 masak grondilu: ("elem") x $n
18:47 grondilu oh cool
18:47 masak grondilu: because parentheses are only for grouping! :P
18:49 hackedNODE m: say "\x[000C]".uniname
18:49 camelia rakudo-moar 58cf9d: OUTPUT«FORM FEED (FF)␤»
18:49 hackedNODE dogbert17: seems to be
18:49 DrForr dogbert17: Submit a pull request?
18:49 hackedNODE Commit directly :)
18:50 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 Alikzus joined #perl6
18:50 dogbert17 s/im/in/
18:51 hackedNODE m: ^0xFFFFF .grep({.chr ~~ /\v/}).say
18:51 camelia rakudo-moar 58cf9d: OUTPUT«(10 11 12 13 133 8232 8233)␤»
18:51 hackedNODE m: ^0xFFFFF .grep({.chr ~~ /\v/})».base(16).say
18:51 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␤»
18:52 hackedNODE m: (^0xFFFFF).grep({.chr ~~ /\v/})».base(16).say
18:52 dogbert17 now we're talking, hackeNODE++
18:52 camelia rakudo-moar 58cf9d: OUTPUT«(A B C D 85 2028 2029)␤»
18:52 dogbert17 I wonder if these are the same as those supported by P5, checks ...
18:53 hahainternet you can uniname them can't you?
18:53 hackedNODE yes
18:53 hackedNODE m: (^0xFFFFF).grep({.chr ~~ /\v/})».uniname.say
18:53 camelia rakudo-moar 58cf9d: OUTPUT«(LINE FEED (LF) LINE TABULATION FORM FEED (FF) CARRIAGE RETURN (CR) NEXT LINE (NEL) LINE SEPARATOR PARAGRAPH SEPARATOR)␤»
18:53 hahainternet nice
18:53 dogbert17 DrForr.: the table will be fixed :-)
18:53 SmokeMachine____ hi! how can I create a Regex from a string?
18:54 moritz rx/<$string>/
18:54 dogbert17 excellent
18:54 hackedNODE Note that you won't get the matches
18:54 hackedNODE *captures
18:55 smls you do if you name the capture, as in <foo=$string>
18:57 SmokeMachine____ moritz: thanks!
18:58 smls SmokeMachine____, moritz: Note, though, that it technically creates a closure. So if $string is changed afterwards, it affects the regex:
18:58 smls m: my $string = "a";  my $x = rx/<$string>/;  $string = "<[0..9]>";  say "a5".match($x)
18:58 camelia rakudo-moar 58cf9d: OUTPUT«「5」␤»
18:58 SmokeMachine____ m: my $regex = q{"/account/" $<acc_id> = [\d+]}; say $<acc_id> if "/account/123" ~~ m{<$regex>}' # :(
18:58 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␤»
18:58 dalek doc: 5d8221c | (Jan-Olof Hendig)++ | doc/Language/regexes.pod6:
18:58 dalek doc: Corrected the table of vertical whitespace characters. hackedNODE++
18:58 dalek doc: review: https://github.com/perl6/doc/commit/5d8221ce20
18:58 SmokeMachine____ m: my $regex = q{"/account/" $<acc_id> = [\d+]}; say $<acc_id> if "/account/123" ~~ m{<$regex>} # :(
18:58 camelia rakudo-moar 58cf9d: OUTPUT«Nil␤»
18:59 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+]} # :(
19:00 camelia rakudo-moar 58cf9d: OUTPUT«「123」␤»
19:00 smls SmokeMachine____: That's what hackedNODE mentioned earlier.
19:01 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>}
19:01 camelia rakudo-moar 58cf9d: OUTPUT«「123」␤»
19:01 SmokeMachine____ any way to do that?
19:01 smls ^^
19:01 SmokeMachine____ smls: thanks!
19:02 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)
19:03 hackedNODE I meant... smls++ :)
19:04 dalek Inline-Perl5: 61473e4 | niner++ | lib/Inline/Perl5.pm6:
19:04 dalek Inline-Perl5: Speed up calling P6 methods a bit
19:04 dalek Inline-Perl5:
19:04 dalek Inline-Perl5: Getting rid of the intermediary array saves about 4 % in csv-ip5xsio.pl
19:04 dalek Inline-Perl5: review: https://github.com/niner/Inline-Perl5/commit/61473e4862
19:04 hackedNODE Is there a way to avoid the closure and use the value that it's at at the time?
19:05 timotimo make it a parameter and pass it?
19:05 timotimo a closure is what stores "what value it's at at the time"
19:05 moritz hackedNODE: or are you mixing captures and closures right now?
19:05 * moritz confused
19:05 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"?
19:05 camelia rakudo-moar 58cf9d: OUTPUT«「123」␤»
19:06 * moritz doesn't see closures, just captures
19:06 SmokeMachine____ smls: ^^
19:06 hackedNODE moritz: I dunno. That's what smls said, that rx/<$foo>/ is a closure
19:06 hackedNODE timotimo: parameter to what tho?
19:07 moritz m: my $foo = 'a'; my $rx = rx/$foo/; $foo = 'b'; say 'ab' ~~ $rx
19:07 camelia rakudo-moar 58cf9d: OUTPUT«True␤»
19:07 moritz m: my $foo = 'a'; my $rx = rx/$foo/; $foo = 'b'; say 'b' ~~ $rx
19:07 camelia rakudo-moar 58cf9d: OUTPUT«True␤»
19:07 moritz m: my $foo = 'a'; my $rx = rx/$foo/; $foo = 'b'; say 'a' ~~ $rx
19:07 camelia rakudo-moar 58cf9d: OUTPUT«False␤»
19:07 smls moritz: regexes are just routines written in a funny syntax, and routines that use outside lexical variables close over them.
19:07 moritz hm, right, that's a closure right there
19:09 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)
19:09 camelia rakudo-moar 58cf9d: OUTPUT«「a」␤»
19:09 timotimo if you want to freeze the value, might want to us EVAL to create the regex instead?
19:09 smls SmokeMachine____: No, that'll call $regex.clone again on every match.
19:10 Ven_ joined #perl6
19:10 SmokeMachine____ :(
19:10 hackedNODE SmokeMachine____: my example avoids the issue
19:10 smls timotimo: Or just not modify the variable again...
19:10 timotimo fair enough
19:10 hackedNODE SmokeMachine____: calls a block with the string and returns a regex with that value
19:11 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...
19:11 cpage_ joined #perl6
19:15 perlpilot joined #perl6
19:28 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.
19:29 BillSussman joined #perl6
19:30 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
19:30 hackedNODE The UInt, I'm guessing...
19:31 hackedNODE m: say Int ~~ 42
19:31 camelia rakudo-moar 58cf9d: OUTPUT«False␤»
19:31 hackedNODE ^ that's fixed now, btw
19:32 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␤␤»
19:32 hackedNODE heh
19:33 hackedNODE 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␤␤»
19:33 labster joined #perl6
19:34 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 labster joined #perl6
19:35 TEttinger joined #perl6
19:35 notostraca joined #perl6
19:38 dalek doc: 05c700e | (Tom Browder)++ | doc/Type/Signature.pod6:
19:38 dalek doc: better example per hackedNODE@perl6.party
19:38 dalek doc: review: https://github.com/perl6/doc/commit/05c700ec93
19:38 [particle]1 joined #perl6
19:42 nemo_ joined #perl6
19:42 labster joined #perl6
19:43 ilbelkyr_ joined #perl6
19:44 avalenn joined #perl6
19:44 chee joined #perl6
19:46 Hotkeys_ joined #perl6
19:47 integral joined #perl6
19:48 Juerd joined #perl6
19:49 tbrowder i did test the new examples, BTW
19:49 hackedNO1 joined #perl6
19:50 ssm_ joined #perl6
19:54 TEttinger joined #perl6
19:55 moritz I wonder if a default that doesn't pass the type constraint should be a compile-time error
19:56 moritz ah, but not all defaults can be compile-time evaluated
19:56 DrParis joined #perl6
19:56 arnsholt And constraints donæt have to be pure functions
19:56 arnsholt *don't
20:04 aries_liuxueyang joined #perl6
20:10 cdg joined #perl6
20:15 k-man joined #perl6
20:20 heatsink joined #perl6
20:25 Ven_ joined #perl6
20:32 mcmillhj joined #perl6
20:32 labster joined #perl6
20:33 mempko joined #perl6
20:33 woolfy joined #perl6
20:43 mcmillhj joined #perl6
20:46 Ven_ joined #perl6
20:55 Util joined #perl6
21:00 aries_liuxueyang joined #perl6
21:00 gfldex m: class A { has $.name = 'body' }; say A.new.&{ say .?name, 'body' ~~ .?name }
21:00 camelia rakudo-moar 58cf9d: OUTPUT«bodyFalse␤True␤»
21:00 gfldex ^^^ mean trap
21:01 mcmillhj joined #perl6
21:01 Ven_ joined #perl6
21:01 tbrowder joined #perl6
21:01 gfldex m: class A { has $.name = 'body' }; A.new.&{ say .?name, 'body' ~~ .?name }
21:01 camelia rakudo-moar 58cf9d: OUTPUT«bodyFalse␤»
21:02 M-Illandan joined #perl6
21:03 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␤␤»
21:03 masak there you go.
21:03 masak infix:<~~> topicalizes on "body" (the lhs) for you.
21:04 yubimusubi joined #perl6
21:04 gfldex i know that now. Took me only an hour to figure that one out :)
21:05 masak serves your right for writing such clever code :P
21:06 masak you*
21:06 * masak .oO( Donald Trump serves your right )
21:07 gfldex at least I didn't doc that myself
21:09 [Coke] m: sub a ($a where {say 4}) { say $a } ; a(3)
21:09 camelia rakudo-moar 58cf9d: OUTPUT«4␤3␤»
21:10 masak m: multi sub a ($a where {say 4}) { say $a } ; a(3)
21:10 camelia rakudo-moar 58cf9d: OUTPUT«4␤4␤3␤»
21:11 * masak .oO( one 4 for mommy... one 4 for daddy... )
21:11 gfldex is there a good reason why sub say returns True?
21:11 masak gfldex: hysterical raisins.
21:11 masak gfldex: in Perl 5, it returns whether the file handle was happy about being printed to.
21:11 masak "Returns true if successful." -- `perldoc -f print`
21:12 gfldex m: $*IN = Nil; say say('happy');
21:12 camelia rakudo-moar 58cf9d: OUTPUT«happy␤True␤»
21:12 gfldex m: $*OUT = Nil; say say('happy');
21:12 camelia rakudo-moar 58cf9d: OUTPUT«Too many positionals passed; expected 1 argument but got 2␤  in block <unit> at <tmp> line 1␤␤»
21:13 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␤␤»
21:13 gfldex at least it doesn't return True anymore :->
21:17 pierrot joined #perl6
21:19 itaipu joined #perl6
21:19 frankD2 joined #perl6
21:28 dalek doc: 41a7f6e | gfldex++ | doc/Language/traps.pod6:
21:28 dalek doc: doc trap of ~~ in conjunction with .method-name
21:28 dalek doc: review: https://github.com/perl6/doc/commit/41a7f6ec26
21:31 gfldex are there any other operators that set $_ besides ~~ ?
21:33 timotimo "andthen" and "orelse"
21:33 timotimo well, maybe only "andthen"
21:37 mcmillhj joined #perl6
21:38 heatsink left #perl6
21:38 dalek doc: d730103 | (Jan-Olof Hendig)++ | doc/Language/regexes.pod6:
21:38 dalek doc: Fixed broken code example and added a few missing ;
21:38 dalek doc: review: https://github.com/perl6/doc/commit/d73010389a
21:38 dalek doc: b70c423 | gfldex++ | doc/Language/traps.pod6:
21:38 dalek doc: add andthen to ~~ trap
21:38 dalek doc: review: https://github.com/perl6/doc/commit/b70c423772
21:53 cyphase joined #perl6
21:53 kurahaupo joined #perl6
21:54 cyphase joined #perl6
21:54 masak gfldex: the infix:<ff> family of operators topicalize nowadays.
21:56 AlexDaniel joined #perl6
21:56 cyphase joined #perl6
21:56 masak wow, the rustc errors are lovely. https://blog.rust-lang.org/2016/09/29/Rust-1.12.html
21:56 mcmillhj joined #perl6
21:56 masak (on topic because we like lovely error messages) :)
22:04 timotimo they have so many contributors
22:04 timotimo i'm a tiny bit jealous :)
22:05 eyck joined #perl6
22:11 cdg joined #perl6
22:14 cpage_ joined #perl6
22:14 mcmillhj joined #perl6
22:26 mcmillhj joined #perl6
22:30 SmokeMachine____ hi!
22:30 SmokeMachine____ why this is true:
22:31 SmokeMachine____ m: say {:a($0)} ~~ :(Int(Match) :$a) if "abc" ~~ /(.*)/
22:31 camelia rakudo-moar 58cf9d: OUTPUT«True␤»
22:31 SmokeMachine____ and this gives an error?
22:31 SmokeMachine____ m: sub f(Int(Match) :$a) {say $a}; say f(|$/) if "abc" ~~ /$<a>=.*/
22:31 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…»
22:32 SmokeMachine____ better:
22:32 SmokeMachine____ m: say $/ ~~ :(Int(Match) :$a) if "abc" ~~ /$<a>=.*/
22:32 camelia rakudo-moar 58cf9d: OUTPUT«True␤»
22:33 SmokeMachine____ m: say $/ ~~ :(Int(Match) :$a!) if "abc" ~~ /$<a>=.*/
22:33 camelia rakudo-moar 58cf9d: OUTPUT«True␤»
22:34 SmokeMachine____ m: say \(|$/) ~~ :(Int(Match) :$a) if "abc" ~~ /$<a>=.*/
22:34 camelia rakudo-moar 58cf9d: OUTPUT«True␤»
22:34 SmokeMachine____ I can't get why...
22:35 raiph joined #perl6
22:37 itaipu joined #perl6
22:38 mcmillhj joined #perl6
22:41 timotimo i suppose just matching the signature doesn't actually *try* to call the coercer?
22:41 timotimo and just says "yeah, that matches the type object"
22:42 tushar joined #perl6
22:47 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:52 ccakes joined #perl6
22:53 mcmillhj joined #perl6
22:55 SmokeMachine____ timotimo: don't you think that it would be more useful if it tried?
22:57 dalek doc: 3707053 | skids++ | doc/Language/traps.pod6:
22:57 dalek doc: Give topicalizing operators a header.
22:57 dalek doc: review: https://github.com/perl6/doc/commit/3707053c0d
22:59 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?
23:00 timotimo try looking into %*LANG or what it's called to get at the grammar
23:01 timotimo there's a module in the works by DrForr if i'm not mistaken that makes accessing the perl6 grammar easier
23:01 timotimo for perl6 programs themselves
23:02 SmokeMachine____ timotimo: thanks!
23:03 skids joined #perl6
23:05 cpage_ joined #perl6
23:07 mcmillhj joined #perl6
23:21 mcmillhj joined #perl6
23:22 baest joined #perl6
23:23 cpage_ joined #perl6
23:37 itaipu joined #perl6
23:37 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]]␤»
23:42 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:43 timotimo it's an anonymous state variable that gets incremented
23:44 tushar timotimo: thanks
23:48 itaipu joined #perl6
23:53 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]]␤»
23:55 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:56 woolfy joined #perl6
23:57 mcmillhj joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo