»ö« 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. |
|||
lollercopter | m: use nqp; for ^10000 { my $v = "Hostname=This is a-test"; if $v.starts-with: 'Hostname=' { my $x = nqp::join('_', nqp::split('-', nqp::join('_', nqp::split(' ', nqp::substr($v, 9))))) } }; say now - INIT now | 00:00 | |
camelia | 0.03849455 | ||
lollercopter | m: use nqp; my $v = "Hostname=This is a-test"; for ^10000 { nqp::index($v, 'Hostname=') || nqp::join('_', nqp::split('-', nqp::join('_', nqp::split(' ', nqp::substr($v, 9))))) }; say now - INIT now | 00:01 | |
camelia | 0.0294379 | ||
TEttinger | faster as in speed or faster as in amount of code? | ||
lollercopter | m: use nqp; my $v = "Hostname=This is a-test"; nqp::index($v, 'Hostname=') || nqp::join('_', nqp::split('-', nqp::join('_', nqp::split(' ', nqp::substr($v, 9))))).say | 00:02 | |
camelia | This_is_a_test | ||
TEttinger | I mean, those are definitely better on speed | ||
lollercopter | m: use nqp; my $v = "Hostname=This is a-test"; for ^10000 { }; say now - INIT now | ||
camelia | 0.0029200 | ||
00:02
Cabanossi left
|
|||
lollercopter | m: say 2.114/.159 | 00:02 | |
camelia | 13.295597 | ||
lollercopter | m: say 2.114/.027 | 00:03 | |
camelia | 78.296296 | ||
lollercopter | Voldenet: so there. 13x faster if you want it pure perl 6 and 78x faster if you don't mind using nqp | ||
00:04
Cabanossi joined,
zacts joined
|
|||
lollercopter | Voldenet: getting rid of blocks and regexes are generally a way to speed stuff up | 00:04 | |
Well, I mean a sure-fire way | 00:05 | ||
00:06
mcmillhj joined
|
|||
lollercopter crawls back into the hole | 00:07 | ||
00:07
lollercopter left,
araujo joined
00:10
cdg_ joined
00:11
mcmillhj left
00:14
cdg left,
mcmillhj joined
00:15
cdg_ left
00:19
mcmillhj left
|
|||
Voldenet | Nice! :D | 00:20 | |
00:25
mcmillhj joined
00:31
mcmillhj left
00:40
cdg joined,
mcmillhj joined
00:43
mr-foobar left
00:44
mr-foobar joined
00:45
cdg left,
mcmillhj left
00:51
mcmillhj joined
00:56
zacts left
00:57
mcmillhj left
01:02
Cabanossi left,
mcmillhj joined
01:04
Cabanossi joined
01:05
zacts joined
01:13
mr-foobar left
01:15
mr-foobar joined
01:19
LeCamarade left
01:29
mcmillhj left,
troys is now known as troys_
01:43
mcmillhj joined,
mr-foobar left
01:45
mr-foobar joined
01:48
mcmillhj left
01:56
troys_ is now known as troys
01:58
mcmillhj joined
02:03
mcmillhj left
02:10
mcmillhj joined
02:11
AlexDaniel left
02:13
mr-foobar left
02:15
mcmillhj left,
cyphase left
02:16
mr-foobar joined
02:20
ctilmes left,
cyphase joined
02:22
noganex_ joined
|
|||
awwaiid | It was nice seeing some of you at TPC-2017-DC (aka YAPC::NA)! | 02:23 | |
02:24
noganex left
02:27
mcmillhj joined
02:31
troys is now known as troys_,
mcmillhj left
02:43
mr-foobar left
02:47
mr-foobar joined
02:51
mcmillhj joined
02:56
mcmillhj left
03:00
troys_ is now known as troys
03:02
mcmillhj joined
|
|||
BenGoldberg | So I've got a hard problem, and it doesn't involve cache invalidation or an off by one error ;) | 03:02 | |
03:02
Cabanossi left
03:04
Cabanossi joined
|
|||
BenGoldberg | I'm working on some magic so that you can have class Foo with a repr('CStruct'), with attributes in it which can contain subroutines, which will be properly serialized. | 03:05 | |
I'm leaning towards a syntax of: has $foo is fptr :(int32 $arg --> int32); | 03:06 | ||
But, I'm unhappy with the "fptr" name :P | 03:07 | ||
03:07
mcmillhj left
|
|||
BenGoldberg | Could someone suggest a better name? | 03:08 | |
samcv | can anybody see any problems with this implementation of recursive directory finder? sub get-dirs (IO::Path:D $path) { | 03:12 | |
my @paths = $path.dir.grep(*.d); | |||
if @paths { | |||
@paths.append: @paths».&get-dirs($_); | |||
} | |||
return @paths; | |||
} | |||
crap didn't mean to paste that here... ugh | |||
meant to paste the link... | |||
03:13
Cabanossi left,
Cabanossi joined
|
|||
samcv | here it is: gist.github.com/samcv/7dade9fb0a93...1d864d21c7 | 03:13 | |
i wanted to make it as simple as possible | |||
03:14
mr-foobar left
03:16
mr-foobar joined
03:18
mcmillhj joined
03:23
mcmillhj left
03:29
araraloren joined
03:31
troys is now known as troys_
03:34
mcmillhj joined
03:40
mcmillhj left
|
|||
llfourn | samcv: you passed $_ to it when you've already passed it implicitly with .&get-dirs | 03:42 | |
(I didn't run the code but I'd hope that's a compile time error) | 03:43 | ||
samcv | it's not | ||
llfourn | :( | ||
samcv | i mean you can pass variables into it. i'm actually going to add more arguments so i'm going to need to make it explicit yes? | ||
though i guess this is different @dirs.map({&get-dirs($_, :$d)}) | 03:44 | ||
llfourn | but it only takes one arg and you've passed $_ twice to it | ||
samcv | but with brackets around it | ||
ah | |||
that passes it twice? | |||
llfourn | yeah | ||
BenGoldberg | This isn't perl5, you don't need the & there. | ||
llfourn | .&foo syntax passed the invocant in as the first argument to the sub | ||
samcv | BenGoldberg, even as a method? | ||
BenGoldberg | Well, maybe as a method, but not in {&get-dirs(...)} | 03:45 | |
samcv | well yeah. i just altered it from a method | ||
and didn't delete it. | |||
nobody was harmed :) | |||
llfourn | @dirs.map(*.&get-dirs(:$d)) # should do it | 03:47 | |
03:51
mcmillhj joined
|
|||
samcv | ok turns out it wasn't passing in :$d | 03:55 | |
doing it like that... | |||
or something @dirs.map({ get-dirs($_; :$d) } ) # Unexpected named argument 'd' passed wtf | |||
llfourn | ^ err was that smicolon meant to be there? | 03:56 | |
03:56
mcmillhj left
|
|||
samcv | yes | 03:56 | |
llfourn | why? | ||
samcv | sorry uploading new version | ||
ok check again | |||
because i'm using named arguments | 03:57 | ||
llfourn | hmm | ||
I seem to remember something vaguely about semicolons and named arguments | |||
samcv | oh crap i used a semicolon | 03:58 | |
sorry i misread semicolon as colon | |||
llfourn | lol | ||
samcv | haha | ||
i'm going blind! | |||
llfourn | that is an LTA error though | ||
but there is some kind of semicolon in pararmeter list syntax | |||
samcv | yeah | ||
03:58
mr-foobar left
04:00
mcmillhj joined
|
|||
samcv | well it seems to work | 04:00 | |
04:01
mr-foobar joined
|
|||
samcv | i get 32326 directories with find and 32414 with perl 6 | 04:01 | |
not sure why it's different | 04:02 | ||
at least find returns one '.' but that would make find have one more directory | |||
llfourn | maybe sort and diff the output | 04:03 | |
samcv | this liessss | 04:05 | |
docs.perl6.org/routine/flatmap#(Li...od_flatmap the docs page for flatmap | |||
"invokes uc four times." untrue! | |||
m: say ((1, 2), <a b>).flatmap({ $a++; uc($_)}).perl; say $a | 04:06 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$a' is not declared at <tmp>:1 ------> 3say ((1, 2), <a b>).flatmap({ 7⏏5$a++; uc($_)}).perl; say $a |
||
samcv | m: my $a = 0; say ((1, 2), <a b>).flatmap({ $a++; uc($_)}).perl; say $a | ||
camelia | ("1 2", "A B").Seq 2 |
||
llfourn | yep that's wrong | ||
samcv | map runs 4 times | 04:07 | |
flatmap doesn't | |||
also both have the same output | |||
llfourn | flatmap just does .map then .flat | ||
samcv | so it's the worst example ever | ||
llfourn | yeah .flatmap is considered harmful | ||
samcv | oh wait nvm | ||
i forgot to reset the value of $a. both of them still do it twice | |||
llfourn | samcv: lol, github.com/perl6/doc/issues/851 | ||
samcv | and both have the same output. map or flatmap | 04:08 | |
for the love of god someone do something! | |||
llfourn | haha | ||
samcv panics and runs around screaming | |||
Voldenet | > sub get-dirs (IO::Path:D $path) { flat gather for $path.dir.grep(*.d) { take $_, get-dirs($_) }} | ||
it's ugly, but it works | |||
samcv | smls opened this issue on Aug 21, 2016 | ||
not that ugly | 04:09 | ||
i wonder how it is speedwise | |||
04:09
mcmillhj left
|
|||
llfourn | I've never actually gather take | 04:09 | |
always do map/grep | |||
actually used* | 04:10 | ||
samcv | it is kinda nice if you want a sequence | ||
and not all at once | |||
Voldenet | gather take is supposed to be lighter on memory if I reason correctly | 04:11 | |
04:11
Cabanossi left
|
|||
llfourn | doesn't map grep produce a lazy seq anyway? | 04:11 | |
or do I have to put lazy in front | 04:12 | ||
04:12
kyan joined
04:13
Cabanossi joined
04:19
khw left
|
|||
Voldenet | Hm, I believe map grep do produce lazy seq when you give them lazy seq | 04:23 | |
04:27
wamba joined
|
|||
BenGoldberg | m: dd map *, grep {1}, ^10; | 04:28 | |
camelia | Cannot resolve caller map(Whatever, Seq); none of these signatures match: (&code, + is raw) in block <unit> at <tmp> line 1 |
||
llfourn | m: my $a = (^10).map: { .say }; # only runs if it's sunk | ||
camelia | ( no output ) | ||
BenGoldberg | m: dd map {$_}, grep {1}, ^10; | ||
camelia | (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).Seq | ||
BenGoldberg | m: dd map {say}, grep {1}, ^10; | 04:29 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unsupported use of bare "say"; in Perl 6 please use .say if you meant to call it as a method on $_, or use an explicit invocant or argument, or use &say to refer to the function as a noun at <tmp>:1 --… |
||
BenGoldberg | m: dd map {.say}, grep {1}, ^10; | ||
camelia | 0 1 2 3 4 5 6 7 8 9 (Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True).Seq |
||
llfourn | m: my @a = (^10).map: { .say }; # if it's assigned it probably runs too | ||
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
BenGoldberg | m: my $nosink := map {.say}, grep {1}, ^10; say 'hmm'; | ||
camelia | hmm | ||
BenGoldberg | m: my $nosink := map {.say}, grep {1}, ^10; say 'hmm'; say $nosink.perl | ||
camelia | hmm 0 1 2 3 4 5 6 7 8 9 (Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True).Seq |
||
llfourn | m: my @a = lazy (^10).map: { .say }; # but if you put lazy it shouldn't | ||
camelia | ( no output ) | ||
Voldenet | my $nosink = map {.say}, grep {1}, ^10; say $nosink.take(5) | 04:32 | |
m: my $nosink = map {.say}, grep {1}, ^10; say $nosink.take(5) | |||
camelia | Too many positionals passed; expected 1 argument but got 2 in block <unit> at <tmp> line 1 |
||
Voldenet | erm | 04:33 | |
m: my $nosink = map {.say}, grep {1}, ^10; say $nosink.head(5); | |||
camelia | 0 1 2 3 4 (True True True True True) |
||
04:36
mcmillhj joined
|
|||
Voldenet | in fact | 04:38 | |
sub get-dirs (IO::Path:D $path) { $path.dir.grep(*.d).deepmap: { $_, get-dirs($_) } } | |||
that would be even better way to do this :D | |||
llfourn | isn't deepmap pointless because dir is only going to give you a an array of paths? | 04:44 | |
04:44
mcmillhj left
04:47
mcmillhj joined
04:48
raiph joined
|
|||
Voldenet | hm, get-dirs gives you a lazy sequence of a dir, so deepmap would give you a sequence representing a directories tree | 04:48 | |
m: sub get-dirs (IO::Path:D $path) { $path.dir.grep(*.d).deepmap({$_, get-dirs($_)}).flat }; say get-dirs(".".IO).elems | 04:50 | ||
camelia | Type check failed in binding to parameter '$path'; expected IO::Path but got IO::Path.new(".", :SP... in sub get-dirs at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
04:51
mcmillhj left
|
|||
Voldenet | It works on my box, I guess "no fun allowed" anymore :P | 04:53 | |
04:53
troys_ is now known as troys
04:57
Cabanossi left
04:58
Cabanossi joined
|
|||
samcv | ok i'm fi xing flatmap docs right now | 05:00 | |
Geth | doc: b90d2f82c6 | (Samantha McVey)++ | doc/Type/List.pod6 Provide correct documentation for .flatmap The previous example's explanation was wrong, and the example had the same result on both .map and .flatmap, making it an even more confusing function. The documentation now strongly recommends use of .map.flat and recommends to instead using the confusing .flatmap Fixes issue #851. |
05:02 | |
samcv | that bug was so old :( | ||
05:03
mcmillhj joined
|
|||
samcv | sad! | 05:03 | |
05:03
troys left
|
|||
llfourn | samcv++ | 05:05 | |
samcv | i just solved world hunger | ||
ok maybe nothing that important | |||
but i feel happy about it | |||
ugexe | m: my $files = -> $p = $*CWD { $p.f ?? $p !! dir($p)>>.&?BLOCK.Slip }; say $files().map(*.parent).unique; | ||
camelia | Failed to get the directory contents of '/home/camelia/.local/share/systemd/user': Failed to open dir: 2 in block <unit> at <tmp> line 1 |
||
05:06
wamba left
05:07
mcmillhj left
|
|||
Voldenet | uh, getting a list of files and then doing .map(*parent).unique is a very unique way of doing this :) | 05:13 | |
05:17
pilne left
05:18
roguelazer joined,
mcmillhj joined
|
|||
Geth | doc: 286e135bac | (Samantha McVey)++ | doc/Type/Hash.pod6 Be more clear about %() being preferred to { } for hash creation Work on fixing #1380 In addition to more highly recommending %(), we also use less text and make the examples of the pitfalls more clear. |
05:19 | |
samcv | this also makes me happier too | ||
BenGoldberg | I would have, instead of 'To assign to a variable without the C<%> sigil', 'To assign a hash to a variable which does not have the C<%> sigil' | 05:23 | |
05:23
mcmillhj left
|
|||
samcv | isn't that the same thing? | 05:24 | |
BenGoldberg | Also, s/Instead, you should use/This would have been avoided if you had used/. | ||
samcv | which does not vs without | ||
does not have vs without | |||
BenGoldberg | Well, it's almost the same thing, except we're still using a %, just on the right side of the = instead of the left. | 05:25 | |
Voldenet | ugexe: apparently calling unique on IO doesn't work all that well on my system, but calling it on *.parent.Str works | ||
samcv | Voldenet, did you sort them with eqv? | 05:26 | |
.sort(&[eqv]).unique | 05:27 | ||
05:29
mr-foobar left
05:31
mr-foobar joined
|
|||
Voldenet | .unique(:with(&[eqv])) kind of works, but it's slow | 05:31 | |
samcv | kind of works? or works but slowly | ||
samcv wonders if we have an eqv candidate for IO::Path | 05:32 | ||
Voldenet | It works, but it's incredibly slow | ||
this takes a blink of an eye > .map(*.parent.Str).unique; | 05:33 | ||
this takes longer than 10s > .map(*.parent).unique(:with(&[eqv])) | |||
samcv | yeah i know it is slow :P | ||
Voldenet | Ah, /eqv/ might not be the operator I was wanting to use | 05:34 | |
samcv | and does .sort not work? | ||
Voldenet | Nope, see for yourself: my $files = -> $p = $*CWD { $p.f ?? $p !! dir($p)>>.&?BLOCK.Slip }; .say for $files().map(*.parent).sort.unique; | ||
05:34
mcmillhj joined
|
|||
samcv | oh you're running unique without sort? does th't work? | 05:34 | |
Voldenet | The set is pretty much sorted anyway, so there's no need to sort it again :) | 05:35 | |
samcv | that doesn't work for me | ||
well i don't think unique even works if thigs are not sorted.. | 05:36 | ||
ah maybe i'm wrong | |||
that doesn't even run that is | 05:37 | ||
Voldenet | It seems that .unique works right on Str | ||
samcv | Failed to get the directory contents of '/home/samantha/git/rakudo/.nav-marker-rules': Failed to open dir: 2 | 05:38 | |
timotimo | i'd expect unique to work with .WHICH | ||
samcv | why? | ||
well it does call WHICH | 05:39 | ||
ah yeah cause it literally is checking if they're the same object period | |||
but it doesn't work if you have two thinsg which are different objects but have the same contents | 05:40 | ||
unless it's a Str | |||
and prolly an Int | |||
or Rat | |||
other things no | |||
05:40
mcmillhj left
|
|||
samcv | m: say dir[0].WHICH | 05:40 | |
camelia | IO::Path|60080000 | ||
timotimo | you could of course implement "unique" based on eqv | 05:41 | |
samcv | m: say dir[0].WHICH; say dir[0].WHICH | ||
camelia | IO::Path|43442208 IO::Path|43442288 |
||
timotimo | but that'll blow up run time quadratically | ||
samcv | er maybe you want unique with cmp? | 05:42 | |
or uh. would eqv work? since uh. it only gives True or False | |||
usually you implement unique by sorting and then removing duplicates next to each other | |||
timotimo | you'd have to eqv the new element with every existing element | ||
samcv | yeah | ||
Voldenet | with IO::Path .unique(:as(*.Str)) would work reasonably well | ||
timotimo | that'd be faster, yeah | 05:43 | |
though not everything you can eqv you can cmp | |||
samcv | yep | ||
Voldenet, that won't work if the CWD is different i would guess right? | |||
Voldenet | Yeah. | ||
timotimo | yeah, it'd have to be :as(*.absolute) | ||
05:44
xtreak joined
|
|||
Voldenet | well, I'd still rather use: sub get-dirs (IO::Path:D $path) { $path.dir.grep(*.d).deepmap({$_, get-dirs($_)}).flat } | 05:44 | |
samcv | well that won't find unique paths on/ly ones that refer to the same thing | ||
since paths store more info than that | |||
that cuold cause weird bugs? depending? | |||
not sure | |||
maybe if you use .Str ever | 05:45 | ||
i've never used deepmap hm | |||
how does it differ from map | |||
Voldenet | it's invoked on subsequences as well | 05:46 | |
and since get-dirs returns a sequence, the map would invoke it recursively | 05:47 | ||
samcv | map works for sub arrays but not subsequences or what? i've never tried to go very deep | 05:48 | |
Voldenet | m: (1, (2, 3), 4).map({ .say; *+1 }) | 05:50 | |
camelia | 1 (2 3) 4 |
||
Voldenet | m: (1, (2, 3), 4).map({ .say; $_ + 1 }).say | ||
camelia | 1 (2 3) 4 (2 3 5) |
||
Voldenet | not what I'd expect | ||
m: (1, (2, 3), 4).deepmap({ .say; $_ + 1 }).say | |||
camelia | 1 2 3 4 (2 (3 4) 5) |
||
Voldenet | better :) | ||
m: (1, ^5, (2, 3), 4).deepmap({ $_ + 1 }).say | 05:51 | ||
camelia | (2 (1 2 3 4 5) (3 4) 5) | ||
05:53
travis-ci joined
|
|||
travis-ci | Doc build errored. Samantha McVey 'Provide correct documentation for .flatmap | 05:53 | |
travis-ci.org/perl6/doc/builds/246458765 github.com/perl6/doc/compare/7d9e8...0d2f82c6ff | |||
05:53
travis-ci left
05:56
mr-fooba_ joined,
Cabanossi left
05:57
mr-foobar left
05:59
Cabanossi joined,
xtreak_ joined
06:02
xtreak left
|
|||
ugexe | m: (1, (^5), ((4,5),), 6).tree(*.self, *.reverse, *.sum).say | 06:04 | |
camelia | (1 (4 3 2 1 0) (9) 6) | ||
Voldenet | what does .tree do? | 06:05 | |
ugexe | m: (1,(2,3),4).tree(*.self, *.reverse).say; (1,(2,3),4).tree(*.reverse, *.self).say | 06:06 | |
camelia | (1 (3 2) 4) (4 (2 3) 1) |
||
ugexe | m: (1,(2,3),(4,(5,6))).tree(*.self, *.self, *.reverse).say; | 06:07 | |
camelia | (1 (2 3) (4 (6 5))) | ||
06:09
travis-ci joined
|
|||
travis-ci | Doc build errored. Samantha McVey 'Be more clear about %() being preferred to { } for hash creation | 06:09 | |
travis-ci.org/perl6/doc/builds/246461571 github.com/perl6/doc/compare/b90d2...6e135bac9d | |||
06:09
travis-ci left,
nbrown joined
|
|||
samcv | ahh go away travis | 06:09 | |
travis is a big meanie. won't even finish building | 06:11 | ||
though! the cache did work | |||
we need one build that does highlighting and one that doesn't i think | 06:13 | ||
but i don't have time for that today | |||
06:15
domidumont joined
06:19
tony-o joined
06:21
domidumont left,
domidumont joined
06:24
mr-fooba_ left
06:25
parv joined
06:28
MasterDuke left
06:32
domidumont left
06:33
domidumont joined
06:38
mr-foobar joined
06:42
jamesaxl joined
|
|||
jamesaxl | hi | 06:42 | |
mst: do you use perl 6? | |||
TEttinger | from what I understand, mst uses some of every language ever comprised. ever heard of Kernel? | 06:43 | |
jamesaxl | TEttinger: I think that he does not use anything | 06:45 | |
TEttinger: how about you? | 06:46 | ||
TEttinger | I do not use perl 6. | 06:47 | |
jamesaxl | TEttinger: only perl5? | ||
TEttinger | I can write a teensy bit of very simple perl6. my perl5 is limited to regexes. | 06:48 | |
I'm interested in how perl6's grammars work | |||
I think they are an elegant way of constructing DSLs | |||
jamesaxl | TEttinger: do you think that perl6 can be good in the future? | 06:50 | |
TEttinger | yes. | ||
I think there are speed issues holding it back currently, but that's addressable by MOAR VM improvements | 06:51 | ||
I think the language itself is phenomenally complex and this makes it hard to attract users | 06:52 | ||
that said, C++ has tons of users and is a very complex language, probably just as much or more so than perl6 | |||
things like junctions are brilliant for describing what you mean rather than building complex if-else statements | 06:53 | ||
jamesaxl | TEttinger: and how about modules, I see that perl6 lacks to very important modules. | ||
TEttinger | yeah it lacks tons, but Inline::Perl5 makes it apparently very easy to call perl5 code | 06:54 | |
06:55
domidumont left
|
|||
jamesaxl | TEttinger: And how can I share modules of perl6 (I meant my modules)? | 06:57 | |
TEttinger | I do not use perl 6. but I think CPAN is in the process of changing to accept perl6 as well as perl5 | 06:58 | |
nine | TEttinger: it already does | ||
TEttinger | I yield the floor to nine | 06:59 | |
jamesaxl | nine: can I upload it use pause? | 07:00 | |
nine | jamesaxl: indeed, you can :) | ||
You can use mi6 (App::Mi6) for added convenience | 07:01 | ||
jamesaxl | that is nice | 07:03 | |
nine | zef will find the distro about half an hour or an hour later. The only bit that's missing to my knowledge is listing the module on modules.perl6.org | ||
BenGoldberg | m: package Foo { our proto bar(|) {*}; our multi bar(Int) { 'int' } }; dd Foo::bar(42); | 07:08 | |
camelia | "int" | ||
BenGoldberg wonders if that's considered a bug. | |||
nine | Why would it? | 07:09 | |
BenGoldberg | m: package Foo { our proto bar(|) {*}; my multi bar(Int) { 'int' } }; dd Foo::bar(42); | ||
camelia | "int" | ||
BenGoldberg pasted the wrong version. | |||
The 'my' is basically ignored. | 07:10 | ||
nine | BenGoldberg: it's not: | 07:13 | |
m: package Foo { our proto bar(|) {*}; { my multi bar(Int) { 'int' } } }; dd Foo::bar(42); | |||
camelia | Cannot resolve caller bar(Int); Routine does not have any candidates. Is only the proto defined? in block <unit> at <tmp> line 1 |
||
nine | Foo::bar(42) conceptually calls the proto bar(|) which then calls the appropriate candidate which it does find in it's lexical scope | 07:14 | |
07:16
mr-foobar left
07:23
bwisti left,
mr-foobar joined
07:24
llfourn_ joined,
llfourn left
07:26
BenGoldberg left,
unclechu left,
xui_nya[m] left
07:29
xui_nya[m] joined,
unclechu joined
07:32
domidumont joined
07:34
zapwai left
07:39
skids left
07:44
domidumont left
07:45
setty1 joined
07:56
xtreak joined
07:57
xtreak__ joined
07:59
xtreak_ left
08:01
xtreak left
08:08
rindolf joined
08:17
parv left
08:26
darutoko joined
08:27
setty1 left
|
|||
Geth | ecosystem: d5e94b9211 | (Martin Barth)++ (committed using GitHub Web editor) | META.list Added HTTP-Server-Orgre Added HTTP-Server-Ogre - just another p6w http server |
08:30 | |
08:30
ufobat joined
08:36
parv joined
08:42
LeCamarade joined
09:06
xtreak joined
09:10
xtreak__ left
09:11
xtreak_ joined
09:14
parv left,
xtreak left
09:16
ufobat left
09:25
ufobat joined
09:30
lizmat left
09:33
seatek joined
09:37
xtreak_ left,
lizmat joined
09:38
ufobat left
09:41
xtreak joined
09:49
parv joined
09:55
TEttinger left,
parv left
09:56
xtreak left
10:12
MARTIMM joined
10:30
jamesaxl left
10:32
jamesaxl joined
10:36
MARTIMM left
10:45
Sense8 joined
10:47
Sense8 left
11:00
lizmat left
11:05
nhywyll joined,
nhywyll left
11:06
lizmat joined
11:13
setty1 joined
11:17
nhywyll joined,
nhywyll left
11:28
nhywyll joined,
nhywyll left
11:41
nhywyll joined,
nhywyll left
11:46
MasterDuke joined
11:48
AlexDaniel joined
11:49
grondilu left
12:24
robertle joined
12:28
domidumont joined
12:29
kaare_ left
12:40
cpage_ left
12:42
Cabanossi left
12:45
ufobat joined
12:46
Cabanossi joined
12:48
ufobat left
12:57
domidumont left,
nbrown left
13:00
lucasb joined
13:12
domidumont joined,
Cabanossi left
13:16
Cabanossi joined
13:24
user3 joined
|
|||
user3 | why do I have to put a 'my' here 'my Str sub f() {}' while it's not needed in this one 'sub f() of Str {}' | 13:24 | |
13:27
pilne joined,
wamba joined
|
|||
masak | user3: that question does not seem to make sense out of the context you're in but have not stated | 13:31 | |
oh wait, maybe it does | |||
user3: I think the simple answer is "because if you want to specify a type like 'Str', you have to front with a declarator keyword" | 13:32 | ||
whether you make that keyword `my`, or `our`, or `has` or something else, is up to you | |||
masak loses today's Oxford Comma nomination | 13:33 | ||
user3 | k | ||
masak | user3: the same answer, but phrased differently, would be "a type like `Str` cannot front a declaration statement like `sub`" | 13:34 | |
user3 | yes, i understand the logic of it | ||
thx | |||
masak | pzh | ||
moritz | or from a different point of view: If it's not part of a declaration, a type name like Str is a term, so the parser expects an operator after it | ||
masak | oh, right | 13:38 | |
which makes for a nice contrast with e.g. Java, where type names and ordinary terms live in different namespaces | 13:39 | ||
so in Perl 6, the "cost" of the tradeoff is that you need to do `my Str` or `our Str` etc. at the start of declarations | |||
user3 | its a good bargain | ||
masak | whereas in Java, it's that you need to do `MyType.class` (to bring a type term from type land to term land) instead of just `MyType` | 13:40 | |
and it also makes `instanceof` a slightly magical operator :) | 13:41 | ||
(because it has to tell the parser, "hey, the rhs is a type, not a term") | |||
13:44
domidumont left
13:53
cpage_ joined
13:55
user3 left
14:02
BenGoldberg joined
14:04
bwisti joined
14:10
itaylor57 left
14:19
mscha joined
|
|||
mscha | m: my $p = start { for 1..5 { .say; sleep 1; } }; sleep 2; $p.break; | 14:19 | |
camelia | 1 2 3 Access denied to keep/break this Promise; already vowed in block <unit> at <tmp> line 1 |
||
mscha | How do I break a promise (from the “outside”)? | ||
mst | POSIX::_exit(255); # all promises are now broken | 14:26 | |
TimToady | mst: you can't break a promise unless the inside grants you access to the "vow" | ||
mscha | But what if I don't want to exit, just kill that promise? | ||
TimToady | that's by design | 14:27 | |
mscha | So in my case, once that promise is running, there's no way to stop it (except by exiting)? | ||
TimToady | I suppose it depends on where the inside put its vow? | ||
if it's in an object attribute you can get at it sneakily... | 14:28 | ||
mscha | I tried $p.vow.break, but it wouldn't let me either. | ||
m: my $p = start { for 1..5 { .say; sleep 1; } }; sleep 2; $p.vow.break; | |||
camelia | 1 2 3 Access denied to keep/break this Promise; already vowed in block <unit> at <tmp> line 1 |
14:29 | |
14:29
khw joined
|
|||
mst | TimToady: how does the inside of the start block gets its vow? | 14:30 | |
TimToady doesn't remember | |||
TimToady doesn't break many vows... | 14:31 | ||
the tests use Promise.new rather than start, so maybe start is doing something weird | 14:35 | ||
MasterDuke | docs.perl6.org/type/Promise#method_break mentions that using e.g., start, means you can't break it, so use Promise.new if you want to | 14:37 | |
mscha | But if you don't use start, how do you (asynchronously) run code? | 14:39 | |
TimToady | apparently start keeps its vow private, but if you can get the code to throw an exception, it'll break | 14:40 | |
you can always Promise.new yourself | |||
look at method start in src/core/Promise.pm | 14:41 | ||
TimToady heads for DCA, LAX, SJC... | 14:43 | ||
mscha | Hmm, okay, so looks like I can't do that - breaking a promise from the “outside” when the code in the promise is already running. | 14:46 | |
14:46
Ven joined
14:47
Ven is now known as Guest80266
14:48
Guest80266 left
14:51
nhywyll joined
14:54
skids joined
14:56
lucasb left
15:04
wamba left
15:10
davido_ joined
15:14
reino4477 joined
|
|||
reino4477 | hey, has anybody created a web app in Perl 6 recently? | 15:15 | |
15:15
kyan left
|
|||
reino4477 | i'm trying to understand if its eco system is ready more or less so I can use it for building web apps for myself | 15:16 | |
15:16
davido_ left
|
|||
AlexDaniel | reino4477: I think it depends | 15:17 | |
15:18
davido_ joined
|
|||
reino4477 | www.reddit.com/r/perl6/comments/6j...ment_what/ | 15:19 | |
MasterDuke | reino4477: Gabor Szabo is working on a book about it www.indiegogo.com/projects/book-we...bsite--2#/ | 15:22 | |
jnthn | fwiw, start and Promise are only related in that start blocks evaluates to a Promise. The start implementation looks something like sub start(&foo) { my $p = Promise.new; my $v = $p.vow; $*SCHEDULER.cue: { $v.keep(foo()); }, :catch({ $v.break($_) }); return $p } | ||
15:23
reino4477 left
|
|||
jnthn | Thus the vow is taken by start and kept with the result or broken if it throws an exception | 15:24 | |
15:24
davido_ left,
domidumont joined
|
|||
jnthn | I don't really get why you'd want to break the Promise from the outside, though. It's not like doing that would cancel the code runing in the Promise, or even prevent it from being schedulered if it wasn't already running. | 15:25 | |
It'd just result in it exploding with a "already kept/broke this Promise" at the end | |||
So I guess "what are you trying to achieve" is the righter question :) | |||
15:27
davido_ joined
15:28
kyan joined
15:44
skids left
15:48
Ven joined
15:49
k-man left,
Ven is now known as Guest44526
15:51
kaare_ joined
15:52
nhywyll left,
abraxxa joined
|
|||
abraxxa | I just built 2017.06 and now use v6c; isn't working any more | 15:53 | |
when I change it to use v6.c; it works again, did I miss a change there? | |||
15:55
lollercopter joined
|
|||
lollercopter | abraxxa: it worked only because of a bug. The right thing is v6.c | 15:56 | |
15:56
k-man joined
|
|||
abraxxa | lollercopter: I guessed so, thanks! | 15:56 | |
lollercopter | c: 2017.05 my str $x = '6c'; my num $y = $x; say $y | ||
committable6 | lollercopter, ¦2017.05: «6» | ||
lollercopter | c: 2017.06 my str $x = '6c'; my num $y = $x; say $y | ||
committable6 | lollercopter, ¦2017.06: «Can't convert '6c' to num: trailing characters in block <unit> at /tmp/inMsBbqJbY line 1 «exit code = 1»» | ||
lollercopter | ^ that's the bug that got fixed | 15:57 | |
abraxxa | do the release notes mention that somewhere? I couldn't find it | ||
15:58
davido_ left
|
|||
lollercopter | hm | 15:58 | |
m: dd v6c | |||
camelia | v6.c | ||
lollercopter | abraxxa: OK, nevermind, it's a new bug :D since v6c works a version literal for v6.c, it should work in `use` too, I think | 15:59 | |
abraxxa: no, release notes don't mention it | |||
16:00
kaare_ left
|
|||
abraxxa | ok | 16:00 | |
lollercopter | I can fix it... | 16:01 | |
16:02
kaare_ joined
|
|||
abraxxa | lollercopter++ | 16:04 | |
ugexe | i couldn't think `use v6c;` should work... | 16:22 | |
wouldnt^ | |||
lollercopter | ugexe: why not? | 16:23 | |
16:24
dotness joined
|
|||
ugexe | m: say v6c cmp v6.c; # i guess it depends on how you fe |