»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
lucasb REMINDER to *Advent of Code* players: Join the Perl6ers leaderboard! The code is 169430-b1c331b2 00:01
Next task opens in 5 hours. I'll be asleep by then. Good luck! :) 00:02
mornfall marcoonroad: there's a profiler (--profile), so that could be a good start (it's not exactly cheap though)
Kaiepi travis-ci.org/Kaiepi/p6-Net-Telnet.../450655537 00:03
why would the connection be closed before anything closes it? there aren't any race conditions in my code afaik 00:04
i've only ever seen this happen on mac 00:06
mornfall it's the '18 not ok' what you mean?
Kaiepi yeah 00:07
buggable New CPAN upload: Terminal-Spinners-1.3.0.tar.gz by RYNIX modules.perl6.org/dist/Terminal::Sp...cpan:RYNIX
Kaiepi waaait a minute 00:08
never mind there is a race condition lol
good thing it's just in the test file 00:10
mornfall yeah, the $client.close can happen any time 00:11
(with respect to the checks)
async is hard, even though the language support is pretty okay 00:12
also that sleep :p 00:14
Kaiepi yeah, that sometimes fails on mac for whatever reason 00:15
mornfall (makes you wonder whether 'closed' shouldn't rather be a supply...)
(or perhaps a promise, that'd make more sense?) 00:17
Kaiepi i'll try that out once i fix the other issue with the test
mornfall which other issue? 00:18
Kaiepi the race condition with .close
mornfall well, making .closed a promise is a fix for that? 00:19
SmokeMachine marcoonroad: I don’t know about test coverage... but you told about fuzzy test... there is it: github.com/FCO/Test-Fuzz
mornfall the race is going to be really hard to fix otherwise?
you'll have to make an auxilliary promise for the test, i guess
(so instead of $client.close, you say fulfill a $can-close, and await that and then close?) 00:20
00:21 MasterDuke joined, p6bannerbot sets mode: +v MasterDuke, MasterDuke left, MasterDuke joined, herbert.freenode.net sets mode: +v MasterDuke, p6bannerbot sets mode: +v MasterDuke
Kaiepi ohh 00:22
MasterDuke coverable6: HEAD say 123.is-prime
coverable6 MasterDuke, ¦HEAD(38bc682): «False␤»
00:22 atweiden-air joined 00:23 p6bannerbot sets mode: +v atweiden-air
Kaiepi yeah i'm used to node, where i'd be able to get away with making .closed just a straight Boolean without any issues unless libuv interferes 00:24
MasterDuke marcoonroad: hm, not sure what's up with the bot (it should link to a gist of the coverage log), but there are the MVM_COVERAGE_LOG and MVM_COVERAGE_CONTROL env vars you could play with
mornfall i know nothing about node... is it single-threaded with explicit coroutines?
00:24 w_richard_w left
Kaiepi it's single threaded apart from io stuff, which is handled under the hood 00:25
the async stuff is handled in one thread on the event loop
mornfall io stuff is done in the typical async fashion, no?
like python asyncio
that's the whole point of libuv, anyway
IO event loops
and lots of trampolining around :) 00:26
Kaiepi i've never used asyncio in python
you write the io stuff like you would anything else in node, but the async stuff is handled in the background
00:26 w_richard_w joined
mornfall asyncio runs in a single thread too, and your code can only be interrupted at an 'await' 00:26
Kaiepi ohh
in node it's done through callbacks instead of promises 00:27
mornfall eww
Kaiepi yeah it's really easy to write spaghetti in node
00:27 p6bannerbot sets mode: +v w_richard_w
mornfall the so-called 'native coroutines' in python (what you are supposed to use with asyncio) are kinda crippled, but they are a hell lot better than a callback hell 00:29
(they only thing they can do is 'await' another native coroutine... the only way to actually yield is to call one of the asyncio/event-loop provided methods, which jump down to the event loop trampoline and other 'threads' get to run) 00:31
(the good thing about this is that you don't run into race conditions nearly as easily... the bad thing is that you can only use one core to run the program)
marcoonroad nodejs runs blocking io (io unable to be async) in another thread, but it is in far rare cases, i dunno. it means that node is not single threaded, but double-threaded depending on the sort of OS interaction which you perform 00:33
i work with nodejs on my daily job, and sometimes when dependencies break due updates, it makes me not much happy in such times 00:35
mornfall i wouldn't expect any modern system to mandate blocking io on anything... perhaps calls into C modules would be handled that way though?
marcoonroad the ideal place to call c modules is in another process. this is how they perform unit tests on c, and this is erlang/elixir work with c bindings while maintaining fault-tolerance. you know, segmentation faul$62272##@*? 00:36
thanks SmokeMachine and MasterDuke o/ 00:38
SmokeMachine I think test coverage could be done with `trace` 00:41
00:42 lichtkind left
SmokeMachine There are no documentation for trace?! Os it called trace? 00:43
00:43 sena_kun left
MasterDuke samcv++ i think has automated some coverage reports for the nqp tests 00:43
SmokeMachine *is
m: use trace; my $a = 1; $a++; say $a 00:44
camelia 2 (<tmp> line 1)
my $a = 1
2
3 (<tmp> line 1)
$a++
4 (<tmp> line 1)
say $a
00:49 qiqi joined, p6bannerbot sets mode: +v qiqi 00:55 atweiden-air left
MasterDuke SmokeMachine: some suggested edits here gist.github.com/MasterDuke17/919f3...85bbe4bb00 00:59
01:03 qiqi left 01:15 sno left
SmokeMachine MasterDuke: Thanks! Fixing it! 01:23
01:25 sno joined, p6bannerbot sets mode: +v sno 01:30 sno left 01:31 sno joined 01:32 p6bannerbot sets mode: +v sno 01:33 cpage_ joined 01:34 coet left, p6bannerbot sets mode: +v cpage_ 01:35 cpage left, cpage_ is now known as cpage 01:37 leont left 01:56 kurahaupo_ joined 01:57 p6bannerbot sets mode: +v kurahaupo_ 01:59 kurahaupo left 02:01 MasterDuke left, kurahaupo_ left 02:03 isantop joined, p6bannerbot sets mode: +v isantop 02:04 isantop left 02:10 qiqi joined 02:11 p6bannerbot sets mode: +v qiqi
SmokeMachine perl6advent.wordpress.com/?p=7148&...eview=true 02:12
.tell MasterDuke thank you very much!
yoleaux SmokeMachine: I'll pass your message to MasterDuke.
02:23 tmtvl left
timotimo marcoonroad: if you're still interested in coverage, you can check the env var for moarvm MVM_COVERAGE_LOG 02:25
moar --help for the win 02:26
marcoonroad it would fit better as moar --sos :) 02:28
timotimo it's often super annoying to get a commandline argument to moar and at the same time run a perl6 script 02:32
02:42 molaf left 02:55 molaf joined, p6bannerbot sets mode: +v molaf
SmokeMachine pmurias and the guy from WebPerl are doing a wonderful job!!! Take a look what is possible to do now with perl6 and WebPerl: fco.github.io/MemoizedDOM/todo6.html 03:01
03:05 kurahaupo joined 03:06 p6bannerbot sets mode: +v kurahaupo 03:10 Khisanth left
marcoonroad i have 13 simple tests and such moar coverage log append file contains 377mb (i'm erasing before any coverage to avoid appending over existing data). is there any way to visualize such data, e.g, by charts? 03:11
03:13 mtj_ joined
marcoonroad after piping through uniq cmd, now it contains 128mb 03:14
03:14 p6bannerbot sets mode: +v mtj_
SmokeMachine .tell jmerelo very good post! Congratulations? 03:14
yoleaux SmokeMachine: I'll pass your message to jmerelo.
marcoonroad hooray. after running grep cmd to filter my project directory, it only contains 228kb! 03:17
03:20 kurahaupo left 03:22 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 03:23 qiqi left, Khisanth joined 03:24 p6bannerbot sets mode: +v Khisanth 03:26 marcoonroad left, sacomo left 03:28 sacomo joined, p6bannerbot sets mode: +v sacomo 03:33 kurahaupo left 03:37 sacomo left
Geth doc: 575733bc80 | (Joelle Maslak)++ | doc/Type/DateTime.pod6
Correct DateTime.posix argument type
03:53
synopsebot_ Link: doc.perl6.org/type/DateTime
03:55 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 03:56 kurahaupo_ joined 03:57 p6bannerbot sets mode: +v kurahaupo_
Geth doc: 709fb3946b | (Joelle Maslak)++ | doc/Type/DateTime.pod6
Document DateTime.posix $ignore-timezone argument
03:57
synopsebot_ Link: doc.perl6.org/type/DateTime
03:59 kurahaupo left 04:00 kurahaupo_ left
Summertime [1,2,3].combinations(2).map({two-arg-function(|$_)}); 04:01
is there a cleaner way of doing this?
timotimo yes 04:03
oh 04:04
is it acceptable to redefine two-arg-function %)
04:04 kurahaupo_ joined, w_richard_w left 04:05 p6bannerbot sets mode: +v kurahaupo_
Summertime I'm gonna say noish 04:05
timotimo i don't think i have a good idea for something better than what you have :o
hm.
04:05 sacomo joined
timotimo m: sub taf($a, $b) { say "$a and $b!" }; [1, 2, 3].combinations(2)>>.&taf 04:05
camelia Too few positionals passed; expected 2 arguments but got 1
in sub taf at <tmp> line 1
in block <unit> at <tmp> line 1
timotimo nope.
however 04:06
m: sub taf($a, $b) { say "$a and $b!" }; [1, 2, 3].combinations(2).flat.map(&taf)
camelia 1 and 2!
1 and 3!
2 and 3!
timotimo that does work!
04:06 p6bannerbot sets mode: +v sacomo, kurahaupo joined
Summertime ah right, it pulls number of args at a time doesn't it 04:06
timotimo that's the issue, yeah
04:07 p6bannerbot sets mode: +v kurahaupo
Summertime I still wish I could just do something like, taf(|*) though, alas 04:07
timotimo yeah, whatevercode doesn't autoclose across parameter lists 04:08
because otherwise you wouldn't be able to use it for much at all :D
04:09 kurahaupo_ left, kurahaupo left, kurahaupo_ joined 04:10 p6bannerbot sets mode: +v kurahaupo_
Summertime >>.Slip.map(&taf), I was hoping the hyper.Slip issue would allow it to expand later in the call to taf, but didn't work, darn 04:11
04:11 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 04:13 kurahaupo_ left 04:14 kurahaupo_ joined 04:15 p6bannerbot sets mode: +v kurahaupo_, kurahaupo left 04:16 hythm_ joined, p6bannerbot sets mode: +v hythm_ 04:21 Chocobozzz25 joined 04:22 p6bannerbot sets mode: +v Chocobozzz25
hythm_ Hi, I'm writing a package manager in perl 6, and I'm stuck in an issue for few weeks, it's package-dependencies data-structure issue. The details are in this question: stackoverflow.com/questions/535481...-traversal I would appreciate any suggestion that i can move forward and get passed the issue. Thank you 04:24
04:26 Chocobozzz25 left 04:42 avuserow joined 04:43 p6bannerbot sets mode: +v avuserow 04:46 hythm_ left 04:49 Cabanossi joined, Cabanoss- left, p6bannerbot sets mode: +v Cabanossi 05:02 holyghost joined 05:03 p6bannerbot sets mode: +v holyghost
holyghost hello 05:03
05:19 ryn1x left 05:39 kurahaupo joined 05:40 p6bannerbot sets mode: +v kurahaupo, kurahaupo left 05:43 kurahaupo_ left 06:20 [particle]1 joined, p6bannerbot sets mode: +v [particle]1 06:21 [particle] left 06:34 jmerelo joined 06:35 p6bannerbot sets mode: +v jmerelo 06:56 sno left 06:59 |oLa| joined, |oLa| left 07:00 zopieux6 joined, zopieux6 left 07:05 vike joined 07:06 p6bannerbot sets mode: +v vike 07:07 domidumont joined 07:08 AlexDani` joined, p6bannerbot sets mode: +v domidumont 07:09 p6bannerbot sets mode: +v AlexDani` 07:12 AlexDaniel left
Summertime m: [1,2,3].keys[^5] 07:31
camelia ( no output )
Summertime m: [1,2,3] .keys[^5]
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in bracketed infix; couldn't find final ']' (corresponding starter was at line 1)
at <tmp>:1
------> 3[1,2,3] .keys[^7⏏055]
Summertime why is life so hard 07:33
07:36 jmerelo left 07:48 rindolf joined 07:49 p6bannerbot sets mode: +v rindolf
Summertime m: say bag $(1,2),$(1,2); 07:50
camelia Bag((1 2), (1 2))
Summertime what's the solution to having tupleish key values? 07:51
07:52 abraxxa joined, p6bannerbot sets mode: +v abraxxa 07:55 robertle joined, p6bannerbot sets mode: +v robertle
lookatme_q m: say bag :{ $(1,2), $(1,2) }; 08:00
camelia Bag(-> ;; $_? is raw { #`(Block|76657376) ... })
lookatme_q m: say bag(:{ $(1,2), $(1,2) });
camelia Bag(-> ;; $_? is raw { #`(Block|70308968) ... })
08:00 graphene left
lookatme_q m: my $f = :{ $(1,2), $(1,2) }; say bag $f; 08:00
camelia Bag(-> ;; $_? is raw { #`(Block|74067960) ... })
lookatme_q m: my $f = :{ $(1,2) =? $(1,2) }; say bag $f; 08:01
camelia Bag(-> ;; $_? is raw { #`(Block|55700024) ... })
lookatme_q m: my $f = :{ $(1,2) => $(1,2) }; say bag $f;
camelia Bag({(1 2) => (1 2)})
lookatme_q m: say bag(:{ $(1,2) => $(1,2) });
camelia Bag((1 2) => (1 2))
lookatme_q ^^ Summertime
08:02 graphene joined, kurahaupo joined, p6bannerbot sets mode: +v graphene 08:03 p6bannerbot sets mode: +v kurahaupo
Summertime to clarify, I'm looking for the output of (1 2) => 2 08:04
m: say bag 'a', 'a' # e.g. 08:05
camelia Bag(a(2))
Summertime m: say (1,2) === (1,2) # I kinda feel like I brought this up last AoC, and it got added to the spec that lists with immutables would be the same list, maybe I'm imagining that though 08:06
camelia False
Summertime I wish my dreams were true
08:07 kurahaupo_ joined 08:08 p6bannerbot sets mode: +v kurahaupo_ 08:10 kurahaupo left
Summertime maybe I'll just .perl the keys as they go in, and eval them as they come back out again :s 08:11
08:14 abraxxa left 08:15 abraxxa joined, p6bannerbot sets mode: +v abraxxa 08:18 coet joined, p6bannerbot sets mode: +v coet 08:19 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 08:20 zakharyas joined, kurahaupo_ left 08:21 p6bannerbot sets mode: +v zakharyas 08:27 ufobat joined, p6bannerbot sets mode: +v ufobat 08:31 kurahaupo left 08:32 kensanata joined, p6bannerbot sets mode: +v kensanata 08:33 graphene left 08:35 graphene joined
robertle is there a way to make perl 6 do all maths as Nums to speed them up (accepting the loss of precision)? 08:35
08:35 p6bannerbot sets mode: +v graphene 08:44 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 08:49 dakkar joined, p6bannerbot sets mode: +v dakkar
moritz you can/must coerce the involved numbers to Num 08:51
then the appropriate operation is picked automatically 08:52
m: say 0.1.Num
camelia 0.1
08:55 graphene left 08:57 graphene joined, p6bannerbot sets mode: +v graphene 09:06 lucasb_ joined, p6bannerbot sets mode: +v lucasb_ 09:07 andrewalker joined 09:08 p6bannerbot sets mode: +v andrewalker, lucasb_ is now known as lucasb
robertle k, thanks! 09:23
09:25 dogbert17 left 09:29 scimon joined 09:30 ufobat left, p6bannerbot sets mode: +v scimon 09:35 Praise left 09:36 Praise joined, Praise left, Praise joined, p6bannerbot sets mode: +v Praise 09:37 p6bannerbot sets mode: +v Praise, abraxxa left, abraxxa joined 09:38 p6bannerbot sets mode: +v abraxxa 09:54 rindolf left, rindolf joined 09:55 p6bannerbot sets mode: +v rindolf 10:01 graphene left 10:03 graphene joined, p6bannerbot sets mode: +v graphene 10:31 Skarsnik joined, leont joined 10:32 p6bannerbot sets mode: +v Skarsnik, p6bannerbot sets mode: +v leont
Skarsnik hello 10:32
10:35 tobs` joined, p6bannerbot sets mode: +v tobs` 10:36 kurahaupo left
Geth doc: 7aac939ed4 | (Richard Hainsworth)++ (committed using GitHub Web editor) | doc/Language/modules.pod6
Update modules.pod6

Accessing a resource file needs a definition in META6.json.
10:36
synopsebot_ Link: doc.perl6.org/language/modules
10:37 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 10:48 k-man joined, p6bannerbot sets mode: +v k-man
holyghost eco: Mathx::Chaos 10:49
buggable holyghost, Mathx::Chaos 'Chaos mathematics package': modules.perl6.org/dist/Mathx::Chaos...:HOLYGHOST
holyghost I forgot about it
I have to mainstream it 10:50
lucasb damn, today's problem is difficult :) 11:16
Summertime I've managed part 1, for once it was easier in python 11:17
lucasb is the square inches exact? like (16 = 4x4)
Summertime yeah
lucasb ah, ok.
Summertime pretty much a boolean grid 11:18
lucasb Summertime: wanna join the leaderboard?
Summertime sure
lucasb code 169430-b1c331b2
jnthn Is this Advent of Code? 11:19
jnthn just took a look and got kind of tempted to try it :)
lucasb yes, try it!
Summertime hel ya top of the leaderboard instantly :u 11:20
lucasb haha
11:20 ChoHag left
jnthn Already solved the first in a one-liner :P 11:20
Summertime first today? or first as in day 1?
jnthn day 1 :)
lucasb yeah, day 1 is usually the easiest :) 11:21
Summertime thank gosh because if you meant today's, aaaa
lucasb one year, task 1 was just to count parentheses "(()))(()()" :)
*in a past year
Summertime part 2 of today seems like an easy extension to part 1 (find the one that doesn't overlap) 11:28
jnthn I guess my one for day 3 is only a 1-liner if we allow quite long lines :P 11:32
Summertime anything over 80ch is too long for a 1 liner 11:33
11:33 coet left, ChoHag joined
jnthn 163 :P 11:34
11:34 coet joined, p6bannerbot sets mode: +v coet, coet left, p6bannerbot sets mode: +v ChoHag
jnthn Maybe I should actually sign up for this :) 11:34
11:39 ryn1x joined 11:40 p6bannerbot sets mode: +v ryn1x 11:42 sftp left 11:43 sftp joined, p6bannerbot sets mode: +v sftp, Peter_R left 11:44 Peter_R joined, p6bannerbot sets mode: +v Peter_R 11:45 domidumont left
Summertime fuk, answered too late 11:46
well, currently uncontestable second is fine I suppose
11:57 lizmat left 12:08 Skarsnik left 12:11 zakharyas left 12:16 sftp left 12:19 lizmat joined, p6bannerbot sets mode: +v lizmat
lucasb ah, my data set must be broken, I give up! 12:38
I'll try again later... I'm missing some detail right now
Geth ecosystem: b3b75fb00a | (Itsuki Toyota)++ (committed using GitHub Web editor) | META.list
[IO-Capture-Simple] Use META6.json instead of META.info

By this PR, IO-Capture-Simple uses META6.json at present: github.com/sergot/IO-Capture-Simple/pull/11
13:00
13:03 domidumont joined, p6bannerbot sets mode: +v domidumont 13:11 yqt joined 13:12 p6bannerbot sets mode: +v yqt 13:19 kurahaupo left, kurahaupo joined 13:20 p6bannerbot sets mode: +v kurahaupo 13:22 ryn1x left 13:28 daxim left
tbrowder FYI, i have started a proposal for a new p6 advent system on the perl6/advent repo’s wiki. feel free to contribute to it! 13:40
buggable New CPAN upload: Chart-Gnuplot-0.0.7.tar.gz by TITSUKI modules.perl6.org/dist/Chart::Gnupl...an:TITSUKI 13:48
SmokeMachine lucasb: what's that golf you guys were playing? 14:01
lucasb SmokeMachine: adventofcode.com/
mornfall tbrowder: can it be a repo of markdown files? :) 14:02
a script could probably publish that even to wordpress, if need be 14:03
14:10 yqt left
tbrowder mornfall: actually, i would prefer that since it would make it easier for web edits and seeing a rendered view by github (although it wouldn’t be the published view). i think md should provide enough formatting features to satisfy most of us (i hope). 14:17
as to second point, as possibly an interim solution looking at using Wordpress’s API to do that. 14:18
tobs` tbrowder: comments are also desirable
lucasb tbrowder: may I persuade you to "gem install jekyll" and play with it? :) jekyllrb.com/ 14:19
Kaiepi what's the code for the perl 6 leaderboard on advent of code? 14:20
tbrowder maybe, is that what worpress uses?
mornfall lucasb: what'd be the point of that? there's a very definite bound on number of articles, using jekyll for that sounds like substantial overkill?
lucasb Kaiepi: 169430-b1c331b2 14:21
14:21 tmtvl joined
Kaiepi thanks 14:21
tbrowder tobs: agreed. not so easy to do, maybe wp api is the way to go...
tobs` and as I've said before: drafting, reviewing, editing the advent posts completely in the open would sound odd to me, as it is supposed to be a surprise
lucasb tbrowder: sorry, wordpress uses... wordpress :-) jekyll is used by github pages :-)
14:21 p6bannerbot sets mode: +v tmtvl 14:22 araujo joined, p6bannerbot sets mode: +v araujo
tobs` I mean, yes, we're all adults and can spoil the advent calendar for us if we feel like it, but a little barrier would be nice, like a private repository. 14:23
AlexDani` .
14:23 AlexDani` is now known as AlexDaniel
AlexDaniel . 14:23
tbrowder well, as i’ve seen in wp, it let’s one see other posts before publishing (or is that because moritz gave me editor role privs—hard to tell) 14:24
mornfall tobs`: a private repository is also a substantial hurdle for contributors
Kaiepi first part of the first day of advent of code was pretty painless hastebin.com/hipejecine.pl 14:25
i wonder if there's a shorter way to do it
14:25 zakharyas joined 14:26 daxim joined, p6bannerbot sets mode: +v zakharyas, p6bannerbot sets mode: +v daxim
tbrowder the p5 folks seem to have a process where you have to submit early and a committee approves it 14:26
lucasb Kaiepi: say [+] lines>>.Int :-) 14:27
tobs` mornfall: what kind of contributors do you mean? Article writers or casual proof readers? For the latter it's kind of my point to make it an obstacle, as bad as that sounds.
Kaiepi ah
lucasb Kaiepi: I like to feed the input file in the command line "prog < input"
mornfall tobs`: to be honest, the quality of text has not been very high so far -- discouraging proofreading further doesn't sound like the right direction to me 14:28
having a few semi-pro writers as copy-editors on the team would probably help a lot, but an entry barrier virtually ensures that it's not going to happen? 14:30
dunno, just my impression (fwiw, i would contribute via copy-editing if it the process for that would be simple enough) 14:32
if the process*
14:33 andrew_ joined, p6bannerbot sets mode: +v andrew_, andrew_ left
tobs` mornfall: what I mean is, if we have an open repository and every day the next person announces their draft here looking for opinions, at least half the channel will have casually read some version of the article before it's even time to open that little door on the advent calendar. Only this effect is what I'd not like to encourage. 14:36
mornfall tobs`: that will largely depend on whether there is or isn't a test audience other than #perl6, is that not so? 14:37
so perhaps a thing as simple as having #perl6advent would fix your concern? 14:38
tobs` having semi-pro writers in a semi-consistent team would solve that, as would just assuming that people don't spoil articles for themselves, or even that they might as well do that if they want to
mornfall: yeah, I like that idea
tbrowder ++ on #perl6-advent 14:45
(in spirit of othe #perl-*)
hahainternet so i've got a very odd bug here where i have two identical range constructions that are mapped inside an existing map 14:46
the second one always fails unless it's assigned to a variable
in which case it only works if it's assigned to a list(or array i forget the specifics)
i'll try and work up a little test case 14:47
14:49 Xliff left
hahainternet yeah it's being enclosed in an outer map 14:50
m: (^1).map: { (^1).map({say "Hello $_"}); (^1).map({say "Goodbye $_"}); }; 14:51
camelia Hello 0
hahainternet i'm not quite sure why that would be, whether it's a bug or i'm misunderstanding
14:54 ufobat joined 14:55 p6bannerbot sets mode: +v ufobat
tobs` commit: 2018.10 (^1).map: { (^1).map({say "Hello $_"}); (^1).map({say "Goodbye $_"}); } 14:55
committable6 tobs`, ¦2018.10: «Hello 0␤»
ufobat is there a way to have one or another type in one method signature, like method foo(Str|Blob $data) { ... } 14:56
tobs` hahainternet: it works here in my 2018.10 repl (usually it's the other way around)
ufobat do i need to write method foo(Any $data where * ~~ Str|Blob)? 14:57
hahainternet tobs`: i don't really know how to use bisectable6 :) 14:59
bisectable6: help
bisectable6 hahainternet, Like this: bisectable6: old=2015.12 new=HEAD exit 1 if (^∞).grep({ last })[5] // 0 == 4 # See wiki for more examples: github.com/perl6/whateverable/wiki/Bisectable
tobs` m: use Test; subset Strob of Any where Str|Blob; sub f (Strob $x) { }; lives-ok { f("abc") }; dies-ok { f(12) }; lives-ok { f("abc".encode) }
camelia ok 1 -
ok 2 -
ok 3 -
hahainternet tobs`: can you tell me the commit id of a working commit? lets try some other commands the wiki recommends
6c: (^1).map: { (^1).map({say "Hello $_"}); (^1).map({say "Goodbye $_"}); };
lol 15:00
tobs` ufobat: you can use a subset
committable6 hahainternet, ¦6c (35 commits): «Hello 0␤»
tobs` hahainternet: my $*PERL.compiler.version is exactly v2018.10 (and I'm otherwise pretty sure too that I only install the monthly releases) 15:01
ufobat subset StrOrBlob of Cool where * ~~ Str|Blob
like that?
hahainternet tobs`: and it prints both for you? cause none of these versions seem to want to 15:02
tobs` ufobat: I made an example 3 minutes ago
but yes :)
ufobat ah sorry didn't see it, thanks :-)
oh you can leave out the `* ~~` part, thats fancy 15:03
tobs` hahainternet: it doesn't print under `perl6 -e`, but it does in the REPL
15:04 daxim left
tobs` but IME, when they both disagree, the REPL is the one with buggy-looking behaviour 15:05
hahainternet tobs`: how bizarre
tobs` hahainternet: is it at least the same on your system? 15:09
hahainternet tobs`: just checking
tobs`: it is, repl prints both and the result 15:10
-e doesn't print both
i notice if i assign the second one to an array, it tends to work
m: (^1).map: { (^1).map({say "Hello $_"}); my @a=(^1).map({say "Goodbye $_"}); };
camelia Hello 0
Goodbye 0
hahainternet m: (^1).map: { (^1).map({say "Hello $_"}); my $a=(^1).map({say "Goodbye $_"}); };
camelia Hello 0
hahainternet so it's something to do with the context it's running in, it must be assuming it's void or something idk
lucasb m: 10.map: { 42.map(*.say); [1,2,3].map(*.say) } 15:15
camelia 42
lucasb m: 10.map: { 42.map(*.say); [1,2,3].map(*.say).sink }
camelia 42
1
2
3
SmokeMachine m: say 10.map: { 42.map(*.say); [1,2,3].map(*.say) } 15:20
camelia 42
1
2
3
((True True True))
Geth doc: 8440f87216 | Coke++ | doc/Language/modules.pod6
whitespace
synopsebot_ Link: doc.perl6.org/language/modules
doc: 7b8a41fb17 | Coke++ | doc/Language/modules.pod6
fix pod errors
15:20 sena_kun joined
SmokeMachine m: my @a = 10.map: { 42.map(*.say); [1,2,3].map(*.say) } 15:20
camelia 42
SmokeMachine m: my @a = 10.map: { 42.map(*.say); [1,2,3].map(*.say) }; say @a 15:21
camelia 42
1
2
3
[(True True True)]
SmokeMachine wtf?
lazyness?
lucasb golfier: "10.map: { 20.map(*.say) }" :-)
15:21 p6bannerbot sets mode: +v sena_kun
lucasb m: 10.map: { 20.map(*.say); 1 } 15:22
camelia 20
tobs` m: class A::B { }; class X::Y { method A::B { A::B.new } }.new.A::B.say 15:23
camelia Cannot dispatch to method B on A because it is not inherited or done by X::Y
in block <unit> at <tmp> line 1
tobs` I get that this happens because .A::B is class-qualified method lookup, but I wanted to make that method a coercer to a class inside some other package. Is there a way? 15:24
lucasb m: class A::B { }; class X::Y { method A::B { A::B.new } }.new.'A::B'().say 15:25
camelia A::B.new
tobs` oh right! lucasb++
If only it was nicer-looking
(but being a coercer method, I won't usually call it, I suppose, but have it called) 15:26
lucasb but I wouldn't use "method A::B { ... }" to me this is a syntax error waiting/wanting to be fixed :)
15:26 MilkmanDan left
tobs` m: class A::B { }; class X::Y { method A::B { A::B.new } }; my X::Y $y .= new; say my A::B() $x = $y 15:27
camelia 5===SORRY!5=== Error while compiling <tmp>
Coercion A::B(Any) is insufficiently type-like to qualify a variable
at <tmp>:1
------> 3} }; my X::Y $y .= new; say my A::B() $x7⏏5 = $y
expecting any of:
constraint
lucasb my class is named Foo::Bar::Baz. how should I name the coercer method? well, I would say "Baz" or... idk :-)
15:27 MilkmanDan joined, p6bannerbot sets mode: +v MilkmanDan
tobs` m: class A::B { }; class X::Y { method A::B { A::B.new } }; my X::Y $y .= new; say my A::B $x = $y 15:27
camelia Type check failed in assignment to $x; expected A::B but got X::Y (X::Y.new)
in block <unit> at <tmp> line 1
SmokeMachine m: class A::B { }; sub a(A::B() $a) { say $a }; a class X::Y { method A::B { A::B.new } }.new 15:28
camelia A::B.new
tobs` m: class A::B { }; class X::Y { method A::B { A::B.new } }; sub f (A::B() $a) { $a.say}(X::Y.new)
camelia A::B.new
15:29 ufobat left
SmokeMachine m: class A::B { }; my A::B() $a = class X::Y { method A::B { A::B.new } }.new # but this gives an error 15:29
camelia 5===SORRY!5=== Error while compiling <tmp>
Coercion A::B(Any) is insufficiently type-like to qualify a variable
at <tmp>:1
------> 3class A::B { }; my A::B() $a7⏏5 = class X::Y { method A::B { A::B.new }
expecting any of:
lucasb in my understanding, P6 doesn't restrict the variable names. just because "method A::B {...}" doesn't error, doesn't mean it should be used
m: my $a::b::c = 42; say $a::b::c 15:30
camelia 42
lucasb ^^ for example, it makes no sense qualified lexicals... but the syntax allows it
SmokeMachine m: $a::b::c = 42; say $a::b::c 15:31
camelia 42
Kaiepi m: my $é = 42; say $é
camelia 42
15:31 daxim joined
Kaiepi m: my $a::é = 42; say $a::é 15:31
camelia 42
Kaiepi m: my $a::🤔 = 42; say $a::🤔 15:32
camelia 5===SORRY!5=== Error while compiling <tmp>
Bogus postfix
at <tmp>:1
------> 3my $a::7⏏5🤔 = 42; say $a::🤔
expecting any of:
constraint
infix
infix stopper
postfix
statement e…
15:32 p6bannerbot sets mode: +v daxim
Kaiepi damn 15:32
m: sub term:sym<a::🤔> { state $foo = 1 }; say a::🤔
camelia 1
tobs` lucasb: but my type is called A::B and it's (otherwise) not necessary to export it. If I want coercers in function signatures to work, it _has_ to be method A::B as far as I know. 15:36
lucasb yeah, you are correct 15:37
hahainternet SmokeMachine: yeah i'm really not sure what causes that, if you or lucasb can figure it out please lmk
lucasb tobs`: in a imaginary language, the coercer method would me Mu.to(Something) 15:38
obj.to(Array), obj.to(Foo::Bar), etc
multi method to(Foo::Bar) {...}, etc. :-)
I think this would give a clear idea of what the possible coercions are. just query the signatures of the .to(Something) method 15:40
anyway... just design ideas :-) unrelated to P6
15:41 coet joined, p6bannerbot sets mode: +v coet
lucasb m: gist.github.com/lucasbuchala/9e184...ac5fb5cfeb 15:42
camelia 123
abc
True
scimon So after reading an article on function compostion in Javascript I wrote code to allow this say (add(4)∘add(5)∘add(4))(1) (Where add is a curried function taking 2 elements). And ∘ composes to arity 1 functions into a single one. :) 15:44
lucasb is the result 14? 15:45
scimon It is. 15:46
lucasb m: say &[+].assuming(4).assuming(5).assuming(4).(1)
camelia Too many positionals passed; expected 0 arguments but got 1
in sub trybind at EVAL_7 line 1
in block <unit> at EVAL_7 line 1
in block <unit> at <tmp> line 1
scimon Yeah I know.
lucasb your way is prettier for sure :-) 15:47
scimon (I'm casting around for ideas for my Advent post at the moment)
[Coke] looks like we just had a bad commit in the past day that failed the valid pod test in t/ (which caused 2 xt tests to just explode) 15:48
(in perl6/doc)
SmokeMachine scimon: I was studding stuff like that some time ago too: github.com/FCO/functional/blob/mas...-compose.t 15:49
scimon My other thought was working out how to do a curry keyword so you could do curry ($a,$b,$c) {BLOCK} and it gave you -> $a { -> $b { -> $c { BLOCK } } } Hmmmm
Shiny. 15:50
lucasb m: say &reduce.assuming(&[+]).assuming(4).assuming(5).assuming(4).(1)
camelia 14
lucasb I want to get a reference to the add reduce function "[+] 1,2,3" 15:51
SmokeMachine scimon: github.com/FCO/functional/blob/mas...-example.t
lucasb what's shorter than &reduce.assuming(&[+]) ?
scimon SmokeMachine: Now all you need is some docs and it's a module :D 15:52
SmokeMachine scimon: :)
scimon lucasb: Of course the ∘ doesn't just work on + :) (assuming is cool though, don't get me wrong). 15:53
(I did ML back in Uni so bits of it stuck around)
SmokeMachine scimon: I like the fact of `add(add(1, 2), 4)` return the same function as `add(1, add(2, 4))`. Not a function that do the same... the SAME function... 15:54
lizmat .
SmokeMachine scimon: here: github.com/FCO/functional/blob/mas...function.t
lizmat PSA: The Perl 6 Weekly may be delayed until tomorrow because of being very much under the weather 15:55
15:56 jargan joined 15:57 p6bannerbot sets mode: +v jargan 15:58 tobs` left, jast left, jargan is now known as jast
sena_kun lizmat, take care. 15:59
15:59 tobs` joined
[Coke] re fco.github.io/MemoizedDOM/todo6.html - does the corresponding perl6.js file need use strict in as many places as it has? or would it have the same effect with a single use strict at the top? 16:00
16:00 p6bannerbot sets mode: +v tobs`
scimon :( 16:04
I too am under the sweather but this is because the weather was created by my standing next to a free bar for much of Friday night so I deserve no sympathy. (And yes... Sigh... I've still got a headache). 16:05
Geth Pod-To-HTML/master: 7 commits pushed by finanalyst++, (Juan Julián Merelo Guervós)++ 16:08
16:15 Sgeo_ joined 16:16 p6bannerbot sets mode: +v Sgeo_, pmurias joined, p6bannerbot sets mode: +v pmurias 16:17 Sgeo left
pmurias [Coke]: potentially parcel could get rid of them 16:18
[Coke]: but I'm not sure they can be just moved to them top as some dependencies might not be using 'use strict' 16:19
[Coke] pmurias: in any case, very excited to be able to run perl6 in the browser. :) 16:20
lucasb cool. I'm waiting bigint support in firefox to be able to play with it too 16:23
wow 6pad is working now 16:26
last time I saw it was an error saying to use chrome
16:26 jmerelo joined 16:27 p6bannerbot sets mode: +v jmerelo
SmokeMachine [Coke]: I don't know... but I think its different for the script and for the function... 16:30
lucasb: its working on firefox and safari... its not using the browsers biting anymore...
developer.mozilla.org/en-US/docs/W...trict_mode 16:31
pmurias++
pmurias SmokeMachine: still haven't got round the 6pad/parceling up modules fixes yet :/ got to get the &is_run stuff done as that has been dragging on far too long ;) 16:32
SmokeMachine pmurias: had you seen? fco.github.io/MemoizedDOM/todo6.html ?
pmurias SmokeMachine: yep
lucasb ah, it's using JSBI
SmokeMachine pmurias: had you like the MemoizedDOM? 16:34
liked
have
ok, my english is the worst!
pmurias SmokeMachine: it's awesome someone is using rakudo.js 16:36
SmokeMachine: not sure if we shouldn't use react.js instead ;) 16:40
SmokeMachine pmurias: why do you think react would be better? 16:41
pmurias: have you seen this? somebee.github.io/dom-reconciler-b...index.html 16:43
pmurias SmokeMachine: do you think MemoizedDOM can beat react.js? 16:45
16:46 kensanata left
SmokeMachine pmurias: my MemoizedDOM currently I don't know... but the imba's does... at least 27 times faster 16:46
16:46 Kaiepi left
SmokeMachine pmurias: I was thinking of adding jsx in front of my MemoizedDOM... 16:47
16:48 Kaiepi joined
pmurias we have github.com/pmurias/p6-jsx 16:48
SmokeMachine pmurias: but I think the subs are easy enough to the first tests...
pmurias that worked with rakudo.js in the past
16:48 p6bannerbot sets mode: +v Kaiepi
SmokeMachine pmurias: yes... we also have github.com/FCO/p6-react 16:49
16:49 domidumont left
pmurias SmokeMachine: I remembered someone was creating his own JSX, but I didn't connect the nickname ;) 16:50
SmokeMachine :) 16:51
pmurias SmokeMachine: I have to run, I'll try to get MemoizedDOM working with parcel (likely just need a new release) when I get back, and that should allow us to load JSX 16:52
SmokeMachine pmurias: is your jsx generic for what will it generate? 16:53
pmurias: ok! see you! 16:54
pmurias SmokeMachine: see github.com/pmurias/p6-jsx/blob/mas...01-basic.t
it just generates &create-element calls
SmokeMachine hum... 16:55
pmurias doesn't use react.js itself at all
16:56 patrickb joined
pmurias it tries to be as close to the JSX spec as possible (while your's was more perlish from what I remember) 16:56
16:57 p6bannerbot sets mode: +v patrickb
pmurias it might make sense to have a more perlish version too, but the idea is someones who already uses JSX can use it without learning anything new 16:58
jmerelo .seen masak
yoleaux 03:14Z <SmokeMachine> jmerelo: very good post! Congratulations?
I saw masak 2 Dec 2018 22:39Z in #perl6: <masak> 'night
jmerelo SmokeMachine: thanks!
.tell masak you have Dec 5th in the Advent scheduler. Is it ready? 16:59
yoleaux jmerelo: I'll pass your message to masak.
17:00 jmaslak joined, p6bannerbot sets mode: +v jmaslak
SmokeMachine pmurias: I got it... 17:00
jmerelo: :) 17:01
jmerelo Please those with privs the Perl 6 Advent Calendar blog check out comments from time to time. And do so _thoroughly_, some kinda legitimate stuff is not like that.
SmokeMachine: I see yours is scheduled already. So no prodding needed from me :-)
17:03 lizmat left
jmaslak I'm trying to get some sort of monotonic time in Perl 6. Something like Time::HiRes::clock_gettime(CLOCK_MONOTONIC) does in Perl 5. I can write something, but I'd rather reuse someone else's stuff. Is there a module that already does this that I'm just overlooking? 17:05
hahainternet so the same weird broken behaviour i had more also seems to apply in BUILD submethods
17:06 domidumont joined
hahainternet maps don't run unless they have .sink appended to them 17:06
17:06 p6bannerbot sets mode: +v domidumont
hahainternet i guess it might be non-broken, but just very-surprising 17:08
17:08 graphene left 17:10 graphene joined, p6bannerbot sets mode: +v graphene 17:12 araujo_ joined, p6bannerbot sets mode: +v araujo_ 17:13 araujo left
tobs` m: my Set $s; my Set $t = set 42; $s ∩ $t 17:14
\o/ 17:15
camelia WARNINGS for <tmp>:
MoarVM panic: Memory allocation failed; could not allocate 182800 bytes
timotimo probably an infinite recursion in trying to get the right dispatch to happen
m: Set (&) set(1)
camelia MoarVM panic: Memory allocation failed; could not allocate 156704 bytes 17:16
timotimo s: &infix:<(&)>, \(Set:U, Set:D)
SourceBaby timotimo, Sauce is at github.com/rakudo/rakudo/blob/38bc...n.pm6#L132
timotimo m: use nqp; say nqp::istype(Set, Setty) 17:17
camelia 1
timotimo yeah, that recurses into itself
since $a doesn't change
m: say Set.Set
camelia set((Set))
timotimo haha
anyway, there ought to be a candidate that handles undefined Set there so that it doesn't asplode 17:18
17:19 |oLa| joined 17:20 p6bannerbot sets mode: +v |oLa| 17:24 zakharyas left 17:25 dakkar left
tobs` timotimo: R#2514 17:25
synopsebot_ R#2514 [open]: github.com/rakudo/rakudo/issues/2514 Intersecting with a Set type object exhausts memory
17:25 test joined, p6bannerbot sets mode: +v test
tobs` I might be able to do that myself 17:25
timotimo cool
17:25 test is now known as Guest22672 17:26 Guest22672 left
timotimo who wants to go through all our operators, feed an undefined value of different kinds to each and both sides, and decide whether what we have is a good solution or not? 17:26
tobs` ducks 17:27
17:27 abraxxa left 17:30 |oLa| left, araujo_ left 17:31 scimon left 17:34 thundergnat joined, p6bannerbot sets mode: +v thundergnat
thundergnat m: say ({ $^n + 4 } ∘ { $^n + 5 } ∘ { $^n + 4 })(1); # function composition 17:35
camelia 14
tobs` and about a roast, is there a convenient way to test for this kind of problem without stressing the machine too much?
thundergnat scimon ^^^
17:36 thundergnat left
timotimo tobs`: "this kind of problem" meaning? you want to put a change in and see if anything breaks? 17:38
tobs` timotimo: a problem leading to OOM. I don't want my laptop to start swapping half an hour before the test eventually dies-ok 17:39
I want to add a test that Set:U ∩ Set:D behaves correctly
(or, well, it would not does-ok, it would fail the test) 17:41
dies-ok*
m: say 0 + Int 17:42
camelia Invocant of method 'Bridge' must be an object instance of type 'Int', not a type object of type 'Int'. Did you forget a '.new'?
in block <unit> at <tmp> line 1
tobs` m: say "a" ~ Str 17:43
camelia Use of uninitialized value of type Str in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
a
in block <unit> at <tmp> line 1
tobs` m: say 0 + Rat
camelia Cannot look up attributes in a Rat type object
in block <unit> at <tmp> line 1
timotimo ah, i see
i don't think there'd be a "set stack depth limit" functionality exposed to perl6 userland
and until we have a way to send exceptions to other threads, it'll be difficult to say the least ... 17:44
to do it per hand, i mean
so what you can do is use is-run or what it's called, and also set a ulimit on memory
maybe even make it a stresstest, tbh 17:46
oh, you could wrap the operator
m: &infix:<(&)>.wrap(-> | { die "recursed too deep" if $++ > 100; {*} }); Set (&) Set.new(1) 17:47
camelia 5===SORRY!5=== Error while compiling <tmp>
{*} may only appear in proto
at <tmp>:1
------> 3ie "recursed too deep" if $++ > 100; {*}7⏏5 }); Set (&) Set.new(1)
expecting any of:
horizontal whitespace
term
timotimo m: &infix:<(&)>.wrap(-> | { die "recursed too deep" if $++ > 100; nextsame }); Set (&) Set.new(1)
camelia WARNINGS for <tmp>:
Useless use of "(&)" in expression "Set (&) Set.new(1)" in sink context (line 1)
recursed too deep
in block <unit> at <tmp> line 1
timotimo m: &infix:<(&)>.wrap(-> | { die "recursed too deep" if $++ > 100; nextsame }); say Set (&) Set.new(1)
camelia recursed too deep
in block <unit> at <tmp> line 1
timotimo there we go!
tobs`: check it out! :D
tobs` ohhh, very nice. Thanks for the tips 17:48
timotimo top tips for tobs
could surely build a little tool that goes through all operators and checks which cause a very deep recursion of the operator itself, though many of them would probably invoke other operators, too 17:54
which you can figure out using moarvm's coverage tool! 17:55
hahainternet heh interesting, trying to use set operators on 'my Set $whatever' seems to infinite loop somewhere inside p6
'my $whatever = set()' just fine though
i assume some initialisation i did not fully do, but a bit surprising
timotimo right, if you just use my Set $whatever, you'll get the set type object in $whatever 17:57
i.e. undefined, it's the same we were toying around with earlier
m: my %foo is Set; say %foo.perl
camelia Set.new()
timotimo ^- this syntax will give you a defined but empty set instead
hahainternet yeah, still so much to learn :) 17:58
timotimo m: my %foo is Set = 1, 2, 3; say %foo.perl
camelia Set.new(3,1,2)
timotimo ^- you can't have this exact syntax with "my Set $whatever" either :)
hahainternet oh it's fine, i'm just trying to learn still 17:59
17:59 AlexDaniel left
timotimo no prob! 17:59
hahainternet the most surprising thing has been needing to use 'sink' on only certain maps because they have side effects and aren't consumed directly 18:01
that needs a bit of thought, but now i know it…
timotimo can probably use for instead of map in some places to make it clearer 18:02
map is more a "functional" thing by convention i guess
lucasb hahainternet: are you trying to solve some programming problem? :)
18:03 robertle left, robertle_ joined, p6bannerbot sets mode: +v robertle_
leont p6 has so many unicode operators than I'm sometimes surprised when it doesn't support one 18:04
18:06 tmtvl left
hahainternet lucasb: i'm just tidying up my AOC for today 18:07
i try and do a finish pass each day and learn from my mistakes :p 18:08
lucasb hahainternet: cool. if you feel like joining our leaderboard, the code is 169430-b1c331b2
hahainternet oh there's a #perl6 one? i can't really compete as it unlocks at 6am and i'm only awake and alive by about 2pm :) 18:09
i may join just to say hi though
lucasb tasks open at 3am here in my timezone :D I'm not competing either
18:16 jast left 18:17 jast joined 18:18 p6bannerbot sets mode: +v jast
jmaslak Well, looks like I'll need to create a module for the monotonic time. I wish MOAR threw a typed exception (not an AdHoc) when it couldn't find a symbol but I suppose I can just assume any exception should cause fallback if the system doesn't support clock_gettime(). 18:23
18:37 tobs` left 18:41 pecastro joined 18:42 p6bannerbot sets mode: +v pecastro
hahainternet are hyper/race known to be buggy still? adding it to a parsing input step seems to result in oddly different output, possibly getting a duplicated batch in place of another 18:45
haven't had a chance to debug it yet
18:52 ufobat joined 18:53 p6bannerbot sets mode: +v ufobat
ufobat is there a way to complain if you provide more parameters to a constructre that are processed 18:53
like MooseX::StrictContructor 18:54
m: class Foo { has $.bar; has $.foo}; Foo.new(foo => 1, bar => 2, x => 3).say
camelia Foo.new(bar => 2, foo => 1)
18:55 ryn1x joined, p6bannerbot sets mode: +v ryn1x
hahainternet ufobat: nothing built in that i'm aware of, but you could always wrap it with something that checks arity 18:57
lucasb maybe if you override "method new(:$foo, :$bar, *%_ ()) {...}"
ufobat :-/
19:01 AlexDaniel joined, p6bannerbot sets mode: +v AlexDaniel 19:04 coet left
SmokeMachine m: class Foo { has $.bar; has $.foo; method TWEAK(:$bar, :$foo, *%_) {die if %_}}; Foo.new(foo => 1, bar => 2, x => 3).say 19:04
camelia Died
in method TWEAK at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine m: class Foo { has $.bar; has $.foo; method TWEAK(:$bar, :$foo, *%_) {die if %_}}; Foo.new(foo => 1, bar => 2).say
camelia Foo.new(bar => 2, foo => 1)
SmokeMachine m: class Foo { has $.bar; has $.foo; method TWEAK(:$bar, :$foo) {die if %_}}; Foo.new(foo => 1, bar => 2, x => 3).say 19:05
camelia Died
in method TWEAK at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine m: class Foo { has $.bar; has $.foo; method TWEAK(:$bar, :$foo) {die if %_}}; Foo.new(foo => 1, bar => 2).say
camelia Foo.new(bar => 2, foo => 1)
19:10 kent\n joined, p6bannerbot sets mode: +v kent\n
ufobat SmokeMachine, it still feels like a work around 19:10
SmokeMachine ufobat: it is... :)
ufobat I play around with the IoC module and whenever i make a typo it results in weired errors somewhere 19:11
SmokeMachine someone could write a `strict-methods` to change this method behaviour... 19:12
19:13 Sharparam joined
ufobat someone :-) 19:13
19:13 p6bannerbot sets mode: +v Sharparam
ufobat stepps back 19:13
SmokeMachine m: say my method bla($) {}.signature.params.tail # <- this is the "problem" 19:14
camelia *%_
19:14 sftp joined, p6bannerbot sets mode: +v sftp 19:17 abraxxa joined
hahainternet couldn't you just move that tweak method into its own class and 'class Foo is StrictClass'? perl6's object model still quite opaque to me :) 19:17
19:18 p6bannerbot sets mode: +v abraxxa 19:22 abraxxa left 19:23 challene joined 19:24 challene left 19:25 sauvin left
ufobat afaik the TWEAK must match the possible parameters, it must be inheritance and role composition aware as well, right? so i'd say haveing a StrictClass wont work 19:26
Sharparam is there a (built-in) way to have a default value "factory" for hashes similar to ruby's `Hash.new { |h, k| h[k] = value }`? (to prevent things like the same array instance being set for every key) 19:30
AlexDaniel m: my %h is default(42); say %h<foo> 19:31
camelia 42
AlexDaniel Sharparam: like this? ↑
Sharparam yeah, but if you do for example `my %h is default([]); %h<foo>.push: 5; %h<bar>.say;` then %h<bar> will be the same array
AlexDaniel jmerelo: hey, so I added a link to results and everything, but who is the winner? Are you going to announce it? 19:38
SmokeMachine m: role StrictClass { method new(*%pars) { my @attrs = %pars.keys.grep: { so $_ ne ::?CLASS.^attributes.map(*.name.substr: 2).any}; die "Attributes net expected: @attrs.join(", ")" if @attrs; ::?CLASS.bless |%pars } }; class Bla does StrictClass { has $.a }.new: :1a, :2b
camelia Attributes net expected: b
in method new at <tmp> line 1
in block <unit> at <tmp> line 1
hahainternet can you express more complex type constraints in p6? so i can do 'has Pair @.example' but I can't type constrain those pairs i don't think?
SmokeMachine hahainternet: ufobat ^^ 19:39
m: role StrictClass { method new(*%pars) { my @attrs = %pars.keys.grep: { so $_ ne ::?CLASS.^attributes.map(*.name.substr: 2).any}; die "Attributes not expected: @attrs.join(", ")" if @attrs; ::?CLASS.bless |%pars } }; class Bla does StrictClass { has $.a }.new: :1a, :2b
camelia Attributes not expected: b
in method new at <tmp> line 1
in block <unit> at <tmp> line 1
hahainternet nice SmokeMachine
SmokeMachine m: role StrictClass { method new(*%pars) { my @attrs = %pars.keys.grep: { so $_ ne ::?CLASS.^attributes.map(*.name.substr: 2).any}; die "Attributes not expected: @attrs.join(", ")" if @attrs; ::?CLASS.bless |%pars } }; class Bla does StrictClass { has $.a }.new: :1a
camelia ( no output )
AlexDaniel Sharparam: I don't know, unfortunately. Maybe something like Proxy can help, or maybe you need to create a subclass of Hash with your own AT-KEY 19:41
Sharparam AlexDaniel: seems so 19:42
AlexDaniel jmerelo: also, I think we had enough doc squashathons… I'm not even sure how this one slipped through :) 19:43
SmokeMachine m: www.irccloud.com/pastebin/rDyS5XeS/ 19:47
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3https:7⏏5//www.irccloud.com/pastebin/rDyS5XeS/
expecting any of:
colon pair
SmokeMachine m: role StrictClass { method TWEAK(*%pars) { if %pars.keys (-) self.^attributes>>.name>>.substr(2) -> %error { die "unexpected %error.keys().join(", ")" }; nextsame } }; say class :: does StrictClass { has $.a }.new: :1a, :2b 19:48
camelia unexpected b
in method TWEAK at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine m: role StrictClass { method new(*%pars) { if %pars.keys (-) self.^attributes>>.name>>.substr(2) -> %error { die "unexpected %error.keys().join(", ")" }; nextsame } }; say class :: does StrictClass { has $.a }.new: :1a, :2b
camelia unexpected b
in method new at <tmp> line 1
in block <unit> at <tmp> line 1
19:57 ryn1x left, ryn1x joined 19:58 p6bannerbot sets mode: +v ryn1x 19:59 robertle_ left 20:04 jmaslak left 20:06 jmerelo left 20:09 |oLa| joined 20:10 p6bannerbot sets mode: +v |oLa| 20:19 |oLa| left 20:21 domidumont left
Sharparam AlexDaniel: `my %hash is default(Array);` works 20:29
m: my %hash is default(Array); %hash<foo>.push: 5; %hash<bar>.push: 10; say %hash;
camelia {bar => [10], foo => [5]}
20:38 graphene left 20:40 graphene joined 20:41 p6bannerbot sets mode: +v graphene 20:49 Skarsnik joined, ryn1x left, Sgeo__ joined 20:50 p6bannerbot sets mode: +v Skarsnik, p6bannerbot sets mode: +v Sgeo__ 20:51 |oLa| joined, Sgeo_ left 20:52 p6bannerbot sets mode: +v |oLa|
Skarsnik Hello there 20:52
timotimo hi snikers! :D 20:55
is it okay to call you that?
SmokeMachine m: my %hash is default(Array); %hash<foo>.push: 5; say %hash<bar>; # <- Sharparam 20:58
camelia (Array)
timotimo m: my %hash; %hash<foo>.push: 5; say %hash<bar> 20:59
camelia (Any)
timotimo m: my %hash; %hash<foo>.push: 5; say %hash<foo>
camelia [5]
Skarsnik can I submit an advent still? *confuzzled*
timotimo that's not what you meant, right?
Skarsnik: i'm not entirely sure if i'll be able to make mine work, really
Skarsnik I am like 30% done with what I wanted to do xD 21:00
timotimo i wonder if day 14 and 15 are accidentally the same talk?
"designing" and "building" a space ship with perl 6
sena_kun no
but, well.
that's mine. 21:01
timotimo oh, is that you?
sena_kun yeah
my another nick. :P
sena_kun apparently confuses too much people
anyway
21:02 kensanata joined, p6bannerbot sets mode: +v kensanata
sena_kun I had one already done and second one being ready in my head. but then I continued to use this thing. and it turned out to be completely mess, my "architecture" is so horrible I'd like to jump out of the window(gladly, I live on second floor, no worries). Still, I hope, I will make it in time. With re-designing pretty everything. But if one spot will be taken, I am not sure it'll hurt. 21:03
Sharparam SmokeMachine: hm?
sena_kun s/too much people/people too much/
ufobat SmokeMachine, are you going to make a perl6 module out of it? 21:04
Skarsnik I could do a Usb2Snes module but nobody aside me will use that xD 21:06
timotimo what does that do? is it for controllers? 21:07
Skarsnik btw is there a plan to have an individual module for websocket client or Cro::ws does not need the whole Cro
SmokeMachine ufobat: I was not thinking of it... too many modules on the list...
sena_kun Skarsnik, no. it uses cro-http client/server inside, it's just a tiny wrapper. 21:08
Skarsnik, or please define what do you mean by "whole Cro". Core is essential, http is used inside, what else?
SmokeMachine ufobat: will you? 21:09
ufobat SmokeMachine, if you want me to make a module ot of it, i could do it. But my Meta programming skills are so low that i probably can not improve it any further
Skarsnik Usb2snes is a firmware for a sd2snes (a cartridge with a flash cart slot for snes) that allow you to use the usb port to communicate with it. Then you have a websocket server on top of that to expose the device to multiple client (since only one app can use a usb port otherwise). so a Usb2snes module will be a client for the ws part 21:10
this allow stuff like sharing ammunition/healt/item on some game. or to upload rom directly on the device ^^ 21:11
timotimo oooh, it's like that plugin for that emulator that mcclure made
SmokeMachine ufobat: you can use that code if you want... and there are a lot of people here that could help you... :)
timotimo i mean the plugin was made by mcclure, i don't remember what emulator it was and who made that
ufobat allright, i'll create a module and send a mail to the perl6 mailing list in order to look for help and feedback 21:12
Skarsnik I wrote a replacement websocket that allow to use other stuff like some emulator and the Snes Classic
*websocket server 21:13
SmokeMachine ufobat: but what do you want to add to the module?
ufobat StrictClass ?
SmokeMachine ufobat: yes... what that that code doesn't do yet? 21:14
timotimo Skarsnik: "some emulator" :D
Skarsnik RetroArch and a special patched snes9x 21:15
masak pmurias: are you suggesting what Perl 6 has is _not_ gradual typing? do you have an example of a language that does have it?
yoleaux 16:59Z <jmerelo> masak: you have Dec 5th in the Advent scheduler. Is it ready?
ufobat i dont know, maybe nothing. but if you compare to MooseX::StrictContructor is sufficient to load the module, maybe there is more pretty way to achive that your class is a strict class
right now you need to do `does StrictClass` right?
masak yoleaux: how do I reply back to jmerelo using you? 21:16
timotimo you can have that module export a "sclass" exporthow that adds the StrictClass by itself
ufobat idk what people want, for me it is already exactly what i need
timotimo masak: you can just ".tell jmerelo blah"
SmokeMachine ufobat: yes...
sena_kun masak, `.tell $nickname $message`
masak .tell it's not ready, but I'm still planning to write it before the 5th. today is the 3rd. hope that works ;)
yoleaux masak: What kind of a name is "it's"?!
ufobat but, not knowing how to improve it makes me a bad module owner
masak .tell jmerelo it's not ready, but I'm still planning to write it before the 5th. today is the 3rd. hope that works ;)
yoleaux masak: I'll pass your message to jmerelo.
masak by my calculations, I have more than a day to write it. 21:17
timotimo masak: well, hopefully you can squeeze in one or two review-refinement cycles :)
masak yes, good point
Skarsnik unrelated, could we have a pragam that enforce compilation to check method type?
masak I'll aim for having it ready mid-tomorrow-night, European time 21:18
timotimo well, in theory yeah, you just have to come up with a scheme of restrictions that you'd like
masak Skarsnik: "check method type"?
Skarsnik because 99% of the time you don't add new method dynamicly
timotimo masak: i assume something like C++'s virtual method restrictions
21:18 Xliff joined
masak ah. 21:18
timotimo oh, i think i was wrong
Skarsnik no, more like my Foo $a; $a.lsllkd; should not compile 21:19
21:19 p6bannerbot sets mode: +v Xliff
timotimo ah 21:19
masak only if $a is initialized in that scope
otherwise, it could be a subclass which has that method 21:20
cf "exact type"
timotimo i think that's an accepted trade-off
Skarsnik The type is know for this example
SmokeMachine ufobat: that can help you to improve your skills? :)
masak timotimo: sure, but in that case, it's a narrower language than Perl 6.
Skarsnik I don't expect the compiler to figure for code like my $a = somerandomsub(); $a.piko;
timotimo indeed 21:21
that's why Skarsnik wants a pragma :)
ufobat SmokeMachine, :D ha!
Skarsnik yes, because I know you COULD add method at runtime
but 99% you never do that
masak speak for yourself :P
masak .oO( most people only use 1% of the raw power of their Perl 6 ) 21:22
masak .oO( my code is so dynamic, even the methods added at runtime have methods added at runtime! ) 21:23
timotimo no need to add a method at runtime, can also just have a method defined in a subclass
Skarsnik: how do you feel about checking argument types as well? 21:24
Skarsnik yes that too
timotimo that'll be even more fun :) 21:25
Skarsnik I mean when I explicitly use type I kinda expect to have the compiler for a maximum of stuff he can solve
timotimo but yeah, i think you could do it with a slang.
do you also want subclasses to be restricted in what methods they can install under the same name?
masak surely arguments must be allowed to be subtypes? 21:26
timotimo i'd expect that
masak otherwise you can't bind an Int argument to a Real parameter
Skarsnik related, can we now finally add overload in a subclass for no multi method in the base class? 21:27
timotimo what'd be the difference between putting a proto or only method in the subclass? 21:28
Skarsnik I had a real case use for that, but I can remember
*can't
m: class A {method foo() {say "A"}}; class B is A {method foo(Int $a) {say $a}}; my B $b; $b.foo(42); 21:29
camelia 42
Skarsnik m: class A {method foo() {say "A"}}; class B is A {method foo(Int $a) {say $a}}; my B $b; $b.foo(42); $b.foo(); 21:30
camelia 42
Too few positionals passed; expected 2 arguments but got 1
in method foo at <tmp> line 1
in block <unit> at <tmp> line 1
timotimo oh, do you mean you want to be able to extend a base class that doesn't use "multi", but you want the "only" method from the base class become one candidate in your subclass' multi method?
patrickb goes to bed 21:31
'night everyone.
21:31 patrickb left
Skarsnik well since the subclass herit the method from the baseclass this should work 21:32
timotimo well, it's not how subclassing works in perl6 :) 21:33
but it shouldn't be too hard to put this in a trait
Skarsnik even if it was in a role it does not work
m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; my B $b; $b.foo(42); $b.foo(); 21:34
camelia 42
Too few positionals passed; expected 2 arguments but got 1
in method foo at <tmp> line 1
in block <unit> at <tmp> line 1
timotimo no i mean a trait that makes this behaviour available
Skarsnik m: role A {method foo() {say "A"}}; class B does A {}; my B $b; $b.foo();
camelia A
Skarsnik There is not obvious reason that make it not working ^^
m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; say B.^can; 21:35
camelia Too few positionals passed; expected 3 arguments but got 2
in block <unit> at <tmp> line 1
Skarsnik m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; say B.^can('foo); 21:36
21:36 holyghost left
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1)
at <tmp>:1
------> 3foo(Int $a) {say $a}}; say B.^can('foo);7⏏5<EOL>
expecting …
21:36
Skarsnik m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; say B.^can('foo');
camelia (foo)
21:36 holyghost joined 21:37 p6bannerbot sets mode: +v holyghost
timotimo m: sub trait_mod:<is>(Any:U $c, Array :$inherits-onlys-from-base) { say "need to take methods from $c.^mro.tail"; say $c.^mro.tail.^methods.grep(*.name eq $inherits-only-from-base.any).say; }; class A { method foo() { say "A" } }; class B is inherits-onlys-from-base("foo") { multi method foo(Int $a) { say $a } }; 21:38
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$inherits-only-from-base' is not declared. Did you mean '$inherits-onlys-from-base'?
at <tmp>:1
------> 3ay $c.^mro.tail.^methods.grep(*.name eq 7⏏5$inherits-only-from-base.any).say; …
timotimo m: sub trait_mod:<is>(Any:U $c, Array :$inherits-onlys-from-base) { say "need to take methods from $c.^mro.tail"; say $c.^mro.tail.^methods.grep(*.name eq $inherits-onlys-from-base.any).say; }; class A { method foo() { say "A" } }; class B is inherits-onlys-from-base("foo") { multi method foo(Int $a) { say $a } };
camelia 5===SORRY!5=== Error while compiling <tmp>
Type check failed in binding to parameter '$c'; expected Any but got B (?)
at <tmp>:1
timotimo m: sub trait_mod:<is>(Mu:U $c, Array :$inherits-onlys-from-base) { say "need to take methods from $c.^mro.tail"; say $c.^mro.tail.^methods.grep(*.name eq $inherits-onlys-from-base.any).say; }; class A { method foo() { say "A" } }; class B is inherits-onlys-from-base("foo") { multi method foo(Int $a) { say $a } };
camelia 5===SORRY!5=== Error while compiling <tmp>
Type check failed in binding to parameter '$inherits-onlys-from-base'; expected Array but got Str ("foo")
at <tmp>:1
timotimo m: sub trait_mod:<is>(Mu:U $c, :$inherits-onlys-from-base) { say "need to take methods from $c.^mro.tail"; say $c.^mro.tail.^methods.grep(*.name eq $inherits-onlys-from-base.any).say; }; class A { method foo() { say "A" } }; class B is inherits-onlys-from-base("foo") { multi method foo(Int $a) { say $a } };
camelia 5===SORRY!5=== Error while compiling <tmp>
No such method 'Str' for invocant of type 'B'
at <tmp>:1
timotimo m: sub trait_mod:<is>(Mu:U $c, :$inherits-onlys-from-base) { say "need to take methods from $c.^mro.tail.^name()"; say $c.^mro.tail.^methods.grep(*.name eq $inherits-onlys-from-base.any).say; }; class A { method foo() { say "A" } }; class B is inherits-onlys-from-base("foo") { multi method foo(Int $a) { say $a } };
camelia need to take methods from B
()
True
21:38 |oLa| left
timotimo m: sub trait_mod:<is>(Mu:U $c, :$inherits-onlys-from-base) { say "need to take methods from $c.^mro.tail.^name()"; say $c.^mro.tail.^methods; }; class A { method foo() { say "A" } }; class B is inherits-onlys-from-base("foo") { multi method foo(Int $a) { say $a } }; 21:39
camelia need to take methods from B
()
Skarsnik m: role A {multi method foo() {say "A"}; multi method foo(Str $s){}}; class B does A {method foo(Int $a) {say $a}}; my B $b; $b.foo(42); $b.foo();
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot have a multi candidate for 'foo' when an only method is also in the package 'B'
at <tmp>:1
timotimo m: sub trait_mod:<is>(Mu:U $c, :$inherits-onlys-from-base) { say "need to take methods from $c.^mro.tail.^name()"; say $c.^mro.tail(2).head.^methods; }; class A { method foo() { say "A" } }; class B is inherits-onlys-from-base("foo") { multi method foo(Int $a) { say $a } };
camelia need to take methods from B
()
timotimo ...
i should take this to a local :)terminal
Skarsnik m: role A {multi method foo() {say "A"}; multi method foo(Str $s){}}; class B does A {multi method foo(Int $a) {say $a}}; my B $b; $b.foo(42); $b.foo();
camelia 42
A
Skarsnik why this work lol
I mean it's annoying that the base class need to have multi at all 21:40
timotimo it could be that the mro doesn't contain the base until the class is composed 21:41
Skarsnik I kinda think that this is not consistent at all outside if you understand the internal
timotimo couldn't you have told me that i forgot to "is B"? :D
Skarsnik I am too drunk for that! 21:42
timotimo aaaand i forgot to make the trait mode a multi sub, too 21:43
Skarsnik I mean you are jsut doing a "hacky" workaround x) 21:44
timotimo no, amazing metaprogramming
Xliff m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; say B.^can('foo');
camelia (foo)
Xliff m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; say B.new.foo
camelia Too few positionals passed; expected 2 arguments but got 1
in method foo at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; say B.new.foo(1)
camelia 1
True
Xliff m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; B.new.foo(1) 21:45
camelia 1
21:45 Sound joined, p6bannerbot sets mode: +v Sound
Xliff m: role A {method foo() {say "A"}}; class B does A {method foo(Int $a) {say $a}}; B.new.foo(1) 21:45
camelia 1
Skarsnik why do you get a True?
Xliff That's taking quite a while. Compose?
Skarsnik: Trying to say something twice.
timotimo there we go
m: multi sub trait_mod:<is>(Mu:U $c, :$inherits-onlys-from-base!) { for $c.^mro.head(2).tail.^methods.grep(*.name eq $inherits-onlys-from-base.any) { $c.^add_multi_method($_.name, $_) } }; class A { method foo() { say "A" } }; class B is A is inherits-onlys-from-base("foo") { multi method foo(Int $a) { say $a } }; B.foo(42); B.foo()
camelia 42
A
timotimo behold
Xliff timotimo: And what is this greatness? 21:46
timotimo well, Skarsnik's problem was:
Skarsnik it's just a workaround. It should work out of the box xD
timotimo if the base class defines a method without "multi", the subclass will override it with whatever you put into the subclass, even if it's a multi
so if you want to have only methods as candidates to your new multi, you can use this trait on the subclass 21:47
and it will put the methods back in for you
Skarsnik The signature is not the same, I don't even get why it replace it
21:47 neteng1198s joined, p6bannerbot sets mode: +v neteng1198s
timotimo that's the difference between only and multi, Skarsnik :P 21:47
Skarsnik but the issue you cannot put multi for one method on the base class 21:48
so etheir way, it's always hacky
timotimo you're going against the wishes of the base class, of course it won't just happen by itself with not a single bit of work :) 21:49
neteng1198s User inputs motorcycles and I have an array @motorcycles = qw(ducati,honda,yamaha). It would then print this array. Is this possible?
timotimo neteng1198s: if you use qw you don't put comma in between :) 21:50
21:50 Sound left
timotimo do you mean when the user inputs "motorcycles" your code will look if a variable named "@motorcycles" exists and outputs that? 21:50
neteng1198s timotimo: sorry typed wrong .... but you get the gist
Skarsnik timotimo, it work for most OO language? since the full signature is the definition of the method, not just the name
neteng1198s yes
Skarsnik m: my $hello = "foo"; say ${"hello}; 21:51
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of ${"hello}; in Perl 6 please use $("hello) for hard ref or $::("hello) for symbolic ref
at <tmp>:1
------> 3my $hello = "foo"; say ${"hello}7⏏5;
Skarsnik m: my $hello = "foo"; say ${"hello"};
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of ${"hello"}; in Perl 6 please use $("hello") for hard ref or $::("hello") for symbolic ref
at <tmp>:1
------> 3my $hello = "foo"; say ${"hello"}7⏏5;
Skarsnik hm
timotimo that was the same code again :P
Skarsnik I forget to close the " in the first 21:52
timotimo m: my @motorcycles = <ducati honda yamaha>; my @animals = <cat banana>; my $userinput = "motorcycles"; say @::($userinput).perl
camelia ["ducati", "honda", "yamaha"]
timotimo m: my @motorcycles = <ducati honda yamaha>; my @animals = <cat banana>; my $userinput = "animals"; say @::($userinput).perl
camelia ["cat", "banana"]
Skarsnik oh it's with ()
timotimo it's telling you to try $::("hello") :)
21:53 cpage left
timotimo neteng1198s: just to be sure, you're working with perl6, right? not perl5? 21:53
neteng1198s no I'm current on 5.10 ATM
timotimo ah, in that case the code i showed you won't work
Skarsnik this dumb "thing" is used in Http::UA cookies
timotimo since perl6 is the very different rewrite that is developed at the same time as perl5 is 21:54
eater m: my $i = "no"; multi trait_mod:<is> (Variable $a, :$b) { $i = $b; dd $i; }; my $x is b<yes>; dd $i; 21:55
camelia Str $i = "yes"
Str $i = "no"
Skarsnik Anyways, I think that just the name is used for a method overload is a bug xD
eater How do I make sure $i stays yes? :o
Skarsnik my $i is ro? 21:56
timotimo eater: i'm not entirely sure what the problem is 21:57
eater I'm trying to change a variable in trait_mod, but it seems to get reset to the original value 21:58
timotimo it's a compile-time / run-time thing
Skarsnik trait are compile time
timotimo my $i = "no" actually compiles to an assignment
eater I guessed so
is there a way to work around that?
timotimo should be able to change the default i suppose?
m: my $i; say $i.VAR.^methods 21:59
camelia (<anon> <anon> new name of default dynamic WHICH BUILDALL)
21:59 rindolf left
timotimo m: my $i = 8000; BEGIN $i.VAR.default = 9000; say $i 21:59
camelia 5===SORRY!5=== Error while compiling <tmp>
An exception occurred while evaluating a BEGIN
at <tmp>:1
Exception details:
Cannot modify an immutable 'Any' type object
in code at <tmp> line 1
timotimo well, not like that
neteng1198s ok.... is that possible in 5?
timotimo neteng1198s: yes, it is for sure
22:00 ryn1x joined
timotimo stackoverflow.com/questions/628565...her-scalar - this might be the right thing for you 22:00
22:00 p6bannerbot sets mode: +v ryn1x
timotimo though the answers are pretty don't-do-that, so perhaps you can use a hash of arrayrefs instead 22:01
so i guess like my %topics = motorcycles => \[qw( yamaha honda ducati )], animals => \[qw( cat banana )]; my $userinput = "animals"; print @$topics{$userinput} 22:02
that's probably not valid perl5, i haven't coded perl5 much 22:03
but i'm sure you get the idea
good luck, neteng1198s! perhaps try #perl on this same network (or is it ##perl?)
neteng1198s Thanks timotimo 22:05
going to try in a minute
SmokeMachine timotimo: [] already return a ref
timotimo oh, it does? cool.
22:05 graphene left
timotimo i'll head to the kitchen and make super-late dinner :) 22:05
22:07 graphene joined, p6bannerbot sets mode: +v graphene
eater I found a nice solution 22:09
m: my $i = "no"; $i = BEGIN $i; multi trait_mod:<is> (Variable $a, :$b) { $i = $b; dd $i; }; my $x is b<yes>; dd $i; 22:10
camelia Str $i = "yes"
Str $i = "yes"
eater I do feel extremely dirty now
SmokeMachine my %topics = (motorcycles => [qw(yamaha honda ducati )], animals => [qw( cat banana )]); my $userinput = "animals"; print join(", ", @{$topics{$userinput}}), $/ 22:11
neteng1198s: ^^
22:11 Skarsnik left
neteng1198s SmokeMachine: is it better in a hash? 22:12
Just read your response on hashes as well timotimo 22:13
22:15 kensanata left
neteng1198s Thanks SmokeMachine that worked. 22:20
22:21 coet joined, p6bannerbot sets mode: +v coet, ufobat left
SmokeMachine neteng1198s: :) but just to let you know: this code is perl... and perl6 is a different language... 22:21
neteng1198s wonderful lol 22:24
does this means lots of scripts will break when I finally upgrade? 22:25
SmokeMachine neteng1198s: no, because its not the next version... it really is a different language...
neteng1198s any recommended reading 22:26
?
SmokeMachine neteng1198s: upgrading perl will not get you perl6...
22:26 ryn1x left, ryn1x joined
neteng1198s ok 22:27
22:27 p6bannerbot sets mode: +v ryn1x 22:34 ryn1x left
SmokeMachine neteng1198s: en.wikipedia.org/wiki/Perl_6 22:34
22:37 reisinge joined, p6bannerbot sets mode: +v reisinge, |oLa| joined 22:38 p6bannerbot sets mode: +v |oLa|
timotimo we have the perl5 to perl6 documents on the docs page 22:40
docs.perl6.org/language.html#___top - second section, the "migration guides" has them
if you want to "upgrade" (though it's really a sidegrade i guess?) your code from perl5 to perl6, you can do it on a module-by-module basis and use Inline::Perl5 on the perl6 side or Inline::Perl6 on the perl5 side 22:43
22:46 reisinge left 23:03 sena_kun left 23:16 Cabanossi left 23:17 Cabanossi joined 23:18 p6bannerbot sets mode: +v Cabanossi 23:22 pmurias left 23:23 kurahaupo_ joined, p6bannerbot sets mode: +v kurahaupo_ 23:26 kurahaupo left
neteng1198s Thanks timotimo ... I think I'm going to hold off for the moment. 23:30
SmokeMachine: How can I access a single element in the array of the hash? Like get the value of motorcycles and the 2nd element (honda)? 23:32
23:33 dct joined, p6bannerbot sets mode: +v dct
AlexDaniel Sharparam: oh! Nice! 23:33
SmokeMachine neteng1198s: my %topics = (motorcycles => [qw(yamaha honda ducati )], animals => [qw( cat banana )]); my $userinput = "animals"; print join(", ", $topics{$userinput}->[0]), $/
AlexDaniel huggable: advent
huggable AlexDaniel, Sign up to write an Advent blog post: github.com/perl6/mu/blob/master/mi...8/schedule
AlexDaniel that's not the right link! 23:34
huggable: advent :is: Sign up to write an Advent blog post: github.com/perl6/advent/blob/maste...8/schedule
huggable AlexDaniel, Added advent as Sign up to write an Advent blog post: github.com/perl6/advent/blob/maste...8/schedule
AlexDaniel wow that looks full
SmokeMachine m: my %topics = motorcycles => [<yamaha honda ducati>], animals => [<cat banana>]; my $userinput = "animals"; say %topics{$userinput}.head # neteng1198s in perl6 23:35
23:35 kurahaupo_ left
camelia cat 23:35
23:46 pecastro left 23:57 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo