»ö« 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:00
dustinm` left,
Cabanossi joined
00:04
dustinm` joined
|
|||
skids | o/ | 00:06 | |
00:07
Actualeyes joined
|
|||
curt_ | AlexDaniel: github.com/grondilu/libdigest-perl6/issues/18 | 00:07 | |
AlexDaniel | oh | 00:08 | |
00:08
cyphase left
|
|||
AlexDaniel | did notice | 00:08 | |
didn't* | |||
skids wonders if any bigint libs have extensive 2s compliment guts. | 00:13 | ||
00:15
khw left
|
|||
skids | Someone was working on better uint handling in MoarVM, wasn't there? I have to hack around negative uints quite often. | 00:16 | |
AlexDaniel | u: chess | 00:17 | |
unicodable6 | AlexDaniel, U+2654 WHITE CHESS KING [So] (♔) | ||
AlexDaniel, U+2655 WHITE CHESS QUEEN [So] (♕) | |||
AlexDaniel, 12 characters in total: gist.github.com/62ae66d4189ee14ba2...e5828f3989 | |||
skids | Is the other color RED or BLACK? | 00:18 | |
u: KNIGHT | 00:19 | ||
unicodable6 | skids, U+265E BLACK CHESS KNIGHT [So] (♞) | ||
skids, U+2658 WHITE CHESS KNIGHT [So] (♘) | |||
skids, 6 characters in total: gist.github.com/7464e87366755316ac...5683890ad6 | |||
skids | Heh. The white one looks much blacker to me :-) | ||
TimToady | which one looks darker depends on how many times I type Alt-I | 00:24 | |
lookatme | morning ~~ | 00:28 | |
BenGoldberg whines, I don't have Alt-I -- I have to rely on a browser bookmarklet to invert things. | 00:33 | ||
Speaking of unicode chess pieces, see: 1kchess.an3.es/play-level-2k | 00:36 | ||
00:44
araujo joined
00:45
araujo left,
araujo joined
00:48
itaipu left
00:54
AlexDaniel left
01:00
mcmillhj_ left,
mcmillhj left
01:04
beginner left
01:06
Chillance left
01:12
mcmillhj joined,
mcmillhj_ joined
01:16
aborazmeh joined,
aborazmeh left,
aborazmeh joined,
mcmillhj_ left
01:17
mcmillhj left
01:18
skids left
01:20
skids joined
01:22
curt_ left
01:24
mcmillhj_ joined,
mcmillhj joined
01:29
skids left
01:32
itaipu joined
01:33
skids joined,
dj_goku joined
01:38
dj_goku left
01:39
skids left
01:42
labster left
01:45
ilbot3 left
01:46
kurahaupo left
01:48
kurahaupo joined,
ilbot3 joined,
ChanServ sets mode: +v ilbot3
01:49
kurahaupo left,
kurahaupo joined,
skids joined
01:51
kurahaupo left
01:52
kurahaupo joined
|
|||
awwaiid | 7+ talks on Perl6 at TPC-2017-DC! www.perlconference.us/tpc-2017-dc/talks/ . Hope to see LOTS of you there! | 01:53 | |
01:54
skids left
|
|||
awwaiid | We should get some rakudo hack time going. I really enjoyed meeting up with hoelzro at Strange Loop last year to do some slight REPL hacking :) | 01:55 | |
01:58
MasterDuke_ is now known as MasterDuke,
itaipu left
|
|||
MasterDuke | i hope to make it to TPC-DC | 02:02 | |
japhb | *sigh* I'll be in DC for the first time in *decades* that very week -- on vacation with my family. Had no idea there was going to be a TPC there. | 02:03 | |
MasterDuke | .tell skids i have been playing around with making MoarVM's uint support a little better, but it's not really my strong suit. feel free to jump in and help out! | 02:04 | |
yoleaux | MasterDuke: I'll pass your message to skids. | ||
02:08
colomon left,
noganex joined
02:11
noganex_ left
02:18
skids joined
02:24
mcmillhj_ left,
mcmillhj left
02:31
ribasushi left
02:36
ribasushi joined
02:37
njmurphy joined
02:43
colomon joined
02:50
cyphase joined
02:55
colomon left
02:58
Cabanossi left
02:59
njmurphy left
03:01
Cabanossi joined
03:03
KDr2_c joined
03:06
colomon joined
03:09
cgfbee left
03:13
zapwai left
03:15
dj_goku joined,
dj_goku left,
dj_goku joined
03:22
mcmillhj joined,
mcmillhj_ joined
03:25
cyphase left
03:27
mcmillhj_ left,
mcmillhj left
03:28
Cabanossi left
03:29
Cabanossi joined
03:30
cyphase joined
03:32
cgfbee joined
03:35
mcmillhj joined
03:36
mcmillhj_ joined
03:37
aborazmeh left
03:55
khw joined
03:57
Cabanossi left
03:59
Cabanossi joined
04:00
BenGoldberg left
04:09
mcmillhj left,
mcmillhj_ left
04:43
Cabanossi left
04:44
Cabanossi joined
|
|||
grondilu | m: say grammar { rule TOP { ^ <ident> | <ident>\[<ident>\] $ }.parse: "foo[bar]" | 04:56 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3<ident>\[<ident>\] $ }.parse: "foo[bar]"7⏏5<EOL> expecting any of: statement end statement modifier statement modifier loop |
||
yoleaux | 17 May 2017 23:28Z <AlexDaniel> grondilu: Some sha tests are failing when installing Digest, perhaps worth taking a look | ||
grondilu | m: say grammar { rule TOP { ^ <ident> | <ident>\[<ident>\] $ } }.parse: "foo[bar]" | 04:57 | |
camelia | 「foo[bar]」 ident => 「foo」 ident => 「bar」 |
||
grondilu | m: say ?grammar { rule TOP { ^ <ident> | <ident>\[<ident>\] $ } }.parse: "foo[bar]" | ||
camelia | True | ||
grondilu | m: say grammar { rule TOP { ^ <a=ident> | <b=ident>\[<ident>\] $ } }.parse: "foo[bar]" | ||
camelia | Nil | ||
grondilu | how comes naming captures makes the parse fail?? | ||
m: say "foo[bar]" ~~ / <a=ident> | <b=ident>\[<ident>\] / | 04:59 | ||
camelia | 「foo」 ident => 「foo」 a => 「foo」 |
||
grondilu | :/ | ||
05:06
curan joined
05:08
alphah joined
05:12
lowbro joined,
lowbro left,
lowbro joined
05:18
khw left
|
|||
Geth | doc: antquinonez++ created pull request #1313: remove duplicate word |
05:21 | |
05:28
Cabanossi left
05:29
Cabanossi joined
05:31
alphah left
05:34
xtreak joined
|
|||
Geth | doc: 75102c5f16 | (Antonio Quinonez)++ (committed by Moritz Lenz) | doc/Language/grammars.pod6 remove duplicate word |
05:46 | |
05:49
domidumont joined
05:51
ufobat joined
05:53
lookatme left
05:54
lookatme joined,
domidumont left
05:55
domidumont joined,
CIAvash joined
05:58
nadim joined,
domidumont1 joined
06:02
nadim left,
domidumont left
06:07
KDr2_c is now known as KDr2
06:12
wamba joined
06:18
mcmillhj joined
06:20
rindolf joined
06:23
mcmillhj left
06:25
trnh left
06:33
noub joined
|
|||
noub | hi, somebody speak russian? | 06:34 | |
can somebody help with \n and \r\n in grammars? i have file with \r\n lines containing \n | 06:39 | ||
06:40
domidumont1 left
|
|||
noub | how say: 'can take \n, but not \r\n' in token? | 06:41 | |
not sequence \r\n? | |||
moritz | m: say "\na\r\n".perl | 06:42 | |
camelia | "\na\r\n" | ||
lookatme | noub, | ||
read file in binary mode | |||
moritz thought rn became one grapheme | |||
m: say "\r\n".chars | |||
camelia | 1 | ||
lookatme | or \r\n will convert to \n automate | ||
moritz | hm, seems like it does | ||
m: say so "\r\n" ~~ /^\n$/ | 06:43 | ||
camelia | True | ||
06:43
xtreak left
|
|||
moritz | m: say so "\r\n" ~~ /^\c[LINE FEED]$/ | 06:43 | |
camelia | False | ||
moritz | m: say so "\n" ~~ /^\c[LINE FEED]$/ | ||
camelia | True | ||
06:43
xtreak joined
|
|||
moritz | noub: match \c[LINE FEED] for the single \n | 06:43 | |
noub | i think this is not really problem if it will convert to \n if i can take to token string between "Descr=" and \' \' or \" \" or without and to comma | 06:45 | |
something like { "Descr=" (<quotation-multiline-text-with-commas> | <multiline-text-without-commas> ) } | 06:46 | ||
if text between \"\", than could contain '""' | 06:47 | ||
i need comething like in CSV-example, but more complex | 06:48 | ||
moritz | you can model that as / \" ~ \" [ <-["]>+ | '""' ]* / | ||
noub | moritz: thx, i'll try this | 06:49 | |
06:50
xtreak_ joined,
darutoko joined,
mcmillhj joined,
xtreak left
06:53
xtreak_ left
06:54
xtreak joined
06:55
mcmillhj left
06:56
jsimonet joined
06:59
lowbro left
07:00
xtreak left,
xtreak_ joined
|
|||
nine | Now that's a nice view from a conference location: niner.name/pictures/2017-05-18%20-%...t/Wien.jpg | 07:07 | |
07:08
domidumont joined
07:09
xtreak joined,
xtreak_ left
|
|||
lookatme | nine, where is this ? | 07:12 | |
07:12
Cabanossi left
07:14
Cabanossi joined
|
|||
nine | lookatme: Security Summit 2017 in Vienna at www.thirty-five.at/ | 07:15 | |
lookatme | oh, thanks | 07:16 | |
07:20
wamba left
|
|||
Voldenet | How to say "parse as int or use 0" in perl6? | 07:21 | |
m: sub ($n) { try { CATCH { return 0 }; return $n.Int*2 } }("a").say | |||
camelia | 0 | ||
moritz | m: sub maybe-int(Str $x) { $x.Int // 0 }; say ('abc', 42).map: &maybe-int | ||
camelia | Type check failed in binding to parameter '$x'; expected Str but got Int (42) in sub maybe-int at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
Voldenet | m: sub ($n) { try { CATCH { return 0 }; return $n.Int*2 } }(2).say | ||
camelia | 4 | ||
moritz | m: sub maybe-int(Str $x) { $x.Int // 0 }; say ('abc', '42').map: &maybe-int | 07:22 | |
camelia | (0 42) | ||
moritz | you don't need try/CATCH because .Int returns a Failure | ||
Voldenet | ah, a failure is not like an exception | ||
say ('abc', '42').map: { .Int // 0 } | |||
evalable6 | (0 42) | ||
Voldenet | i forgot m:... but it still worked :D | 07:23 | |
moritz | magical realism! | ||
lookatme | How about .?Int // 0 | 07:26 | |
m: sub f($x) { $x.?Int // 0; }; f(class F {}.new()); | |||
camelia | ( no output ) | ||
lookatme | m: sub f($x) { $x.?Int // 0; }; say f(class F {}.new()); | ||
camelia | 0 | ||
moritz | m: sub f($x) { $x.Int // 0; }; say f(class F {}.new()); | 07:27 | |
camelia | No such method 'Int' for invocant of type 'F' in sub f at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
moritz | it really depends on what you / Voldenet want :-) | ||
lookatme | em. | ||
07:29
skids left
|
|||
moritz | the "parse as" seemed to imply to me that the basis was a Str. I might be wrong, of course | 07:29 | |
Voldenet | yeah, it's string | ||
actually they're all Cool | |||
because it's a shell script | |||
lookatme | If it's all string, .Int would be work fine | 07:30 | |
07:31
noub left
07:35
xinming_ joined
07:38
xinming left,
xtreak left,
xtreak_ joined
07:40
zacts left
07:44
rindolf left
07:46
zakharyas joined
|
|||
Voldenet | How do I say "if all elements in a Seq are equal" | 07:47 | |
m: my @f = [1, 1, 2, 1]; say(@f.grep({ @f[0] !~~ $_ }).elems == 0) | |||
camelia | False | ||
Voldenet | m: my @f = [1, 1, 1, 1]; say(@f.grep({ @f[0] !~~ $_ }).elems == 0) | ||
camelia | True | ||
Voldenet | kind of works, but the syntax... erm | ||
not to mention that smart match will invoke the Callable | 07:51 | ||
and I certainly don't want that | |||
07:51
ab6tract joined
|
|||
ab6tract | Voldenet: you could use a bag | 07:51 | |
Voldenet | m: my &fn = { $^a; }; my &fn2 = { $^b; }; my @f = [&fn, &fn2, &fn, &fn]; say(@f.grep({ @f[0] !~~ $_ }).elems == 0) | ||
camelia | True | ||
ab6tract | m: my @f = [ 1 xx 5]; say so @f.Bag.keys == 1 | 07:52 | |
camelia | True | ||
ab6tract | m: my @f = [ 1 xx 5, 2]; say so @f.Bag.keys == 1 | ||
camelia | False | ||
Voldenet | Most certainly | ||
ab6tract | not sure how applicable it is for Seqs, though.. | 07:53 | |
07:53
zacts joined
|
|||
ab6tract | m: my @f = [&fn, &fn2, &fn, &fn]; say so @f.Bag.keys == 1 | 07:56 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routines: fn used at line 1. Did you mean 'fc'? fn2 used at line 1 |
||
ab6tract | m: my &fn = { $^a; }; my &fn2 = { $^b; }; my @f = [&fn, &fn2, &fn, &fn]; say so @f.Bag.keys == 1 | ||
camelia | False | ||
ab6tract | Voldenet: hope it helps | ||
m: my &fn = { $^a; }; my &fn2 = { $^b; }; my @f = [&fn, &fn, &fn]; say so @f.Set.keys == 1 | 07:58 | ||
camelia | True | ||
ab6tract | set of course works too | ||
08:02
rindolf joined
08:04
jonas2 joined
08:08
parv joined
08:12
Cabanossi left
|
|||
Voldenet | I tried to make some piece of code that'd figure out how to transform one list into another and made this horrible piece of code: | 08:13 | |
ix.io/u6J | |||
08:14
dakkar joined
|
|||
Voldenet | > echo -e "a A\nb B\nc C\nd\ne" | perl6 transform.p6 | 08:14 | |
08:14
Cabanossi joined
|
|||
Voldenet | it's just for practice, got any suggestions or syntaxes i should've used? | 08:14 | |
masak | Voldenet: it's a matter of taste, but I tend to do smaller things and more pure transformations inside of a .map | 08:20 | |
Voldenet: so I'd be tempted to have that entire loop as a `for lines() { ...; push @fns, $ret }` instead | 08:21 | ||
or, I guess, if you wanted to be fancy, `gather for lines() { ...; take $ret }` | |||
but I realize I hardly ever use `gather` anymore | |||
I should blog about that :) | |||
Voldenet | I tend to use a lot of .map because it can be optimized later ;) | 08:22 | |
map here can even work in parallel most of the time, which would help if I turned a transformation functions into service calls | |||
lookatme | gather take would be faster than map | 08:25 | |
Voldenet | Oh, really? :O | ||
lookatme | And `{}()` is clear enough, no need enclosed with `()` | 08:27 | |
I mean line 19 - 23 | |||
Voldenet | Oh, right. | ||
hm, can gather take be parallelised later? | |||
masak | I think both `for` and `map` could have a `hyper` or `race` added in front... | 08:28 | |
might be wrong, though | |||
Voldenet | yeah, lines().hyper and @t.race would work | 08:30 | |
08:31
lowbro joined,
lowbro left,
lowbro joined
|
|||
Voldenet | (because in the first case I'd need the order preserved) | 08:31 | |
lookatme | masak, Is `gather take` automate paralleled ? | ||
Voldenet | m: my @x = gather { for 1..10 { take start { sleep($_/10); $_ }}}; say await @x | 08:32 | |
camelia | (1 2 3 4 5 6 7 8 9 10) | ||
masak | lookatme: no | 08:33 | |
Voldenet | one could do this | ||
lookatme | oh, seem like **faster** is depend on situation | 08:34 | |
but `gather take` can make lazy list | 08:35 | ||
Voldenet | well, the .grep.Set will make full evaluation anyway | 08:38 | |
so there's no reason to make it a lazy list | |||
with lazy eval, i'd probably use .cache anyway, which destroys the point | 08:39 | ||
(I guess lazy approach could use less memory though) | |||
(...but would cost performance, so it's a tradeoff, if my intuition isn't wrong) | 08:40 | ||
lookatme | em, yeah, lazy list has its advantage, but not suitable for every case | 08:48 | |
eater | building on freebsd is slow :( | 08:49 | |
lookatme | rakudo is slow? | 08:50 | |
eater | nah | 08:51 | |
lookatme | oh . | 08:52 | |
08:52
progr1c joined
08:53
cdc joined
08:55
progr1c left
09:00
ChoHag left,
bjz joined
09:09
bjz left
|
|||
tadzik | Zoffix: oh, when. Asap, I guess, so it can be useful for the cpan transition | 09:11 | |
09:14
g4 joined
09:18
bjz joined
09:23
lookatme left
09:29
lizmat left
09:32
TEttinger left
09:35
xtreak joined
09:37
xtreak_ left
09:38
itaipu joined
09:40
xtreak left
09:43
xtreak joined
09:49
marcovorg joined,
kurahaupo_ joined
09:52
wamba joined
|
|||
grondilu | How do I parse an algebraic expression with a grammar? I've tried several times, and never quite succeeded :( My last attempt: gist.github.com/grondilu/09e443f28...d7eeb55677 | 09:56 | |
10:04
lowbro left
10:06
lizmat joined
10:07
ChoHag joined,
xtreak_ joined,
xtreak left
10:18
kurahaupo_ left,
aborazmeh joined,
aborazmeh left,
aborazmeh joined
10:19
cyphase left
10:23
cyphase joined,
aborazmeh left
10:24
parv left
10:40
aborazmeh joined,
aborazmeh left,
aborazmeh joined
10:47
Zoffix joined
|
|||
Zoffix | grondilu: you could look at "EXPR" parser in nqp. | 10:48 | |
There might even be a way to use it in Perl 6 | |||
m: use QAST:from<NQP>; say grammar Mathy is HLL::Grammar { token TOP { <EXPR> } }.parse: '2+2' | |||
camelia | ===SORRY!=== Cannot find method 'submethod_table' on object of type NQPClassHOW |
||
Zoffix | which isn't this I guess... | ||
grondilu: also: en.wikipedia.org/wiki/Shunting-yard_algorithm | 10:50 | ||
10:58
curan left
11:04
Zoffix left
11:09
itaipu left
11:12
Cabanossi left
11:14
Cabanossi joined
11:18
wamba left
11:19
bjz_ joined,
bjz left
11:29
KDr2 left
11:30
eyck left
11:41
eyck joined
|
|||
Voldenet | hm, is it even possible with perl's parser? | 11:43 | |
(the a+b+c case) | 11:44 | ||
11:45
curt_ joined
|
|||
Voldenet | because "expr -> binary | unary | '(' expr ')', binary -> expr '+' expr" is left-recursive | 11:45 | |
even easier "expr -> expr '+' expr | '(' expr ')' | digit" | 11:48 | ||
11:50
aborazmeh left
|
|||
masak | Voldenet: I tend to rewrite left-recursive stuff as using the `%` metaoperator | 11:51 | |
so `expr -> expr '+' expr` would become something like `rule add-expr { <mult-expr>+ % "+" }` | 11:52 | ||
grondilu | .tell Zoffix thanks! I used one of the external links to write this: gist.github.com/f1b52ab99dcfd503b0...041e641531 | ||
yoleaux | grondilu: I'll pass your message to Zoffix. | ||
Voldenet | hmm, any info on this? | 11:53 | |
docs.perl6.org/language/grammars doesn't even contain any % | |||
ah, /language/regexes does | 11:54 | ||
11:54
bjz_ left
11:55
bjz joined
|
|||
Voldenet | hm, but how does it actually help | 12:00 | |
m: say grammar Algebra { rule TOP { ^^ <expr> $$ }; rule expr { '(' <expr> ')' | <expr>+ % '+' | '1' }}.parse("1+1"); | |||
yeah, it's recursive | |||
12:00
wamba joined
|
|||
camelia | (timeout) | 12:00 | |
12:00
kurahaupo left,
kurahaupo joined
12:03
Zoffix joined
|
|||
Zoffix | m: say 1+2+3 | 12:03 | |
camelia | 6 | ||
Zoffix | See, it's possible :) | ||
Voldenet | Oh I know it's possible. :P | ||
I just know how to do this using perl6 grammars | |||
s/know/don't know/ | |||
slight difference ;) | |||
Zoffix | Perl 6 parses itself using a perl6 grammar (pretty much) | ||
grondilu | maybe it does but if so it's quite convoluted | 12:05 | |
12:06
kurahaupo left,
kurahaupo joined
|
|||
Zoffix | Sure. You can setup your own precendence and stuff; all handled by it | 12:08 | |
Like this: github.com/perl7/perl7/blob/master...#L112-L116 | |||
m: say grammar Algebra { rule TOP { ^^ <expr> $$ }; regex expr { "(" <expr> ")" || \d+ || <expr>+ % "+" }}.parse("1+1"); | |||
camelia | 「1+1」 expr => 「1+1」 expr => 「1」 expr => 「1」 |
||
Voldenet | Ah, right, | is longest alternation | 12:09 | |
no wonder it just finds them all, :D | |||
12:11
lowbro joined,
lowbro left,
lowbro joined
12:13
Zoffix left
|
|||
Voldenet | hmm, what happens if... | 12:14 | |
m: say grammar Algebra { rule TOP { ^^ <expr> $$ }; regex expr { "(" <expr> ")" || \d+ || <expr>+ % "+" }}.parse("test"); | |||
camelia | (timeout) | 12:15 | |
Voldenet | ah, the flavours of recursive | ||
grondilu | yeah if it does not find, it keeps searching | ||
(or so I think) | 12:16 | ||
Voldenet | m: say grammar Algebra { rule TOP { ^^ <expr> $$ }; regex expr { "(" <expr> ")" || \d+ || <invalid> || <expr>+ % "+" }; invalid { <-[\d]>+ }}.parse("test"); | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing required term after infix at <tmp>:1 ------> 3 || <expr>+ % "+" }; invalid { <-[\d]>+ 7⏏5}}.parse("test"); expecting any of: prefix term |
||
Voldenet | m: say grammar Algebra { rule TOP { ^^ <expr> $$ }; regex expr { "(" <expr> ")" || \d+ || <invalid> || <expr>+ % "+" }; regex invalid { <-[\d]>+ }}.parse("test"); | 12:17 | |
camelia | 「test」 expr => 「test」 invalid => 「test」 |
||
Voldenet | Now I guess I know how one could write that, but it sounds like a convoluted pain. | 12:18 | |
12:19
CIAvash left,
dj_goku left
|
|||
Voldenet | Can one use LR parser instead? :) | 12:21 | |
12:24
raschipi joined
|
|||
Voldenet | meh, nevermind | 12:25 | |
I guess it's a funny exercise in writing grammars, teaches one how to see it as a code more :) | 12:27 | ||
[Coke] | Some simple doc tickets if someone wants to help out: github.com/perl6/doc/issues/1312 github.com/perl6/doc/issues/1311 | 12:28 | |
Geth | doc: 662da2d416 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/testing.pod6 Fix #1312 |
12:41 | |
doc: 5a39a32693 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/io-guide.pod6 Fix #1312 |
|||
doc: a970484899 | (Zoffix Znet)++ (committed using GitHub Web editor) | xt/words.pws Add CatHandle to words Fixes #1311 |
12:43 | ||
doc: e5b9bce3b4 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/io-guide.pod6 Fix typos Fixes #1311 |
|||
dogbert11 | so #1311 was fixed twice :) | 12:48 | |
12:49
bjz left
12:51
dj_goku joined,
dj_goku left,
dj_goku joined
|
|||
[Coke] | zoffix++ | 12:59 | |
13:02
mcmillhj_ joined,
mcmillhj joined
13:09
mcmillhj_ left,
mcmillhj left
13:14
xtreak_ left
13:15
xtreak joined,
xtreak left,
khw joined,
xtreak joined
13:17
lizmat left
13:18
cdg joined
13:25
wamba left
13:30
mcmillhj joined
13:31
mcmillhj_ joined
13:47
kurahaupo left,
kurahaupo joined
13:51
aborazmeh joined,
aborazmeh left,
aborazmeh joined
13:55
xtreak left
14:07
aborazmeh left
14:08
jonas2 left
14:18
ab6tract left
14:23
itaipu joined
14:32
domidumont left
14:36
wamba joined,
AndyDee left,
Dee22 joined
14:38
Dee22 left
14:39
AndyDee joined,
yuit5 joined
14:41
AndyDee left,
Dee22 joined
14:43
Dee22 left,
Dee22 joined
14:44
Cabanossi left,
Cabanossi joined
14:45
Dee22 left,
Dee22 joined
14:46
st_elmo joined,
imcsk8 left
14:54
imcsk8 joined
14:56
lowbro left
15:01
dct joined
15:14
ChoHag left
|
|||
moritz | en.wikipedia.org/wiki/Multiocular_O a nice Unicode trivia | 15:16 | |
timotimo | beautiful | 15:19 | |
ꙮ | |||
moritz | .u ꙮ | 15:20 | |
yoleaux | U+A66E CYRILLIC LETTER MULTIOCULAR O [Lo] (ꙮ) | ||
moritz | and my terminal font even renders it | ||
for just one word. | |||
15:21
AlexDani` joined,
domidumont joined,
AlexDani` is now known as AlexDaniel
|
|||
AlexDaniel | unidump: ꙮ | 15:21 | |
unicodable6 | AlexDaniel, gist.github.com/9b1155fc92f073eff1...a23dfdd15b | ||
AlexDaniel | m: my $ꙮ = 7; say ‘o’ x ꙮ | 15:23 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: ꙮ used at line 1 |
||
AlexDaniel | m: my $ꙮ = 7; say ‘o’ x $ꙮ | ||
camelia | ooooooo | ||
AlexDaniel | m: my \ꙮ = 7; say ‘o’ x ꙮ | ||
camelia | ooooooo | ||
timotimo | that's so fantastic | 15:24 | |
AlexDaniel | someone has to draw a spider using this thing for eyes | ||
unidump: ꙭ | 15:26 | ||
unicodable6 | AlexDaniel, gist.github.com/dfda0400aa3adfaa57...23f5fa5f75 | ||
AlexDaniel | m: say ‘ꙭ’.uc | ||
camelia | Ꙭ | ||
eater | < > is so nice to define commands | 15:27 | |
AlexDaniel | m: ‘ꙫ’.uc.say | ||
camelia | Ꙫ | ||
AlexDaniel | they definitely had some fetish for eyes and letter O | ||
eater: hm. What do you mean exactly? | |||
u: ocular | 15:28 | ||
unicodable6 | AlexDaniel, U+A669 CYRILLIC SMALL LETTER MONOCULAR O [Ll] (ꙩ) | ||
AlexDaniel, U+A668 CYRILLIC CAPITAL LETTER MONOCULAR O [Lu] (Ꙩ) | |||
AlexDaniel, 7 characters in total: gist.github.com/6123d01a50062de088...1825f81153 | |||
moritz | »ꙮ« | ||
15:29
Rawriful joined
|
|||
AlexDaniel | »ꙮ̋« | 15:30 | |
eater | AlexDaniel: Proc::Async.new(<rm -rf /vagrant>) | ||
I was typing it like ["rm", "] | 15:31 | ||
15:31
yuit5 left
|
|||
eater | *["rm", "-rf", "/vagrant"] | 15:31 | |
AlexDaniel | eater: alright, yes. But be careful when you use «» or <<>> | ||
eater | Why so? | ||
AlexDaniel | m: my $x = ‘my folder’; dd «rm -rf $x» | 15:32 | |
camelia | ("rm", "-rf", "my", "folder") | ||
AlexDaniel | m: my $x = ‘my folder’; dd «rm -rf "$x"» | ||
camelia | ("rm", "-rf", "my folder") | ||
AlexDaniel | a little bit similar to what you'd do in a shell | 15:33 | |
eater | AlexDaniel: github.com/PostCocoon/P6-SystemPac...ps.pm6#L28 | ||
this is what Im doing currently | |||
it's a slurpy parameter and flattens the arrays together | 15:34 | ||
AlexDaniel | that's probably alright :) | ||
in whateverable project I always use stuff like ["rm", "-rf", "/vagrant"] :) | |||
ugexe | if you trust the input it doesn't really matter, since it can just as well delete all the files using perl6 IO | 15:36 | |
eater | but < > doesn't parse anything right? it's just "rm -rf /vagrant".words or am I wrong? | 15:37 | |
ugexe | you are right | ||
timotimo | right, for example: | ||
eater | \o/ | ||
timotimo | m: say <foo\ bar> | 15:38 | |
camelia | (foo\ bar) | ||
timotimo | m: say <foo\ bar>.perl | ||
camelia | ("foo\\", "bar") | ||
AlexDaniel | eater: I'm not sure how ‘xbps-install’ works, but most likely you need ‘--’ | 15:39 | |
that is, cmd(<xbps-install -y -->, $packages) | |||
eater | good call! | 15:40 | |
thanks AlexDaniel | |||
AlexDaniel | (otherwise you may run into issues if one of your packages starts with ‘-’… probably not going to happen, but still) | 15:42 | |
eater | yeah :D | ||
the integration tests for this project are gonna be fun | |||
spawning vagrant boxes | |||
15:43
itaipu left
15:44
cpage_ left,
cpage__ joined
15:45
dct left
|
|||
hahainternet | so i asked a question yesterday i'm just going to blatently repeat today, using something like 'regex whatever { <@listoftokens>}' in a grammar doesn't seem to backtrack, i'm presuming because the regex only ever matches the first of the list and won't try alternatives | 15:48 | |
can anyone provide advice on debugging and/or programmatically adding a bunch of sym tokens so i can distinguish but group them? | |||
AlexDaniel | m: my @a = <aa a c>; say ‘ab’ ~~ /<@a>‘b’/ | 15:52 | |
camelia | 「ab」 | ||
AlexDaniel | m: my @a = <aa a c>; say ‘ab’ ~~ /<@a> {say ‘here’} ‘b’/ | 15:54 | |
camelia | here 「ab」 |
||
AlexDaniel | hm, not sure | ||
hahainternet | yeah i don't quite understand the internal workings | 16:00 | |
16:03
itaipu joined
16:05
kyclark joined
|
|||
grondilu | when using the "%" modifier in a regex, is it possible to capture the separator? | 16:06 | |
timotimo | yup | ||
16:07
domidumont1 joined
|
|||
grondilu | m: say "foo,bar" ~~ /<ident>+ % $<sep> = <[,;]>/; say $<sep> | 16:07 | |
camelia | 「foo,bar」 ident => 「foo」 sep => 「,」 ident => 「bar」 [「,」] |
||
grondilu | m: "foo,bar" ~~ /<ident>+ % $<sep> = <[,;]>/; say $<sep> | ||
camelia | [「,」] | ||
grondilu | nice | ||
timotimo | m: say "a,b.c|d!e" ~~ / <ident>+ % $sep=<[,.|!]> / | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$sep' is not declared at <tmp>:1 ------> 3say "a,b.c|d!e" ~~ / <ident>+ % 7⏏5$sep=<[,.|!]> / |
||
timotimo | m: say "a,b.c|d!e" ~~ / <ident>+ % $<sep>=<[,.|!]> / | ||
camelia | 「a,b.c|d!e」 ident => 「a」 sep => 「,」 ident => 「b」 sep => 「.」 ident => 「c」 sep => 「|」 ident => 「d」 sep => 「!」 ident => 「e」 |
||
16:08
nadim joined,
mcmillhj left
16:09
mcmillhj_ left,
domidumont left
|
|||
jnthn | hahainternet: tokens are just methods, so it should be possible to build up a grammar (or role to mix into a grammar) using .^add_method('foo:sym<bar>', token { <$bar> }) | 16:09 | |
hahainternet | jnthn: roger, having said that, that is rather ugly and i'm not sure if it's explained well in the docs that things will behave this way | 16:10 | |
i don't even know if what i described is the actual cause | |||
however, regardless, thanks for the answer, i'll do that :) | |||
jnthn | I'm pretty sure that <@foo> isn't something that can be backtracked in to | 16:11 | |
'cus I've a good idea of the contortions that would be required to make that work :P | |||
hahainternet | well that's none of my business as i don't know the contortions | ||
but i just mean i was surprised by the behaviour until i thought about it | 16:12 | ||
and it'd be nice to add as a caveat somewhere | |||
i should file bugs i know :( | |||
jnthn | I meant "can't be backtracked into" more in the "in the current implementation" sense, more than in the "impossible to do ever" sense. | 16:13 | |
16:13
mcmillhj joined
|
|||
jnthn | But yeah, a mention in the docs that you can't backtrack into it would be good | 16:13 | |
16:13
mcmillhj_ joined
|
|||
jnthn | Laziest way is to just file a link to this chat in the irclog :P | 16:13 | |
timotimo | what's the difference between <@foo> and just @foo? | 16:14 | |
jnthn | Same as between <$foo> and $foo | 16:15 | |
(EVAL-y behavior) | |||
timotimo | ah so you could have a list of pieces of regex and it'd be put into like an alteration | 16:16 | |
bbiab | |||
grondilu created a "Symbolic" repo for formal calculus in Perl 6. github.com/grondilu/Symbolic | |||
^oviously that's very ambitious so I don't know if I'll be able to make it any useful, but if anyone is interested, check it out. | 16:17 | ||
16:17
beginner joined
|
|||
hahainternet | i guess all i needed was just @tokenlist then | 16:17 | |
as my tokens were all plaintext, no regex incorporation | |||
but i think adding methods is the smartest option to make it backtrackable | |||
16:22
mcmillhj left,
mcmillhj_ left
16:31
mcmillhj joined,
mcmillhj_ joined,
AlexDaniel left
|
|||
timotimo | so numpy has a "nanmin" function that gives you the smallest number in an array ignoring NaN | 16:32 | |
perl6 doesn't need that because apparently NaN is never min-er than another number | |||
however | |||
a NaN inside a list that you pass to max will dominate | |||
hahainternet | jnthn: hmm, using ^add_method doesn't actually seem to work, i'll simplify my code into a test case | 16:33 | |
16:34
skids joined
16:35
itaipu left,
mcmillhj_ left,
mcmillhj left
|
|||
ugexe | did you ^compose or whatever after? | 16:36 | |
timotimo | twitter.com/FakeUnicode/status/865...4525392896 <3 | ||
16:36
ChoHag joined
|
|||
hahainternet | ugexe: i did not | 16:36 | |
it doesn't seem to make a difference, i'm a bit out of my depth here though | 16:39 | ||
ugexe | m: my $foo = role :: { .^add_method("foo", method { say 1 }); }.new; $foo.foo | 16:40 | |
camelia | 1 | ||
ugexe | m: my $foo = class :: { .^add_method("foo", method { say 1 }); }.new; $foo.foo | ||
camelia | No such method 'foo' for invocant of type '<anon|71032176>' in block <unit> at <tmp> line 1 |
||
hahainternet | ugexe: i'm actually using it to add tokens to a grammar, if that makes any difference | ||
ugexe | works as a punned role | ||
16:42
Cabanossi left,
lizmat joined
16:44
mcmillhj joined,
mcmillhj_ joined,
Dee22 left,
Cabanossi joined
16:49
mcmillhj_ left,
mcmillhj left
16:52
dakkar left
16:56
mcmillhj_ joined,
mcmillhj joined
16:57
xinming_ left
17:00
domidumont joined,
kyclark left
17:03
domidumont1 left
|
|||
hythm | Hi #perl6. are there required modules needed before getting perl6-debug-m working? I installed perl6 by running: | 17:07 | |
git clone github.com/tadzik/rakudobrew ~/.rakudobrew; cd ~/.rakudobrew; ^Ckudobrew build moar; rakudobrew build zef; zef install linenoise; zef install Grammar::Debugger | |||
but for some reason I get this error when I lunch perl6-debug-m: Non ast passed to WANTED: NQPMu | 17:08 | ||
timotimo | sorry, perl6-debug-m is b0rked at the moment ;( | ||
17:08
setty1 joined
|
|||
timotimo | Grammar::Debugger is something different, though. you use that by putting a use statement into your code | 17:09 | |
hythm | hmm, Thanks timotimo. | ||
raschipi | Bork bork bork. | 17:10 | |
hythm | Yeah Grammar::Debugger is not working for me. this gist has the error and also the output of installing perl6: | ||
gist.github.com/alphah77/9535aeefe...5f4e1e30a9 | |||
so basically if I added use Grammar::Debugger to the code, it throws error when try to parse TOP regex. | 17:15 | ||
17:15
raschipi left
17:21
setty1 left
|
|||
hythm | looks like I will have to troubleshoot a grammar issue manually, which i know it will be difficult :D | 17:30 | |
17:36
_kristian joined
17:39
mr-foobar left,
lizmat left
17:43
Cabanossi left
17:44
grondilu left
17:45
Cabanossi joined,
robertle joined
17:54
Zoffix joined
|
|||
Zoffix | hythm: which rakudo version are you using? Recall what I mentioned: 2017.03 rakudo might now have the issues you're experiencing. Did you try using that version? Also, none of these issues will get fixed if we don't know about them, so it's in your own best interest to report them. | 17:55 | |
huggable: rakudobug | |||
huggable | Zoffix, Report bugs by emailing to [email@hidden.address] | ||
Zoffix gets jealous of hythm's 48.192s parse time... | 17:56 | ||
Usually ~70s on my boxes :( | |||
17:57
Ven joined
|
|||
Zoffix | m: say (70-48.192)*(97*1.5) | 17:57 | |
camelia | 3173.064 | ||
17:58
Ven is now known as Guest50345
|
|||
Zoffix | would save me ~1hr of time a month | 17:58 | |
hythm | Zoffix, I tried 2017.03 but there is no difference. I want to report the bug, but I don't know what to report. I made simple programm has simple Grammar and Grammar::Debugger worked fine. So I'm trying to see if this is really a bug or I have something wrong in my code | 18:03 | |
this is a gaming laptop :P | |||
Zoffix | hythm: "Cannot invoke this object (REPR: Null; VMNull)" error is not very useful to users, so there's a good chance it can be improved even if it's a problem with your code. "Non ast passed to WANTED: NQPMu" is a definite bug and users should never see such errors | 18:05 | |
hythm | I will report a bug and mention this error I get "Cannot invoke this object (REPR: Null; VMNull)", if that is sufficant | ||
alright, I will report that then | 18:06 | ||
Zoffix | What to report: instructions for how to reproduce the issue on someone else's computer; so which versions of software/OS you're using and what code you ran | ||
hythm | noted | ||
18:06
setty1 joined
18:11
Chillance joined
18:12
Cabanossi left
18:13
_kristian left
18:14
mr-foobar joined
|
|||
TimToady | Voldenet: I'm surprised nobody mentioned reduction operators, since things like bags always have to run a sequence to completion, but a reduction can short circuit, even on an infinite list | 18:14 | |
TimToady checks... | |||
18:14
Cabanossi joined
|
|||
TimToady | m: say [==] 1...* | 18:14 | |
camelia | False | ||
TimToady | yup | ||
18:14
Guest50345 left
18:15
_kristian joined
|
|||
Zoffix | neat | 18:16 | |
18:16
Ven_ joined
|
|||
Voldenet | TimToady: nice, how do I do that with functions? | 18:18 | |
erm Callable | |||
Zoffix | [[&callable]] | 18:19 | |
m: say [==] 1, 1, 1, |(1...*) | |||
This hang tho | |||
Ah | |||
m: say [==] 1, 1, 1, |(1, 2, 3...*) | |||
18:20
setty1 left
|
|||
camelia | (timeout) | 18:20 | |
Voldenet | m: my $i = 0; my &a = { }; my @b = (^5).map({ &a }); say [~~] @b | ||
camelia | Type check failed in assignment to &a; expected Callable but got Hash (${}) in block <unit> at <tmp> line 1 |
||
Zoffix | Actually no, the first one was right | ||
Voldenet | m: my $i = 0; my &a = { $_ }; my @b = (^5).map({ &a }); say [~~] @b | ||
camelia | True | ||
18:20
trnh joined,
trnh left,
trnh joined
|
|||
Voldenet | hm, the real problem is that it evaluates the method during ~~ operation | 18:20 | |
18:21
Ven_ left
18:22
cdg left
|
|||
TimToady | you want to test that you have the same function? then you'd use [===] for identity | 18:22 | |
Voldenet | mmm, === feels so js-y :P | 18:23 | |
TimToady | m: say [===] &sin, &sin, &sin | ||
camelia | True | ||
TimToady | m: say [===] &sin, &sin, &cos | ||
camelia | False | ||
Zoffix | m: say [==] (1, 1, 1, |(1...*)) | ||
camelia | False | ||
TimToady | yes, arglist slip is not lazy | 18:24 | |
Zoffix | Ah. I see | ||
TimToady doesn't give a rip whether something seems js-y or not; we designed our various equality operators by our own selves | 18:25 | ||
Voldenet | I still find it moderately funny, because it's identity operator in js as well :-) | 18:26 | |
not that I don't like familiarity | |||
TimToady | convergent evolution, and all that :) | ||
Zoffix | yeah, JS got `use strict` and soon (already?) will get the /s switch for regexes, like Perl 5 | 18:27 | |
TimToady | mebbe they'll borrow Perl 6 regexes in another 15 years or so... | 18:28 | |
Zoffix | :) | ||
Voldenet | js is a serious and modern language now, it has classes | 18:29 | |
18:30
pmurias joined
|
|||
pmurias | Voldenet: the classes in js despite being mostly syntax sugar do make a big difference | 18:31 | |
18:31
Zoffix left
|
|||
Voldenet | actually, if I were to choose the important feature in JS, i'd pick async and promises | 18:32 | |
18:32
Ven_ joined
|
|||
Voldenet | it greatly improved quality of most code | 18:32 | |
and one could argue that anything above C and its structs is syntax sugar ;) | 18:34 | ||
because you're just implicitly passing objects | |||
timotimo | but that's only run-time | 18:35 | |
at compile time you're free to stack on as much as you want | 18:36 | ||
hythm | Zoffix: Reported the issue I get rt.perl.org/Public/Bug/Display.html?id=131326 | ||
18:54
alphah joined
18:58
Ven_ left,
Ven joined,
Ven is now known as Guest74863
19:02
Guest74863 left
19:04
AlexDaniel joined
19:05
Ven_ joined
19:16
darutoko left
19:19
lizmat joined
19:20
zacts left
19:21
iH2O joined
19:27
domidumont left
19:34
alphah left
19:35
zacts joined
19:37
_kristian left
19:38
lizmat left,
_kristian joined
19:43
Ven_ left,
Ven_ joined
19:47
iH2O left,
wamba left,
trnh left
19:49
mcmillhj_ left,
mcmillhj left
19:56
mcmillhj joined
19:57
mcmillhj_ joined
20:06
wamba joined
20:07
cdg joined,
espadrine joined
20:12
Cabanossi left
20:14
Cabanossi joined
20:24
xinming joined
20:25
al2o3-cr joined
20:27
setty1 joined
20:30
Ven_ left
20:31
mr-foobar left,
Ven joined,
Ven is now known as Guest71934
20:34
st_elmo left
20:35
Guest71934 left
20:38
Ven_ joined
20:43
Ven_ left,
Cabanossi left
20:44
Cabanossi joined
20:45
setty1 left,
Ven_ joined,
bjz joined
20:47
Praise left,
Praise joined,
Praise left,
Praise joined
20:50
Ven_ left
|
|||
robertle | ugexe: travis may need updating now that rakudobrew does not build panda anymore... | 20:50 | |
ugexe | why? | 20:51 | |
20:51
Ven_ joined
|
|||
ugexe | users write their own .travis.yml | 20:51 | |
jnthn | I think the Perl 6 language support docs on Travis may still mention panda | 20:52 | |
docs.travis-ci.com/user/languages/perl6/ | |||
tadzik | they should perhaps mention to not rely on master but rather on a specific tag | ||
(or commit) | |||
robertle | right, sorry! | 20:53 | |
jnthn | It looks like there's a link at the top to fork/fix the page | ||
robertle | I was under the (wrong) impression that the part inclusing panda is part of the basioc perl6 stuff rather then my custom bit... | 20:54 | |
tony-o: I have updated my version derived from your "pluggable" again, suports the lexical "require" now: github.com/robertlemmen/perl6-pluggable | 20:56 | ||
20:57
zakharyas left,
al2o3-cr left
20:58
Ven_ left
21:00
yqt joined
21:02
user3 joined
|
|||
ugexe | hehe you beat me by a few minutes robertle... im getting slow | 21:08 | |
robertle | beer helps :) | 21:09 | |
user3 | why can't I compile this to MoarVM byte code: perl6 --target=mbc -e "say 'Hello, world'" | 21:11 | |
I get the error message: "Cannot dump this object; no dump method" | |||
21:11
skids left
|
|||
user3 | I've done the basic installation for rakudo Moar | 21:12 | |
jnthn | It needs an output file, since it's a bunch of binary, so it decides not to dump it on your terminal | ||
timotimo | user3: you have to --target=foobar.moarvm | ||
or, wait | 21:13 | ||
--output=foobar.moarvm | |||
jnthn | --output=foo.moarvm | ||
timotimo | and then you can dump that with moar --dump foobar.moarvm | ||
21:14
Cabanossi left
|
|||
jnthn | Yeah, worth noting that compiling a script is only really a debugging aid; only modules are usefully usable in compiled form (so far, at least) | 21:14 | |
21:14
Cabanossi joined
|
|||
jnthn | And you don't need to do that manually, it's handled automatically | 21:15 | |
awwaiid | japhb: you should come by and say hi :) | ||
ugexe | put your script in a module, and have your script just be `use My::Script` to compile scripts | ||
ya know we already use wrappers around installed scripts... there is no reason we don't just use those wrappers as the perl6 entry point and do that automatically on install | 21:17 | ||
jnthn | Only caveat is that a MAIN needs an is export sticking on it | 21:18 | |
21:18
TEttinger joined
|
|||
ugexe | hmm no way to import them explicitly? | 21:19 | |
jnthn | At Perl 6 level not a way to import things that aren't exported. But yeah, the whole import mechanism works by being given the UNIT of the imported thing, which is normally just used to find EXPORT, EXPORTHOW and friends. | 21:21 | |
But of course &MAIN could be dug out of it :) | |||
timotimo | hm, it's not lexical-only? | 21:23 | |
well, i guess top-level lexicals would show up in the module itself perhaps? | 21:24 | ||
jnthn | timotimo: UNIT is the top-level lexical scope | ||
And on being loaded a module stashes that somewhere the module loader can get at it | 21:25 | ||
Which is how EXPORT and GLOBALish and friends are located | |||
21:26
skids joined
|
|||
timotimo | ah, i see | 21:27 | |
21:29
cdg left
|
|||
user3 | ok so I did this: perl6 --target=mbc --output=foobar.moarvm -e "put 'hello, world'" | 21:30 | |
And this: moar --dump foobar.moarvm > foobar.mbc | |||
Then I tried "moar foobar.mbc" I get the error message "Unhandled exception: Bytecode stream corrupt (missing magic string)" | |||
I also tried "moar foobar.moarvm" I get the error message "Unhandled exception: While looking for 'ModuleLoader.moarvm': no such file or directory at <unknown>:1 (foobar.moarvm:<dependencies+deserialize>)" | |||
timotimo | oh, no | ||
i thought you wanted to dump the contents of the moarvm file | 21:31 | ||
21:31
cdg joined
|
|||
user3 | i just want to compile the code a bit to improve performance | 21:31 | |
timotimo | you will have to invoke the code with the perl6 script or at least steal the commandline flags it uses | ||
in that case, do it like jnthn and ugexe suggested | |||
put everything into modules because these get precompiled for you automatically | |||
21:31
nadim left
|
|||
timotimo | then just have a "program" that does "use MyApp::Entrypoint" or whatever you call that module | 21:32 | |
ugexe | all of your MAINs have to be in one module | ||
user3: github.com/ugexe/zef/blob/master/bin/zef and github.com/ugexe/zef/blob/master/l...ef/CLI.pm6 | 21:33 | ||
robertle | jnthn: in your latest blog post re funding, what does "non-blocking await" mean? isn't blocking the whole point of await? | 21:34 | |
21:37
dct joined
|
|||
Voldenet | robertle: await actually yields continuation | 21:39 | |
non-blocking, that is | |||
and blocking await probably does some magic with a thread | |||
while capturing the thread in the process | |||
(actually I'm not sure how await could be blocking, but probably because it takes a thread) | 21:40 | ||
jnthn | I thought I'd written this up somewhere but I don't find it | ||
hythm | m: class A { multi method a(Str :$b) { say "First" }; multi method a() { say "Second" } }; A.new.a # (named arg) Why dispatch to first method | 21:41 | |
robertle | not sure I understand: my current thread calls await on a promise, which will block until the promise is kept/broken. right? that's the point, isn't it? | ||
camelia | First | ||
jnthn | Anyways, the Perl 6.c semantics - for lack of time to do anything better - is that await will use a condition variable | ||
robertle | makes sense | ||
hythm | m: class A { multi method a(Str $b) { say "First" }; multi method a() { say "Second" } }; A.new.a | ||
camelia | Second | ||
jnthn | This "works", but it means that a real OS thread is blocked | 21:42 | |
Voldenet | hythm: named arguments are optional, but | ||
m: class A { multi method a(Str:D :$b) { say "First" }; multi method a() { say "Second" } }; A.new.a # (named arg) Why dispatch to first method | |||
camelia | Second | ||
Voldenet | m: class A { multi method a(Str:D :$b) { say "First" }; multi method a() { say "Second" } }; A.new.a("x") # (named arg) Why dispatch to first method | ||
camelia | Cannot resolve caller a(A: Str); none of these signatures match: (A $: Str:D :$b, *%_) (A $: *%_) in block <unit> at <tmp> line 1 |
||
Voldenet | m: class A { multi method a(Str:D :$b) { say "First" }; multi method a() { say "Second" } }; A.new.a(:b("x")) # (named arg) Why dispatch to first method | 21:43 | |
camelia | First | ||
timotimo | m: await do for ^64 { start { sleep 0.1 } }; say now - INIT now | ||
camelia | 0.4066006 | ||
21:43
mcmillhj left,
mcmillhj_ left
|
|||
timotimo | m: use v6.d.PREVIEW; await do for ^64 { start { sleep 0.1 } }; say now - INIT now | 21:43 | |
camelia | 0.40641964 | ||
timotimo | huh? | ||
robertle | jnthn: but if you change that then the real OS thread after the await could be a different than the one before the call, right? | ||
jnthn | The idea behind non-blocking await is that, when an `await` takes place on the thread pool, we instead take a continuation | ||
Geth | ecosystem: 335cd23715 | (Curt Tilmes)++ | META.list Move LibYAML repo to yaml github |
||
jnthn | And then, when the thing awaited on is done, the continuation is scheduled on the thread pool | ||
robertle | ok, so even the perl thread could be a different one after the await? | 21:44 | |
jnthn | robertle: Yes, that is an upshot, which is why non-blocking await is being brought in as part of 6.d | ||
Note that this only happens on threads managed by the thread pool | 21:45 | ||
21:45
skids left
|
|||
Voldenet | robertle: that's the whole point of await | 21:45 | |
jnthn | And if you're using a thread pool you already don't know what thread the code will run on | ||
robertle | understood now. sounds cool, but also potentially a bit surprising. you don't usually expect th thread that runs your code to change ... | ||
hythm | Voldenet yes I needed the define smiley :D. Thanks | ||
Voldenet | hythm: (; | ||
jnthn | If you are doing something where you really need more control, and work with `Thread` directly, or if you `await` in the main program thread, then you'll get the same semantics as today | 21:46 | |
Voldenet | jnthn: does perl have something like AsyncLocal? | ||
jnthn | Voldenet: A dynamic variable will work out for that | 21:48 | |
A key difference between await in Perl 6 and await in C#, even once the non-blocking stuff happens, is that the a continuation is taken involving the whole call stack between the place that does the `await` and the thread pool | 21:49 | ||
Whereas in C# it's a pre-rotuine code transform | |||
*per-routine | |||
That's why there's no equivalent to `async`; we don't need one | 21:50 | ||
Or, arguably, the equivalent is `start` :) | |||
robertle | continuations are an internal-only thing in perl6, right? I can't create a continuation in perl6 code? | ||
jnthn | Correct | ||
gather/take uses them also | |||
21:50
alimon left
|
|||
Voldenet | You technically could write your own version of await by wrapping it | 21:51 | |
and then decorating the result | |||
jnthn | gather/take is also an exmaple of something where various languages have a "yield" feature that transforms a routine at compilation, whereas in Perl 6 you don't need to do that | ||
21:51
espadrine left
|
|||
robertle | I played with gather/take, but you can't use that across threads. continuing a continuation in another thread is quite cool! | 21:52 | |
if you could do that in your own code... | |||
21:53
user3 left
21:54
dct left
|
|||
jnthn | A `start` block will capture the dynamic variables in scope at the point it was taken | 21:54 | |
Voldenet | robertle: you can kind of use gather take across threads | ||
robertle | Voldenet: how? I tried that a bit... | ||
jnthn | m: my $*x = 1; await start { $*x++; await Promise.in(1); $*x++ }; say $*x | 21:55 | |
camelia | 3 | ||
jnthn | So I figure ^^ gets you the AsyncLocal style functionality | ||
Voldenet | m: @x = gather { for ^10 -> $v { take start { $v*2 } }; say await @x | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@x' is not declared at <tmp>:1 ------> 3<BOL>7⏏5@x = gather { for ^10 -> $v { take start |
||
Voldenet | m: my @x = gather { for ^10 -> $v { take start { $v*2 } }; say await @x | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3$v { take start { $v*2 } }; say await @x7⏏5<EOL> expecting any of: postfix statement end statement modifier stateme… |
||
Voldenet | m: my @x = gather { for ^10 -> $v { take start { $v*2 } }}; say await @x | ||
camelia | (0 2 4 6 8 10 12 14 16 18) | ||
jnthn | Voldenet: There you're just taking a bunch of Promise objects, so all the threading happens outside of the gather/take. | ||
(Which is fine and useful) | 21:56 | ||
But yeah, gather/take is not intended for concurrent use | |||
The iterator pattern is inherently synchronous. | |||
robertle | yeah, and shifting the promise across thread boiundarioes seems to await on it (right??) | ||
jnthn | A Promise is just a data structure | 21:57 | |
21:57
Cabanossi left
|
|||
jnthn | And await is just an operation that means "continue with the stuff after this point once the Promise is done" | 21:57 | |
await actually can work on a Channel and a Supply too | |||
This lot was special cased | 21:58 | ||
In 6.d, instead `await` accepts anything that does the `Awaitable` role | |||
robertle | jnthn: but that's what you are changing: it's no longer just waiting... | ||
jnthn | (6.d.PREVIEW, I should say) | ||
Opening the doors to folks making their own things usable with await too :) | 21:59 | ||
timotimo | it's the best kind of waiting | ||
Voldenet | the best kind of waiting is fire-and-forget | ||
21:59
Cabanossi joined
|
|||
Voldenet | ;) | 21:59 | |
m: start { say "i'm confident this will surely work" } | 22:00 | ||
camelia | ( no output ) | ||
Voldenet | ;-) | ||
jnthn | robertle: What's changing is that await will not always mean "blocking an OS-level thread" | ||
robertle: At the end of the day, that's just a means to an end, the end being that the code after the await continues when the result is available. | 22:01 | ||
Voldenet | eh, but why 'not always' instead of 'never'? :) | ||
timotimo | the OS-level threads were already being pre-empted :P | ||
which is kind of like a continuation being taken and resumed | |||
jnthn | Voldenet: No; the non-blocking behavior of await only applies if you're running code in the thread pool | ||
Voldenet | ah, right, because if you're running your own thread... you're running your own thread | 22:02 | |
jnthn | Voldenet: This is an effort to let people who want tighter control over what thread they're on to have it, but not have to totally throw away using higher-level things like await | ||
Occasionally - like when writing native bindings - it's really important to have control over that. | 22:04 | ||
timotimo | oh yes | ||
22:04
lizmat joined
|
|||
jnthn | The most recent case I had was writing the SSH::LibSSH binding, where I have a single thread interacting with it, essentially running an "event loop" | 22:05 | |
22:06
_kristian left
|
|||
Voldenet | well, a lot of things have to use event loop, like renderers | 22:06 | |
22:06
dct joined
|
|||
Voldenet | + they must really have their own thread, so it's understandable | 22:06 | |
jnthn | Yeah, GUI stuff is also good at caring | ||
22:06
rindolf left
|
|||
jnthn | Final note: besides the Awaitable role, there's also an Awaiter role | 22:07 | |
Meaning that we should be able to do stuff like "if I call await on a GUI thread, it will make sure the result is marshalled back to the UI thread after" | 22:08 | ||
A bit like .Net's SynchronizationContext | |||
Voldenet | and .ConfigureAwait(false) | ||
right? | |||
jnthn | Related to that, yes | ||
jnthn should go and get some sleep... | 22:09 | ||
timotimo | good rest, jnthn :) | ||
Voldenet | gn | ||
jnthn | 'night | ||
22:10
Actualeyes left
22:13
ufobat left
22:15
bjz left,
bjz_ joined,
_kristian joined
22:20
mcmillhj joined,
mcmillhj_ joined
22:22
ChoHag left
22:23
dct left,
bjz_ left
22:24
Actualeyes joined
22:26
mcmillhj_ left,
mcmillhj left
22:30
ChoHag joined
|
|||
hythm | I would like to call multi methods without args,and the dispatching need to happen from withing the parameters, would this be a bad practice? example to clarify: | 22:30 | |
m: class A { has $.var; multi method a(Str :$s = $!var ) { say "First" }; multi method a(Any :$s = $!var) { say "Second" } }; A.new(var => "string").a; | 22:31 | ||
camelia | First | ||
hythm | m: class A { has $.var; multi method a(Str :$s = $!var ) { say "First" }; multi method a(Any :$s = $!var) { say "Second" } }; A.new.a; | ||
camelia | Second | ||
22:35
wamba left
22:36
pmurias left,
mcmillhj_ joined,
mcmillhj joined
|
|||
Voldenet | this doesn't look like a bad practice, just a bit convoluted | 22:38 | |
+ depends on actual use case | 22:39 | ||
22:40
yqt left
22:41
mcmillhj_ left,
mcmillhj left
|
|||
hythm | If it will be convoluted and might give problems later I think I will not proceed this way, my intention was to keep the scripts under bin* cleaner(for example caliing methods as "$obj.method-name; instead of $obj.method-name(arg 1=> "a",...) and hide most of the work in lib/*,in program executable, and I wanted to hide most of the work under lib/* | 22:46 | |
22:47
go|dfish left
|
|||
timotimo | hythm: you can have the invocant as a parameter by putting it before a : and you should be able to put a "where" constraint on it | 22:51 | |
m: class A { has $.var; multi method a(A $ where { .var ~~ Str }) { say "is string" }; multi method a(A $ where { .var ~~ Int }) { say "is int" } }; A.new(var => "hi").a; A.new(var => 99).a | 22:52 | ||
camelia | Cannot resolve caller a(A.new(var => "hi"): ); none of these signatures match: (A $: A $ where { ... }, *%_) (A $: A $ where { ... }, *%_) in block <unit> at <tmp> line 1 |
||
timotimo | actually, a subsignature could work here | ||
22:53
mcmillhj_ joined,
mcmillhj joined
|
|||
timotimo | m: class A { has $.var; multi method a(A $self(Str :$var)) { say "is string" }; multi method a(A $self(Int :$var)) { say "is int" } }; A.new(var => "hi").a; A.new(var => 99).a | 22:53 | |
camelia | 5===SORRY!5=== Shape declaration with () is reserved; please use whitespace if you meant a subsignature for unpacking, or use the :() form if you meant to add signature info to the function's type at <tmp>:1 ------> 3ss A { has $.var; … |
||
timotimo | m: class A { has $.var; multi method a(A $self (Str :$var)) { say "is string" }; multi method a(A $self (Int :$var)) { say "is int" } }; A.new(var => "hi").a; A.new(var => 99).a | ||
camelia | Cannot resolve caller a(A: ); none of these signatures match: (A $: A $self (Str :$var), *%_) (A $: A $self (Int :$var), *%_) in block <unit> at <tmp> line 1 |
||
timotimo | m: class A { has $.var }; say A.new.Capture.perl | ||
camelia | \(:var(Any)) | ||
timotimo | haha | 22:54 | |
i forgot the : | |||
hythm | lol | ||
timotimo | m: class A { has $.var; multi method a(A $self (Str :$var):) { say "is string" }; multi method a(A $self (Int :$var):) { say "is int" } }; A.new(var => "hi").a; A.new(var => 99).a | ||
camelia | is string is int |
||
timotimo | i forgot the : in the example with "where", too | ||
22:55
kyan joined
|
|||
hythm | I understood what you mean, gonna test that on my code timotimo | 22:55 | |
timotimo | m: class A { has $.var; multi method a(A $ where { $_.var ~~ Str }:) { say "is string" }; multi method a(A $ where { .var ~~ Int }:) { say "is int" } }; A.new(var => "hi").a; A.new(var => 99).a | ||
camelia | is string is int |
||
timotimo | there you go | ||
works with one way, as well as the other | |||
hythm | perfect :) Thank you | ||
22:56
nebuchadnezzar left
22:57
nebuchadnezzar joined,
mcmillhj_ left,
mcmillhj left
|
|||
Geth | doc: b6076e3d53 | (Robert Lemmen)++ | doc/Language/operators.pod6 add ~ operator for Buf |
23:10 | |
23:13
marcovorg is now known as margeas,
mcmillhj joined,
mcmillhj_ joined
23:18
mcmillhj_ left,
mcmillhj left
23:22
cpage__ left,
Rawriful left
23:24
cpage_ joined
23:29
Chillance left
23:32
mcmillhj joined,
cdg left
23:36
mcmillhj left
23:42
Cabanossi left
23:44
Cabanossi joined
23:48
cpage_ left
23:50
mcmillhj joined,
mcmillhj_ joined
23:52
Coleoid joined,
skids joined
23:54
mcmillhj_ left
23:55
mcmillhj left
23:58
skids left
|