»ö« 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. |
|||
00:01
mcmillhj left
00:02
cyphase left
00:07
cyphase joined,
cyphase left
00:08
cyphase joined
00:13
pierre_ joined
00:14
perlawhirl joined
00:26
mcmillhj joined
00:29
dataangel joined
00:31
mcmillhj left
00:33
dj_goku left
00:45
mcmillhj joined
|
|||
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 | |
00:49
mcmillhj left
|
|||
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 rowat <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, ^ | ||
00:57
mcmillhj joined
|
|||
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 | |
00:57
rgrinberg joined
|
|||
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 | ||
01:02
mcmillhj left
|
|||
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 | ||
01:05
noganex left
01:07
noganex joined
|
|||
tushar | @a; | 01:09 | |
01:09
canopus left
01:12
mcmillhj joined
01:14
canopus joined
|
|||
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 | |||
01:17
mcmillhj left
|
|||
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 | ||
01:20
ponbiki left,
ponbiki joined
01:21
ponbiki is now known as Guest65191
|
|||
tushar | MasterDuke++ | 01:21 | |
01:21
zakharyas joined
|
|||
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 | |
01:27
mcmillhj joined
|
|||
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 declaredat <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)» | ||
01:28
Actualeyes joined
01:29
bstamour joined
|
|||
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 | ||
01:30
dj_goku joined
|
|||
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 | |
01:32
mcmillhj left,
rgrinberg left
|
|||
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 | ||
01:36
dj_goku left,
cyphase left
|
|||
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 | ||
01:39
mcmillhj joined
01:41
cyphase joined
|
|||
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 | :( | ||
01:43
mcmillhj left
01:44
cyphase left,
cyphase joined,
cyphase left
01:45
cyphase joined,
cyphase left
|
|||
[Coke] | broken here too. i'll ping the rt admins | 01:45 | |
01:46
ilbot3 left,
cyphase joined
01:47
cyphase left,
cyphase joined,
ilbot3 joined
|
|||
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 parameterat <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? | ||
01:58
cyphase left
02:00
dwarring joined
|
|||
AlexDaniel | MasterDuke: it is less than awesome | 02:01 | |
fwiw: github.com/rakudo/rakudo/blob/5f91....nqp#L6034 | |||
02:02
mcmillhj joined
02:03
cyphase joined,
ufobat left
|
|||
MasterDuke | thanks, hadn't found it yet | 02:03 | |
02:04
cyphase left,
cyphase joined,
cyphase left,
tushar left
02:05
cyphase joined,
cyphase left
02:06
cyphase joined,
noganex_ joined
02:09
noganex left,
ccakes left
02:12
ccakes joined,
mcmillhj left
|
|||
dalek | c: c776b84 | MasterDuke17++ | doc/Type/Signature.pod6: Fix typos and grammaros in Signature |
02:16 | |
02:19
mcmillhj joined
|
|||
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:25
mcmillhj left
02:30
mcmillhj joined
02:31
cyphase left,
dj_goku joined,
dj_goku left,
dj_goku joined,
rgrinberg joined
02:35
mcmillhj left
02:36
cyphase joined,
dj_goku left
02:39
cyphase left,
cyphase joined
02:40
cyphase left,
cyphase joined,
cyphase left,
cyphase joined
02:42
cyphase left
02:43
cyphase joined,
cyphase left
02:44
eliasr left,
cyphase joined
02:46
mcmillhj joined
02:48
wamba joined
02:50
mcmillhj left
02:56
mcmillhj joined
|
|||
[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 | ||
03:01
mcmillhj left
03:03
mohae joined
03:07
perlawhi1l joined,
Actualeyes left
03:08
kaare_ joined
03:14
labster joined
03:15
mcmillhj joined
|
|||
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 | |||
03:19
mcmillhj left
|
|||
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 | ||
03:22
khw left
03:24
dj_goku joined,
dj_goku left,
dj_goku joined
03:26
mcmillhj joined,
cyphase left
03:31
mcmillhj left,
cyphase joined
|
|||
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 | ||
03:38
mcmillhj joined,
pierre_ left
03:40
nadim left
03:41
pierre_ joined
03:43
mcmillhj left,
giraffe_ left
03:45
giraffe joined,
skids left,
giraffe is now known as Guest84199
03:46
cyphase left,
wamba left,
saki left,
saki joined
03:47
canopus left,
perlawhirl left,
spider-mario left,
salva left
03:48
M-Illandan left
03:49
canopus joined,
ab5tract left,
ab5tract joined
03:50
mtj_ joined
03:52
wamba joined,
cyphase joined
03:53
mcmillhj joined
03:56
labster left,
labster joined
03:57
ruoso joined
03:58
mcmillhj left
03:59
ufobat joined,
wamba left,
salva joined
04:00
spider-mario joined
04:04
tony-o joined
04:10
BenGoldberg left
04:12
mcmillhj joined,
pierre_ left
04:14
cyphase left,
aries_liuxueyang left
04:16
aries_liuxueyang joined,
mcmillhj left
04:19
cyphase joined
04:21
pierre_ joined
04:26
AlexDaniel left,
pierre_ left,
mcmillhj joined
04:31
mcmillhj left
04:36
Actualeyes joined
04:49
djbkd joined
04:58
mcmillhj joined
04:59
Cabanossi left
05:01
rgrinberg left
05:02
mcmillhj left
05:03
pierre_ joined,
Cabanossi joined
05:04
pierre_ left
05:06
holyghost left,
pierre_ joined
05:08
wamba joined
05:13
mcmillhj joined,
domidumont joined
05:14
dwarring left
05:18
domidumont left,
zengargoyle left,
domidumont joined
05:19
mcmillhj left
05:22
zengargoyle joined,
domidumont left
05:28
cyphase left
05:31
M-Illandan joined
05:33
cyphase joined
05:42
wamba left
05:47
mcmillhj joined
05:51
cyphase left
05:52
mcmillhj left
05:56
cyphase joined,
holyghost joined
05:57
domidumont joined
06:00
holyghost left
06:06
pierre_ left,
canopus left
06:12
pierre_ joined
06:13
canopus joined,
mcmillhj joined
06:17
pierre_ left
06:18
mcmillhj left,
labster left
06:21
pierre_ joined
06:24
andrzejku joined
06:25
darutoko joined
06:28
darutoko- joined
06:31
darutoko left
06:34
mcmillhj joined
06:35
wamba joined
|
|||
andrzejku | hello my friends x) | 06:38 | |
06:39
mcmillhj left
|
|||
perlawhi1l | hello | 06:48 | |
06:48
perlawhi1l is now known as perlawhirl
|
|||
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 | ||
06:56
zengargoyle left
06:58
RabidGravy joined
06:59
zengargoyle joined
07:04
wamba left
07:10
djbkd left
|
|||
moritz | \o | 07:10 | |
ufobat | morning perl6 :) | 07:11 | |
andrzejku | hello :) | 07:12 | |
07:12
wamba joined
07:13
ccakes left
07:14
mcmillhj joined
07:15
djbkd joined
07:19
mcmillhj left,
perlawhirl left
07:29
mcmillhj joined
|
|||
RabidGravy | boom! | 07:29 | |
07:32
jsimonet2 left
07:34
mcmillhj left,
jsimonet joined,
ccakes joined
07:39
ccakes left
|
|||
andrzejku | last days I tried to play with avr chips | 07:39 | |
and all failed :( | |||
07:41
darutoko joined
07:44
darutoko- left
07:48
djbkd left
07:49
djbkd joined
08:01
_slade_ left
08:03
mcmillhj joined,
jonas1 joined
08:08
mcmillhj left
08:12
Actualeyes left
08:14
labster joined,
mcmillhj joined
|
|||
masak | good antenoon, #perl6 | 08:15 | |
08:16
andrzejku left
08:19
mcmillhj left
|
|||
moritz | \o masak | 08:27 | |
08:31
mcmillhj joined
|
|||
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" | |||
08:36
mcmillhj left
08:40
dakkar joined
|
|||
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 :) | ||
08:46
mcmillhj joined
08:48
wamba left
08:51
mcmillhj left
08:52
rindolf joined
08:54
wamba joined
08:55
andrzejku joined
|
|||
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 | ||
09:03
mcmillhj joined
09:08
mcmillhj left
|
|||
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 | |
09:23
eliasr joined
09:30
zakharyas left
|
|||
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 | |
09:36
mcmillhj joined,
nadim joined
|
|||
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 | |
09:41
mcmillhj left
09:45
kurahaupo joined
09:47
kurahaupo_ joined
09:50
mcmillhj joined,
kurahaupo left
09:52
kurahaupo_ is now known as kurahaupo
09:55
mcmillhj left
|
|||
dalek | c: e5ddbfe | gfldex++ | doc/Language/functions.pod6: fix typo |
09:56 | |
10:06
kurahaupo left
10:18
gregf_ left
10:22
labster left,
labster joined,
pierre_ left
10:25
TEttinger left
10:27
pierre_ joined
10:30
ocbtec joined
10:33
mcmillhj joined
10:38
mcmillhj left
10:44
pierre_ left
10:47
wamba left
10:49
mcmillhj joined
10:54
mcmillhj left
11:16
mcmillhj joined
11:20
labster left
11:21
mcmillhj left
11:34
andrzejku left
11:36
mcmillhj joined
|
|||
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 | ||
11:41
mcmillhj left
11:42
andrzejku joined
|
|||
Ulti | full output gist.github.com/MattOates/45e87e3a...f396a56c01 | 11:44 | |
11:45
pierre_ joined
|
|||
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 | ||
11:49
Dunearhp left
12:06
andrzejku left
12:07
andrzejku joined
|
|||
moritz | does that make it OS Y? :-) | 12:10 | |
12:15
bjz_ joined
|
|||
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 :) | |||
12:19
bjz__ joined
12:20
bjz_ left
12:21
ocbtec left
12:23
jcallen joined
12:26
andrzejku left
12:28
bjz__ left
12:31
Celelibi left
12:32
aries_liuxueyang left,
user9 left
12:33
aries_liuxueyang joined
12:34
Celelibi joined
12:40
sftp joined,
rgrinberg joined
12:42
RabidGravy left
12:43
bjz joined
|
|||
[Coke] | I am on xcode 8.0 (8A218a) and have noticed no issues. | 12:43 | |
12:46
bdmatatu joined,
andrzejku joined
|
|||
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 | |
12:53
wamba joined,
RabidGravy joined
12:54
djbkd_ joined
12:55
djbkd left
|
|||
gfldex | m: use nqp; say nqp::sha1("abc"); | 12:56 | |
camelia | rakudo-moar 5a3df8: OUTPUT«A9993E364706816ABA3E25717850C26C9CD0D89D» | ||
gfldex | bdmatatu: ^^^ possible but may be unwise | ||
12:57
sftp left
|
|||
andrzejku | hey guys | 12:58 | |
why no-one tried to write llvm perl6 interpreter? | |||
12:58
buggable joined
|
|||
perlpilot | andrzejku: I think it's because llvm is more of a VM toolkit than a VM | 12:59 | |
12:59
NeuralAnomaly joined
|
|||
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. | ||
13:04
djbkd_ left
13:05
bjz left,
djbkd joined
13:06
bjz joined,
mcmillhj joined
13:07
itaipu joined
13:08
sftp joined
|
|||
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 | |
13:13
andrzejku left
|
|||
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 | |
13:14
djbkd left
|
|||
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 | |
13:15
djbkd joined,
andrzejku joined
13:16
El_Che joined,
ptolemarch joined
13:18
cdg joined
13:21
gregf_ joined
|
|||
[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 | |
13:26
djbkd_ joined
13:27
djbkd left
13:34
djbkd_ left
13:36
djbkd joined
|
|||
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 | |
13:46
djbkd_ joined
|
|||
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 | |
13:48
djbkd left
|
|||
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 | ||
13:50
skids joined
|
|||
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 | ||
13:52
pierre_ left
|
|||
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 | ||
13:53
andrzejku left
13:55
andrzejku joined,
acrussell joined
13:56
djbkd_ left
13:57
bjz left,
bjz_ joined,
djbkd joined
|
|||
andrzejku | timotimo, sorry [kid] will be soon back | 13:58 | |
timotimo | i might be AFK when you return | ||
andrzejku | ok | ||
14:00
rindolf left
14:06
djbkd left
|
|||
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 | ||
14:08
andrzejku left
|
|||
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 | |
14:09
djbkd joined
|
|||
hackedNODE plugs perl6.party/post/Perl-6-is-written-in...-Perl-6 | 14:09 | ||
14:10
rindolf joined
|
|||
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 | |
14:13
andrzejku joined,
itcharlie1 joined
14:14
khw joined
|
|||
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 | |
14:20
grondilu joined
|
|||
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 | |
14:21
djbkd left
|
|||
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 :) | |||
14:23
djbkd joined
|
|||
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 parameterat <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 parameterat <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 | |
14:29
pmurias joined
|
|||
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. | |||
14:30
djbkd left
|
|||
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 | ||
14:31
djbkd joined,
wamba left
|
|||
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 | ||
14:40
djbkd left
|
|||
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 | |
14:42
djbkd joined
|
|||
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 | |
14:43
Actualeyes joined
|
|||
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 parameterat <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 ? | ||
14:53
djbkd_ joined
|
|||
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: | ||
14:55
djbkd left
|
|||
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 | ||
14:58
andrzejku left
|
|||
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 | ||
15:00
sufrostico left
|
|||
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 | |||
15:04
jonas1 left,
djbkd_ left
15:05
djbkd joined
15:07
sufrostico joined
15:12
smls joined
|
|||
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 | |
15:14
djbkd left
|
|||
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|51333104Array|51333168Array $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? | ||
15:16
djbkd joined
|
|||
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)}» | ||
15:27
djbkd_ joined
15:28
djbkd left
15:29
girafe joined,
itcharlie1 left
|
|||
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 | |
15:38
djbkd_ left
|
|||
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. | |||
15:39
djbkd joined
|
|||
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 | ||
15:46
domidumont left,
mempko joined
15:47
djbkd left
|
|||
timotimo | and just running force_gc a few times in a row won't give you a major collection either | 15:48 | |
15:48
pdcawley_ left
|
|||
timotimo | allocating things that are big that get put into the second generation will cause major collections to occur | 15:48 | |
15:49
djbkd joined
15:56
lostinfog joined,
pdcawley joined
15:59
djbkd left
16:02
djbkd joined
16:03
mcmillhj left
16:07
woolfy left,
woolfy joined
16:08
domidumont joined
16:10
itaipu left
16:11
itaipu joined
|
|||
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 | ||
16:14
djbkd left
|
|||
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. :) | ||
16:18
djbkd joined
16:21
itaipu left
|
|||
hackedNODE | RT busted? I'm getting a blank page when I try to create a ticket :/ | 16:24 | |
16:24
ufobat left
|
|||
hackedNODE | oh well, no ticket then | 16:25 | |
16:25
V-ille joined
16:26
V-ille left,
V-ille joined
|
|||
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 | ||
16:32
djbkd left
|
|||
timotimo | in my experience it's usually very close to the "minutes" end | 16:32 | |
16:33
djbkd joined
|
|||
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 | ||
16:40
dakkar left
16:41
V-ille left
16:43
djbkd left
16:57
captain-adequate joined
16:59
mcmillhj joined
|
|||
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 | |||
17:02
Alikzus left
|
|||
Juerd | I once almost got a job by answering "dwim();" | 17:03 | |
17:03
Alikzus joined
|
|||
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
japhb left
|
|||
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. | ||
17:09
Alikzus left
17:10
Alikzus joined
17:15
_slade_ joined
17:16
cpage_ joined
17:18
chris2 joined
|
|||
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 | |
17:26
Alikzus left,
Alikzus joined
17:32
wamba joined
17:34
andrzejku joined
|
|||
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 rowat <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 rowat <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)» | ||
17:44
FROGGS joined
|
|||
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 | ||
17:55
Alikzus left
|
|||
masak | harmil_wk: sure, why not -- though I'm not sure the verdict will be "we can haz nice error" on that :/ | 17:55 | |
17:55
Alikzus joined
|
|||
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 | |
18:00
AndyBotwin joined,
AndyBotwin left,
AndyBotwin joined
|
|||
jnthn | So I've no idea what's happening with the "42" | 18:00 | |
18:00
cognominal left
|
|||
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 | ||
18:11
canopus left
|
|||
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 | |
18:13
Alikzus left
18:14
Alikzus joined
18:17
canopus joined
|
|||
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 | |
18:29
_slade_ left
|
|||
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 :) | ||
18:37
perlpilot_ joined
|
|||
masak | I think some of them already look somewhat scandalized | 18:39 | |
hackedNODE | Oh, maybe I should change it then :) | ||
18:39
wamba left
|
|||
hackedNODE | They're supposed to be amazed at Perl 6's awesomeness :D | 18:40 | |
18:40
itaipu joined
|
|||
masak | "They used WHAT syntax!?" | 18:40 | |
18:43
cdg left
18:44
dogbert17 joined,
grondilu left
|
|||
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 | ||
18:47
grondilu joined
|
|||
grondilu | what's the P5 equivalent to infix:<xx>? | 18:47 | |
18:47
cpage_ left
|
|||
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 :) | ||
18:50
Alikzus left
|
|||
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 | |
18:50
Alikzus joined
|
|||
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 | |
18:53
Actualeyes left
|
|||
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 | |
18:56
sufrostico left
|
|||
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 | ||
19:03
perlpilot_ left
|
|||
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 | ||
19:08
bdmatatu left,
darutoko left
|
|||
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 | |
19:10
Ven_ joined
|
|||
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... | ||
19:11
cpage_ joined
19:15
perlpilot joined
19:19
bstamour left
19:24
FROGGS left
|
|||
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
|
|||
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 | ||
19:31
AndyBotwin left
|
|||
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» | ||
19:33
labster joined
19:34
labster left
|
|||
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 | |
19:34
labster joined
19:35
TEttinger joined,
notostraca joined
19:36
domidumont left
19:37
BillSussman left
|
|||
dalek | c: 05c700e | (Tom Browder)++ | doc/Type/Signature.pod6: better example per [email@hidden.address] |
19:38 | |
19:38
[particle]1 joined
19:40
labster left
19:42
nemo_ joined,
labster joined
19:43
ilbelkyr left,
Juerd left,
notostraca left,
TEttinger left,
ilbelkyr_ joined
19:44
avalenn joined,
chee joined
19:46
Hotkeys_ joined,
M-Illandan left
19:47
Hotkeys left,
Hotkeys_ is now known as Hotkeys,
integral joined
19:48
Juerd joined,
khw left
|
|||
tbrowder | i did test the new examples, BTW | 19:49 | |
19:49
hackedNO1 joined
19:50
ssm_ joined
19:54
kaare_ left,
DrParis left,
TEttinger joined
|
|||
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 | ||
19:56
DrParis joined
|
|||
arnsholt | And constraints donæt have to be pure functions | 19:56 | |
*don't | |||
20:03
aries_liuxueyang left
20:04
aries_liuxueyang joined
20:10
cdg joined
20:12
Ven_ left
20:15
k-man joined
20:20
heatsink joined
20:22
labster left
20:23
mcmillhj left
20:25
Ven_ joined
20:29
mempko left
20:30
cdg left
20:32
mcmillhj joined,
woolfy left,
labster joined
20:33
mempko joined,
woolfy joined
20:34
itaipu left
20:36
smls left,
mcmillhj left
20:43
mcmillhj joined,
Ven_ left
20:46
Ven_ joined
20:47
mcmillhj left
20:55
Util_ left,
Util joined
20:56
aries_liuxueyang left
20:58
Ven_ left
21:00
aries_liuxueyang joined
|
|||
gfldex | m: class A { has $.name = 'body' }; say A.new.&{ say .?name, 'body' ~~ .?name } | 21:00 | |
camelia | rakudo-moar 58cf9d: OUTPUT«bodyFalseTrue» | ||
gfldex | ^^^ mean trap | ||
21:00
tbrowder left
21:01
mcmillhj joined,
Ven_ joined,
tbrowder joined
|
|||
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
|
|||
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«bodyTrueNo 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. | |||
21:04
yubimusubi joined
|
|||
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«43» | ||
21:09
skids left
|
|||
masak | m: multi sub a ($a where {say 4}) { say $a } ; a(3) | 21:10 | |
camelia | rakudo-moar 58cf9d: OUTPUT«443» | ||
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«happyTrue» | ||
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 :-> | ||
21:14
mcmillhj left
21:17
pierrot joined
21:19
itaipu joined,
frankD2 joined
|
|||
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" | |||
21:37
mcmillhj joined
21:38
heatsink left
|
|||
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 |
|||
21:40
andrzejku left
21:41
mcmillhj left
21:49
cyphase left
21:51
rindolf left
21:53
cyphase joined,
kurahaupo joined,
cyphase left
21:54
cyphase joined
|
|||
masak | gfldex: the infix:<ff> family of operators topicalize nowadays. | 21:54 | |
21:55
cyphase left
21:56
AlexDaniel joined,
cyphase joined
|
|||
masak | wow, the rustc errors are lovely. blog.rust-lang.org/2016/09/29/Rust-1.12.html | 21:56 | |
21:56
mcmillhj joined
|
|||
masak | (on topic because we like lovely error messages) :) | 21:56 | |
22:01
mcmillhj left
22:03
acrussell left
|
|||
timotimo | they have so many contributors | 22:04 | |
i'm a tiny bit jealous :) | |||
22:04
cpage_ left
22:05
eyck left,
eyck joined
22:08
ptolemarch left
22:11
cdg joined
22:14
cpage_ joined,
mcmillhj joined,
pmurias left
22:19
mcmillhj left
22:26
mcmillhj joined,
frankD2 left
|
|||
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» | ||
22:31
mcmillhj left
|
|||
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 1Actually 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» | ||
22:32
RabidGravy left
|
|||
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... | ||
22:35
raiph joined
22:36
itaipu left
22:37
itaipu joined
22:38
mcmillhj joined
|
|||
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" | |||
22:42
tushar joined,
lostinfog left
22:43
mcmillhj left
|
|||
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 | |
22:52
itaipu left,
girafe left,
ccakes joined
22:53
mcmillhj joined
|
|||
SmokeMachine____ | timotimo: don't you think that it would be more useful if it tried? | 22:55 | |
22:56
cpage_ left
|
|||
dalek | c: 3707053 | skids++ | doc/Language/traps.pod6: Give topicalizing operators a header. |
22:57 | |
22:58
mcmillhj left
|
|||
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 | |
23:03
skids joined
23:05
cpage_ joined
23:07
mcmillhj joined
23:12
mcmillhj left
23:15
ilbelkyr_ is now known as ilbelkyr
23:18
baest left,
cpage_ left
23:21
mcmillhj joined
23:22
baest joined
23:23
cpage_ joined
23:26
mcmillhj left
23:37
itaipu joined
|
|||
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:38
nemo_ is now known as nemo
|
|||
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 | |
23:47
itaipu left
23:48
itaipu joined
|
|||
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 | |
23:56
woolfy left,
woolfy joined
23:57
mcmillhj joined
|