»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
00:04 wbill joined 00:22 BenGoldberg left 00:25 wbill left 00:26 grondilu left 00:27 yqt left 00:30 BenGoldberg joined
Xliff_ Can you specify the type of array elements in a signature? 00:31
gfldex m: sub f(Array[Int] $a){ dd $a }; f(Array[Int](1,2,3)); 00:32
camelia rakudo-moar 7500ea: OUTPUT«Array[Int] $a = Array[Int].new(1, 2, 3)␤»
00:32 colomon left, huggable left
gfldex m: sub f(Int @a){ dd @a }; f(Array[Int](1,2,3)); 00:33
camelia rakudo-moar 7500ea: OUTPUT«Array[Int].new(1, 2, 3)␤»
gfldex Xliff_: ^^^
00:33 skink joined
Xliff_ gfldex: Ah! Thank you! 00:34
m: sub f(Int @a) { dd @a }; f([1, 2, 3]); 00:35
camelia rakudo-moar 7500ea: OUTPUT«Type check failed in binding @a; expected Positional[Int] but got Array ($[1, 2, 3])␤ in sub f at /tmp/pQCMo69Coq line 1␤ in block <unit> at /tmp/pQCMo69Coq line 1␤␤»
gfldex you are feeding it Array[Any] 00:36
Xliff_ Hmmm... Don't know if I want to force the caller to have to specifcally write "Array[Int]"
00:36 kurahaupo joined
Xliff_ gfldex, yeah, but I'm writing API bindings. 00:36
00:37 colomon joined
Xliff_ If this were my own code, I wouldn't care. However I'm shooting for ease of use. I will just manually type check in the routine. 00:37
gfldex you could provide a multi
00:41 itaipu left 00:46 BenGoldberg left 00:49 BenGoldberg joined 00:54 kurahaupo left 00:55 sufrostico left
skink Hey Xliff_ 00:56
Xliff_ \o 00:58
01:01 colomon left, sufrostico joined, colomon joined, aries_liuxueyang joined 01:07 BenGoldberg left 01:14 buharin_ left 01:16 BenGoldberg joined
Xliff_ OK, here's a question. I have a class B that inherits from a class A. Both classes implement module M. If I want a method to refer to the M from class A, how would I do that? 01:22
s/module M/method M/ 01:23
01:24 BenGoldberg left 01:28 colomon left 01:31 buharin_ joined
gfldex m: class A { method m() { say 'I haz a A' } }; class B is A { method m(){ say 'I haz a B'; self.A::m(); } }; B.new.m; 01:32
camelia rakudo-moar 7500ea: OUTPUT«I haz a B␤I haz a A␤»
gfldex Xliff_: ^^^
01:32 BenGoldberg joined 01:34 molaf left 01:41 espadrine left 01:46 BenGoldberg left, molaf joined 01:48 BenGoldberg joined, sufrostico left 01:52 Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 02:06 labster left 02:11 pierre joined
b2gills m: class A { method m() { say 'I haz a A' } }; class B is A { method m(){ say 'I haz a B'; self.A::m(); } }; B.new.A::m; 02:13
camelia rakudo-moar 7500ea: OUTPUT«I haz a A␤»
02:14 teatime joined
dalek c: b27c0d1 | titsuki++ | doc/Type/Rational.pod:
Fix a typo DenomT to DeT
02:24
c: 595d4ec | titsuki++ | doc/Type/Rational.pod:
Merge pull request #558 from titsuki/fix-typo

Fix a typo DenomT to DeT
02:26 pierre left 02:30 labster joined, BenGoldberg left 02:31 pierre joined 02:32 BenGoldberg joined 02:36 pierre left 02:46 noganex_ joined 02:49 noganex left
Xliff_ gfldex++ && b2gills++: Thanks! 02:54
03:00 colomon joined 03:02 TakinOver joined 03:05 TakinOver left 03:08 TakinOver joined 03:15 TakinOver left 03:16 TakinOver joined, kid51 left 03:20 TakinOver left 03:26 skids left 03:27 TakinOver joined 03:28 willthechill left 03:33 TakinOver left
Xliff_ Opening a 8M P6 --profile HTML file in Chrome takes a bit. 03:38
Well, this file has become quite the problem. 03:45
I can't open it in Chrome, and it looks like FireFox will fail as well.
Profile data looks to be too large for their JS engines. 03:46
Oh! Firefox finally opened!
03:48 skink left 04:04 ssotka joined 04:08 BenGoldberg left 04:10 skids joined 04:31 Cabanossi left 04:34 Cabanossi joined
tadzik Xliff; have you tried the qt profiler frontend? 04:38
Xliff_: github.com/tadzik/p6profiler-qt 04:39
it doesn't have all the features of the angular version, but it will show you the profiling data with which the browser shits itself :) 04:40
04:44 kurahaupo joined 04:45 finanalyst left
Xliff_ tadzik, thanks for the suggestion! 04:50
Now I just need to know how to interpret the data. For some reason my code is running exceptionally slow.
I want to see why. 04:51
04:51 Sgeo left 04:52 khw left 04:53 Sgeo joined, kurahaupo_ joined 04:57 kurahaupo left, kurahaupo_ left 05:14 jjido joined 05:21 bjz joined, bjz_ left 05:34 wbill joined 05:37 anomie__ joined
anomie__ Is it a bug that it's so easy to pass malformed UTF-8 as an argument with linenoise? 05:37
05:38 Actualeyes joined
tadzik Xliff_: you're welcome :) Let me know if anything breaks in it, or if there's some feature that you really miss in it 05:40
05:40 adu joined 05:41 adu left
anomie__ linenoise really doesn't seem to work well with multi-byte characters 05:43
I'll upload a video in a minute to show what I mean. 05:44
This is a known bug, right? comfy.moe/eadsqp.ogv 05:46
05:54 jjido left, bjz_ joined
anomie__ I think what happens, is that pressing backspace on the linenoise REPL removes one byte, rather than one character. 05:54
05:55 bjz left
tadzik from what I remember from the linenoise source, that may be exactly the case 05:56
anomie__ All right. My internet is slow and annoying af so I won't do it right now, but we should see if there's an issue for that, cuz some like me (and perhaps some mac users), like to use an elipsis (…) instead of three dots (...), and other things. 05:58
I guess that's really not high on the priority list though, it's pretty petty. 05:59
But then again, with my limited knowledge it seems like low-hanging fruit to me.
05:59 pierre joined 06:00 Actualeyes left, bjz joined 06:02 jack_rabbit joined 06:03 bjz_ left 06:15 domidumont joined 06:16 Actualeyes joined 06:19 domidumont left, domidumont joined 06:20 jack_rabbit left
Xliff_ tadzik: I'm seeing serious delays before INIT in the one-liner I'm running. It's using a module that I'm developing, and I can't see why it is so slow. 06:28
Given the code, it looks like the slowdown is in the parsing. However, I can't really tell because I'm not well-versed in the profile output. 06:29
tadzik Xliff_: I'm not sure profiler will show you the parsing/module loading times 06:31
but this is known to be quite a slow process
try 'time perl6 -MYour::Module -e1'?
Xliff_ k
real 0m3.828s 06:33
user 0m3.756s
sys 0m0.068s
So parse time of around 4 seconds and another 2-3 for deserialization using Perl5's XML::Hash::XS 06:35
That includes retrieval via HTTP::UserAgent
06:36 rindolf joined 06:41 mohae__ left, cpage_ joined 06:43 patrickz joined 06:53 rurban joined, rurban left 06:55 RabidGravy joined, ssotka left 07:03 rurban1 joined 07:10 wamba joined, jjido joined 07:18 darutoko joined 07:20 jjido left 07:21 wamba left 07:22 wamba joined 07:23 CIAvash joined 07:28 setty1 joined 07:33 Tonik joined, Tonik left 07:50 rurban joined 07:53 espadrine joined 07:54 wamba left, rurban1 left
RabidGravy right, all the modules working again 07:56
which came down to four instances of the builtin JSON parser being deprecated and used accidentally, one external dependency getting messed up, one "something odd going on with versioned dependencies" and two "WTF! why do I even bother" which required some re-writing 07:59
:-\
08:13 wbill left 08:29 finanalyst joined 08:30 patrickz left 08:32 AlexDaniel joined 08:34 firstdayonthejob joined 08:36 cpage_ left, sno left, [Sno] joined 08:37 rurban1 joined 08:38 rurban2 joined, rurban3 joined 08:40 rurban left 08:41 rurban1 left 08:42 rurban2 left 08:45 spider-mario joined 08:46 anomie__ left 08:48 rurban joined 08:50 rurban3 left 08:53 domidumont left 08:54 labster left 08:57 xinming left 08:58 xinming joined 08:59 labster joined
RabidGravy I think I am going to go back to once a week 08:59
08:59 anomie__ joined
RabidGravy I settled on once a month, shortly *after* a release, but that's too easy to let slide and doesn't catch regressions quickly enough 09:00
09:05 CIAvash left 09:09 rurban left 09:10 rurban joined 09:11 jjido joined
rindolf Hi all! "rakudobrew build moar" here (after a previous older build) fails with this error - paste.debian.net/712176/ - I'm on Mageia v6 x86-64. 09:11
RabidGravy .tell jnthn, if you want to look at the weird channel/react/promise interaction I was on about yesterday you will need github.com/jonathanstowe/Audio-Lib...tag/v0.0.8 - libshout and icecast are available as packages on nearly all Linux and BSDs, you may need to adjust the icecast.xml 09:12
yoleaux RabidGravy: What kind of a name is "jnthn,"?!
RabidGravy .tell jnthn if you want to look at the weird channel/react/promise interaction I was on about yesterday you will need github.com/jonathanstowe/Audio-Lib...tag/v0.0.8 - libshout and icecast are available as packages on nearly all Linux and BSDs, you may need to adjust the icecast.xml
yoleaux RabidGravy: I'll pass your message to jnthn.
09:15 Actualeyes left
RabidGravy rindolf, it is possible that they layout of some of the precompiled artefacts have changed, I'd suggest removing the whole "/home/shlomif/Download/unpack/perl/p6/rakudobrew/moar-nom/install" and trying again 09:15
anyway I'm off out to a garden show
rindolf RabidGravy: bye
RabidGravy toodles 09:16
09:18 CIAvash joined 09:20 RabidGravy left 09:22 xinming_ joined 09:25 pierre left, xinming left 09:27 Actualeyes joined
dalek c: 97cbb75 | (Jan-Olof Hendig)++ | doc/Type/Array.pod:
Added docs for method of in class Array
09:31
09:39 Emeric joined
dalek pan style="color: #395be5">perl6-examples: 48133d0 | (Shlomi Fish)++ | categories/euler/prob286-shlomif.p6:
add a solution to Euler #286.
09:50
09:51 wamba joined 09:56 TEttinger left 09:57 pmurias joined 10:02 xinming_ is now known as xinming, labster left 10:05 jjido left 10:06 Emeric1 joined 10:07 Emeric left, Emeric1 is now known as Emeric 10:09 Emeric left 10:11 patrickz joined 10:14 iH2O joined 10:25 iH2O left 10:27 pierre joined 10:29 setty1 left 10:34 patrickz left 10:37 pierre left 10:40 grondilu joined
grondilu Hello #perl6 10:41
10:41 pierre joined 10:44 finanalyst left
pmurias hi 10:45
10:46 Actualeyes left
tadzik hello from Mal-moo o/ 10:51
10:51 pierre left 10:53 Emeric joined 10:56 pierre joined 10:58 iH2O joined 10:59 iH2O left, Actualeyes joined
pmurias tadzik: where is that? 11:04
tadzik southern Sweden, it's actually Malmo
11:05 kurahaupo joined, kurahaupo left, iH2O joined
pmurias tadzik: any perl events bringing you there? 11:08
tadzik nah, just work stuff 11:09
rindolf grondilu: hi, how are you?
tadzik it's a lot warmer than last time though
11:11 Emeric left 11:19 iH2O left 11:23 rindolf left 11:25 pierre left 11:30 kid51 joined 11:32 patrickz joined
dogbert17 o/ #perl6 11:45
if anyone wants to review my attempt to document Array.default the gist is here: gist.github.com/dogbert17/aee462bd...15e449c3b3 11:48
11:50 wamba left
AlexDaniel m: my @a1 of Str is default(42) 11:54
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/up9kK8EjjG␤Default value '42' will never bind to a parameter of type Array[Str]␤at /tmp/up9kK8EjjG:1␤------> 3my @a1 of Str is default(42)7⏏5<EOL>␤ expecting any of:␤ constraint␤»
11:54 pmurias left
AlexDaniel eh, LTA 11:55
dogbert17 AlexDaniel: ah my secon example is bogus, thx 11:56
s/secon/second/
AlexDaniel dogbert17: huh? my snippet is not related to your gist 11:57
dogbert17: in fact, there's nothing wrong with your gist
dogbert17 AlexDaniel: true, you scared me :) and my code actually works, pheew 11:58
AlexDaniel: thx for taking a look 11:59
12:00 tokomer joined
AlexDaniel dogbert17++ 12:00
12:02 ggoebel114 joined
dogbert17 AlexDaniel: thx, btw have you tried running the first code example here doc.perl6.org/type/Lock 12:02
it's broken but I don't have a clue what it should look like 12:03
12:03 pierre joined
AlexDaniel dogbert17: it's broken. Let's see 12:04
dalek c: 5a14b51 | (Jan-Olof Hendig)++ | doc/Type/Array.pod:
Added docs for Array.default. AlexDaniel++
12:06 tokomer left 12:07 pmurias joined
AlexDaniel dogbert17: ok 12:09
dogbert17 AlexDaniel: noticed it yesterday but am unable to fix it due to lack of knowledge 12:10
AlexDaniel dogbert17: it should be using ‘start’ and there has to be no ‘for’, but I'm trying to come up with an example that demonstrates the problem 12:11
12:11 kurahaupo joined
dogbert17 afk time for a walk in the sun 12:12
AlexDaniel m: my $x = 0; await (^1000).map: { start { sleep 0.1; $x++ }; }; say $x; 12:13
camelia rakudo-moar beb3c9: OUTPUT«Memory allocation failed; could not allocate 14960 bytes␤»
12:13 jjido joined
AlexDaniel m: my $x = 0; await (^100).map: { start { sleep 0.1; $x++ }; }; say $x; 12:13
camelia rakudo-moar beb3c9: OUTPUT«Memory allocation failed; could not allocate 14960 bytes␤»
AlexDaniel oh come on
m: my $x = 0; await (^10).map: { start { sleep 0.1; $x++ }; }; say $x;
camelia rakudo-moar beb3c9: OUTPUT«10␤»
AlexDaniel m: my $x = 0; await (^10).map: { start { sleep 0.1; $x++ }; }; say $x;
camelia rakudo-moar beb3c9: OUTPUT«10␤»
AlexDaniel dogbert17: ok, if you run that kind of thing on your own computer, you will see that the result is sometimes different
12:14 Emeric joined
AlexDaniel m: my $x = 0; my $l = Lock.new; await (^10).map: { start { $l.protect({ sleep 0.001; $x++ }); } }; say $x; 12:16
camelia rakudo-moar beb3c9: OUTPUT«10␤»
AlexDaniel dogbert17: and I believe that this is the right example ↑
dogbert17: get rid of that sleep though
dogbert17: gist.github.com/AlexDaniel/93949b1...f248fe0286 12:20
dogbert17: I'm not sure if that's the best example to show there, but I hope that you will be able to figure it out 12:22
12:26 |meta joined 12:30 PotatoGim joined 12:32 Emeric left, Emeric joined, huggable joined, firstdayonthejob left 12:38 Actualeyes left 12:47 mspo left 12:52 Actualeyes joined 12:54 aries_liuxueyang left, aries_liuxueyang joined 12:59 jferrero joined, rurban left 13:00 brrt joined 13:06 jjido left
tailgate Let's say I import a module with use 13:26
does use execute statements in the module? Could I include setup code for that module at the the end?
Like for example, when that module is loaded, I'd like to load a csv file into a static class member 13:27
psch tailgate: the module mainline runs during import, the module BEGIN time runs during module compilation 13:28
13:29 ecocode joined
psch so e.g. a < module Foo { BEGIN say "hi"; say "bye" } > would print "hi\nbye\n" on first 'use' after creation, and only "bye\n" on subsequent uses without changing the module 13:30
(because we do have largely working precompilation :) )
tailgate can BEGIN blocks be in just a file, or do they have to be in a module? 13:31
psch what do you mean "a file"? 13:32
they can be in any perl6 program, yes
tailgate that
psch if that program is a module or a, well, script only matters for the mentioned semantics
m: say "bye"; say BEGIN "hi" 13:33
camelia rakudo-moar beb3c9: OUTPUT«bye␤hi␤»
psch m: say "bye"; BEGIN say "hi" # duh
camelia rakudo-moar beb3c9: OUTPUT«hi␤bye␤»
pochi m: sub foo() { return [1,2,3], [<foo bar baz>] }; my (@a, @b) = foo(); say @b; 13:34
camelia rakudo-moar beb3c9: OUTPUT«[]␤»
psch m: sub foo() { return [1,2,3], [<foo bar baz>] }; my (@a, @b) := foo(); say @b;
camelia rakudo-moar beb3c9: OUTPUT«[foo bar baz]␤»
pochi o.O 13:35
something about binding?
psch pochi: you're returning one container from &foo
pochi: that container contains two arrays
pochi right
psch pochi: and gets assigned to the first array in your declaration
pochi: binding lowers that by one container level 13:36
well, lowers the RHS
pochi is that the same ':' that goes infront of signatures? 13:37
psch it works as a mnemonic i suppose
which is probably the intend between the language design :)
pochi :-)
psch it's not the 'the same' in so far as that it doesn't work along the same code path or anything, but the semantics are very alike, yeah 13:38
pochi I see. thank you 13:39
13:42 grondilu left 13:44 pmurias left 13:53 kaare_ joined
dogbert17 AlexDaniel: many thanks for the code, do you want to commit the changes or should I? 13:54
AlexDaniel dogbert17: well, the point of my gist was to show you the intent of that code example :) So please do it yourself 13:56
dogbert17: also, thanks for working on the docs. I love your contributions
dogbert17 AlexDaniel: will commit and thx for the kind words
dalek c: 56f9f93 | (Jan-Olof Hendig)++ | doc/Type/Lock.pod:
Corrected broken example. AlexDaniel++ for providing a working example
14:01
AlexDaniel dogbert17: uh, oh! 14:02
dogbert17: there's no need for ‘for’
dogbert17 AlexDaniel: oops, will fix before anyone notices :) 14:03
AlexDaniel dogbert17: does it compile with for? 14:04
nope 14:05
timotimo you'd need to have "await do for" i suppose
oh, actually
there's a map there, too
AlexDaniel await $_ perhaps
but it's redundant
timotimo await (^10).map: { ... } should do fine 14:06
AlexDaniel yea
dogbert17: by the way, what editor do you use?
dalek c: 552ae16 | (Jan-Olof Hendig)++ | doc/Type/Lock.pod:
Had forgotten to remove a 'for' statement that should not be there
14:07
dogbert17 AlexDaniel: emacs
AlexDaniel dogbert17: perhaps you want to take a look at something like this: www.emacswiki.org/emacs/WhiteSpace 14:09
dogbert17: I don't care about it too much, but there are people who are pissed off when they see trailing whitespace :) 14:10
dogbert17: but generally it is a good idea to make your editor show more stuff
dogbert17 AlexDaniel: thx, will take a look
14:11 spider-mario left, spider-mario joined 14:15 RabidGravy joined 14:26 mohae joined, rurban joined 14:30 colomon left
RabidGravy boom 14:31
dogbert17 and he survived the garden show :) 14:34
dalek c: b7a4665 | titsuki++ | doc/Language/contributors.pod:
Add a contributor
14:35
c: c5fbf85 | titsuki++ | doc/Language/contributors.pod:
Merge pull request #560 from titsuki/add-contributor

Add a contributor
14:35 brrt left 14:40 domidumont joined 14:41 itaipu joined
AlexDaniel perhaps someone should also extract other missing names from git history ¯\_(ツ)_/¯ 14:41
ah, that's not just the contributors to docs 14:42
nvm then
tony-o does nativecall not play well with passing anonymous subs?
14:42 Zoffix joined
Zoffix m: use Test; cmp-ok 2, '==', 5, 'seems sane'; 14:42
camelia rakudo-moar beb3c9: OUTPUT«not ok 1 - seems sane␤␤# Failed test 'seems sane'␤# at /tmp/d2nEW6X5dj line 1␤# expected: '5'␤Sub+{<anon|52917568>}+{Precedence} object coerced to string (please use .gist or .perl to do that) in block at /home/camelia/rakudo-m-inst-1/share/per…»
Zoffix m: use Test; cmp-ok 2, '<', 5, 'seems sane';
camelia rakudo-moar beb3c9: OUTPUT«not ok 1 - seems sane␤␤# Failed test 'seems sane'␤# at /tmp/kqui3siS7u line 1␤# Could not use '<' as a comparator␤»
Zoffix Are docs wrong or test is broken? docs.perl6.org/language/testing#By_...comparison 14:43
14:43 pierre left
Zoffix or am I doing something wrong 14:43
psch m: use Test; cmp-ok 2, &[<], 5, 'seems sane';
camelia rakudo-moar beb3c9: OUTPUT«ok 1 - seems sane␤»
Zoffix Right, but docs claim you can use strings
psch m: cmp-ok 'my spelling is apperling', '~~', /perl/, "bad speller";
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/MRHnuRA5ME␤Undeclared routine:␤ cmp-ok used at line 1␤␤»
psch m: use Test; cmp-ok 'my spelling is apperling', '~~', /perl/, "bad speller";
camelia rakudo-moar beb3c9: OUTPUT«ok 1 - bad speller␤»
Zoffix :S
AlexDaniel m: use Test; cmp-ok 2, ‘<’, 5, ‘seems sane’; 14:44
camelia rakudo-moar beb3c9: OUTPUT«not ok 1 - seems sane␤␤# Failed test 'seems sane'␤# at /tmp/FjSPldGCl2 line 1␤# Could not use '<' as a comparator␤»
psch m: say EVAL '&infix:<<>'
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /home/camelia/EVAL_0␤Unable to parse expression in shell-quote words; couldn't find final '>>' ␤at /home/camelia/EVAL_0:1␤------> 3&infix:<<>7⏏5<EOL>␤ expecting any of:␤ colon pair␤ …»
Zoffix m: use Test; cmp-ok 2, '<', /5/, 'seems sane';
camelia rakudo-moar beb3c9: OUTPUT«not ok 1 - seems sane␤␤# Failed test 'seems sane'␤# at /tmp/djFBXzEOCs line 1␤# Could not use '<' as a comparator␤»
psch m: say EVAL '&infix:<==>'
camelia rakudo-moar beb3c9: OUTPUT«sub infix:<==> (Mu $?, Mu $?) { #`(Sub+{<anon|52917568>}+{Precedence}|37044272) ... }␤»
Zoffix Ahhh
psch if $op ~~ Callable ?? $op !! try EVAL "&infix:<$op>" -> $matcher {
is the offending line in Test.pm
changing it to < "&infix:('$op')" probably largely fixes it 14:45
well, unless we got a comparator that uses ', of course :)
the cleanest solution might actually be changing the Signature to expect a Callable for $op and ditching the EVAL bit
and of course adjusting the docs 14:46
Zoffix m: say &infix:("meow")
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/CbNZ8GjfG2␤You can't adverb ␤at /tmp/CbNZ8GjfG2:1␤------> 3say &infix:("meow")7⏏5<EOL>␤»
psch m: say &infix:('<')
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/VRJRa9C2Gf␤You can't adverb ␤at /tmp/VRJRa9C2Gf:1␤------> 3say &infix:('<')7⏏5<EOL>␤»
psch huh, that form doesn't work?
14:46 aries_liuxueyang left
psch oh, right, brackets, not parens 14:46
m: say &infix:['<']
camelia rakudo-moar beb3c9: OUTPUT«sub infix:«<» (Mu $?, Mu $?) { #`(Sub+{<anon|52917568>}|70515680) ... }␤»
Zoffix m: my $op = '<'; say &infix:[$op]
psch m: say &infix:['meow']
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/ns1RvCJvoy␤Undeclared routine:␤ infix:<meow> used at line 1. Did you mean 'infix:<∖>', 'infix:<lt>', 'infix:<eq>', 'infix:<o>', 'infix:<~|>'?␤␤»
rakudo-moar beb3c9: OUTPUT«Use of uninitialized value <element> of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in any canonicalize_pair at src/Perl6/World.nqp line 4331␤Use of uninitialized value <element> of type A…»
AlexDaniel m: say Q「「「「「「hello」」」」」」
camelia rakudo-moar beb3c9: OUTPUT«hello␤»
Zoffix AlexDaniel++ 14:47
14:47 aries_liuxueyang joined
psch m: BEGIN my $op = "<"; say &infix:<<$op>> 14:48
camelia rakudo-moar beb3c9: OUTPUT«sub infix:«<» (Mu $?, Mu $?) { #`(Sub+{<anon|52917568>}|45354096) ... }␤»
psch m: constant $op = "<"; say &infix:<<$op>>
camelia rakudo-moar beb3c9: OUTPUT«sub infix:«<» (Mu $?, Mu $?) { #`(Sub+{<anon|52917568>}|54107248) ... }␤»
psch Zoffix: the look up is compile time
Zoffix But yeah, +1 on ditching the eval. &[] vs '' is just one char away
14:50 patrickz left
Zoffix m: run "ls" 14:53
camelia rakudo-moar beb3c9: OUTPUT«run is disallowed in restricted setting␤ in sub restricted at src/RESTRICTED.setting line 1␤ in sub run at src/RESTRICTED.setting line 14␤ in block <unit> at /tmp/wWcCMBi30n line 1␤␤»
Zoffix m: use Test; cmp-ok '', '~~>;warn run "ls"; my $x =<z', '', '';
camelia rakudo-moar beb3c9: OUTPUT«Perlito␤dalek-queue␤evalbot␤evalbot.log␤foo␤lib␤log␤mbox␤nqp-js␤p1␤p2␤p6eval-token␤perl5␤rakudo-j-1␤rakudo-j-2␤rakudo-j-inst␤rakudo-j-inst-1␤rakudo-j-inst-2␤rakudo-m-1␤rakudo-m-2␤rakudo-m-inst␤rakudo-m-inst-1␤rak…»
Zoffix snickers
AlexDaniel Zoffix: yeah. Awesome. Good job. 14:55
Zoffix 👏👏👏 14:56
15:00 espadrine left
pochi Type check failed for return value; expected Array[Numeric] but got Array[Numeric].new() 15:01
Zoffix pochi, we can't fix a code we can't see :) 15:02
dalek c: 7c4d9d2 | (Jan-Olof Hendig)++ | doc/Type/Bag.pod:
Fixed two broken links
pochi I just don't understand the error
aren't those the same? 15:03
Zoffix You're returning a wrong type, though how you got Array[Numeric].new() to be a type is beyond me
psch m: say Array[Numeric] eqv Array[Numeric].new
camelia rakudo-moar beb3c9: OUTPUT«False␤»
Zoffix m: say Array[Numeric].new 15:04
camelia rakudo-moar beb3c9: OUTPUT«[]␤»
Zoffix m: say Array[Numeric].new.WHAT
camelia rakudo-moar beb3c9: OUTPUT«(Array[Numeric])␤»
Zoffix shrugs
15:04 rindolf joined
psch m: sub f(--> Array[Numeric].new) { Array[Numeric] } 15:04
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/gKMBGKWejc␤Type 'Array' is not declared. Did you mean 'array'?␤at /tmp/gKMBGKWejc:1␤------> 3sub f(--> Array[Numeric]7⏏5.new) { Array[Numeric] }␤»
AlexDaniel m: my @a of Numeric; @a[0] = Array[Numeric].new
camelia rakudo-moar beb3c9: OUTPUT«Type check failed in assignment to @a; expected Numeric but got Array[Numeric] (Array[Numeric].new())␤ in block <unit> at /tmp/pBjySgI1TG line 1␤␤»
psch m: sub f() return Array[Numeric].new { Array[Numeric] }
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/wNDPYf43v4␤Missing block␤at /tmp/wNDPYf43v4:1␤------> 3sub f()7⏏5 return Array[Numeric].new { Array[Numer␤ expecting any of:␤ new name to be defined␤»
psch m: sub f() returns Array[Numeric].new { Array[Numeric] }
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/m0p1IMyvz9␤Missing block␤at /tmp/m0p1IMyvz9:1␤------> 3sub f() returns Array[Numeric]7⏏5.new { Array[Numeric] }␤ expecting any of:␤ new name to be defined␤»
psch m: sub f() returns (Array[Numeric].new) { Array[Numeric] }
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/QUVB391BGq␤Malformed trait␤at /tmp/QUVB391BGq:1␤------> 3sub f() returns7⏏5 (Array[Numeric].new) { Array[Numeric] }␤»
Zoffix Or pochi can actually show their code so we wouldn't need to spam trying to guess it? :)
psch hah! 15:05
AlexDaniel m: my @a of Numeric; @a[0] = Array[Numeric].new
camelia rakudo-moar beb3c9: OUTPUT«Type check failed in assignment to @a; expected Numeric but got Array[Numeric] (Array[Numeric].new())␤ in block <unit> at /tmp/dp_mmfAONE line 1␤␤»
psch that would be easy :P
AlexDaniel well that's close enough
ah no, not even close
psch m: sub f() returns Array[Numeric] { Array[Numeric].new }; f()
camelia ( no output )
psch well, that just works
m: sub f(--> Array[Numeric]) { Array[Numeric].new }; f() # so does this 15:06
camelia ( no output )
psch so, whatever is going on there definitely needs a code example :)
pochi I'll try to find a small non-working sample
psch pochi: why not just put your whole code on a pastebin?
AlexDaniel psch: or we can introduce a new game here
psch: come up with a code snippet that produces the same output 15:07
pochi psch: it's quite a lof of code already :-)
spanning multiple files
AlexDaniel psch: there are some interesting ones, like “Segmentation fault” xD
15:08 wamba joined
AlexDaniel nowadays I'm not sure if there's something that makes rakudo segfault. I think that all my code in segfaulty tickets now produce some kind of an error instead 15:08
psch m: use NativeCall; sub free is native {*}; free(0) 15:09
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/8uyATnGRHa␤Calling free(Int) will never work with declared signature ()␤at /tmp/8uyATnGRHa:1␤------> 3use NativeCall; sub free is native {*}; 7⏏5free(0)␤»
psch m: use NativeCall; sub free(int $) is native {*}; free(0)
camelia rakudo-moar beb3c9: OUTPUT«Potential difficulties:␤ In 'free' routine declaration - Not an accepted NativeCall type for parameter [1] : int␤ --> For Numerical type, use the appropriate int32/int64/num64...␤ at /tmp/MW2h9AxSQx:1␤ ------> 3ativeCall; sub free(in…» 15:10
psch m: use NativeCall; sub free(int32 $) is native {*}; free(0)
camelia ( no output )
psch wonders *what* that actually does
pochi: maybe --ll-exception can help you to figure out what's going on
Zoffix RFC to disallow string comparators in cmp-ok: rt.perl.org/Ticket/Display.html?id=128283 15:11
psch m: use NativeCall; sub malloc(int32 $a, int32 $b) is native {*}; malloc(0, 8)
camelia ( no output )
psch stops messing with libc :P
AlexDaniel and that's not fair anyway
15:12 rurban left
Zoffix m: kill 11, $*PID 15:17
camelia rakudo-moar beb3c9: OUTPUT«5===SORRY!5=== Error while compiling /tmp/zqB18EzhkS␤Undeclared routine:␤ kill used at line 1␤␤»
Zoffix :(
dalek c: 35dd2bc | (Zoffix Znet)++ | doc/Language/5to6-perlfunc.pod:
Fix typo
15:18
AlexDaniel Zoffix: well, why don't you use your eval trick
Zoffix AlexDaniel, ??? 15:19
15:19 zakharyas joined
AlexDaniel Zoffix: run(‘kill’, 11, $*PID) 15:19
Zoffix Ah
meh
Not sure how good "Now part of the Proc::Async class, but looks to work as in Perl 5." is in 5to6 docs for kill. Considering the Proc's kill method is just for that proc. 15:20
m: use Test; cmp-ok '', '~~>;warn run(‘kill’, 11, $*PID); <z', '', '';
camelia rakudo-moar beb3c9: OUTPUT«(signal TERM)kill: sending signal to 11 failed: Operation not permitted␤»
Zoffix tsk tsk
m: use Test; cmp-ok '', '~~>;warn run(‘kill’, $*PID, 11); <z', '', ''; 15:21
camelia rakudo-moar beb3c9: OUTPUT«(signal TERM)kill: sending signal to 11 failed: Operation not permitted␤»
geekosaur "-11" 15:26
otherwise you're sending SIGTERM to pid 11 as well as whatever pid you intended
Zoffix Ah, right
m: use Test; cmp-ok '', '~~>;warn run(‘kill’, "-11", $*PID); <z', '', '';
camelia rakudo-moar beb3c9: OUTPUT«(signal SEGV)»
pochi I got it down to a few lines of code: pastee.org/pxjsh 15:28
but I can't get it down under 3 files :-(
psch that's a bit weird 15:29
pochi thank you :-) 15:30
almost whatever I do to change any ocde in the 3 files, the error goes away
Hm, seems XXX doesn't have to be a class with Numeric, just a 'my Numeric @a;' also triggers it. 15:33
psch well, it doesn't happen on rakudo-jvm, fwiw :) 15:35
...not that that'd help
pochi :-) 15:36
psch cause rakudo-jvm is unfortunately still pretty broken :/
anyway, i'd guess it might be something about reuse of parametrized roles..?
well, across SC boundary 15:37
15:37 finanalyst joined
Zoffix I somehow managed to make it not throw that error by changing has to my and so on and then changing back to original it work... and when I nuked .precomp the error reappeared :/ 15:37
psch pochi: can you RT your example?
pochi aye
psch 'cause i can really only guess that it might be somewhere in that direction, and have no real clue how to follow up on my guess... :) 15:38
RabidGravy Zoffix this sounds a similar problem to what I had the other day with Lumberjack 15:55
Zoffix I think psch's hunch is more relevant. I may have just stumbled onto another bug with precomp not being invalidated 15:58
s/relevant/closer to the cause of poch's bug/; 15:59
CIAvash I think this is the same bug: rt.perl.org/Public/Bug/Display.html?id=127309 16:03
16:03 telex left 16:04 telex joined
geekosaur wow, that's a "fun" looking bug 16:04
16:05 vike left
pochi that looks exactly the same 16:05
16:07 vike joined 16:16 camelia joined
dalek c: 8507fd5 | (Zoffix Znet)++ | html/ (2 files):
Add to easily get a link to a section a user is reading
16:18
16:18 ChanServ sets mode: +v camelia 16:22 finanalyst left 16:29 wooy joined 16:32 huggable left, huggable joined
titsuki Hi. Does anyone know how to implement Visitor Pattern in Perl 6 ? (SEE ALSO: rt.perl.org/Ticket/Display.html?id=128275 ) 16:34
16:36 vendethiel joined, hankache joined
timotimo titsuki: to be honest, i'd just put both into the same file and maybe give it two different export flags to get around the problem? 16:37
even if you don't do the export flag thing, you can continue experimenting with visitor patterns and such
BBIAB 16:38
hankache afternoon #perl6 16:41
16:41 buharin_ left
Zoffix \o 16:43
16:43 Nicq joined
titsuki timotimo: hmm, honestly to say "put both into the same file" doesn't seem the best solution... 16:43
geekosaur it's not. but we're still working bugs out of this stuff. 16:44
might see if it works with "no precompilation;" at the top? 16:45
psch actually, circular referencing of modules is never gonna work
llfourn ^^
Zoffix psch, how come?
llfourn because you can't depend on a module that depends on you
psch Zoffix: because of one pass parsing
Zoffix psch, I see
psch Zoffix: we have to know what A means when we parse B, and we have to know what B means when we parse A
Zoffix: which is clearly an infinite loop :) 16:46
llfourn titsuki: you could declare roles in the same file and have the classes in different files.
16:47 Nicq left
geekosaur I think some answer is going to be needed here, or this is going to become a problem 16:47
Zoffix It does seem as an obvious flaw however. You can't set specific types to, say, attributes any time you want
16:48 pecastro left
llfourn I think that's what roles are for. ie declare roles upfront in one file and then just depend on that file. Sorta like a .h file. 16:48
Zoffix isn't sure what that means 16:49
ugexe this usually means you want some form of dependency inversion
with a shared interface 16:50
Zoffix If I have Foo that takes .bar of type Bar and Bar that takes .foo of type Foo I have to shove them in one file for the sole reason that Perl 6 can't handle circular references.
llfourn instead of A.pm depending on B.pm and B.pm depending on A.pm you have R.pm which both depend on and the classes in A.pm and B.pm implement the roles.
the roles in R.pm are declared in the same file
so basically rather than declaring huge classes in the same file you have small roles in the same file. 16:51
Zoffix :/
llfourn and the classes in different files.
Zoffix I don't get how that solves anything.
But maybe we're talking about different things... 16:52
mst it gets rid of the need for the circular dependency, I think
llfourn hmm ok I'll write a gist to show how it can solve what I percieve as titsuki problem.
titsuki llfourn: thanks ! 16:53
llfourn ok take a look at: gist.github.com/LLFourn/df95c23e88...2580431c15 16:59
the idea being is that you can still typecheck everything without the circular dependency 17:00
I totally get the desire to modules that refer to eachother though. I have even brought this up myself in this channel. 17:01
titsuki llfourn: thanks a lot ! It looks good to me. 17:02
llfourn I do have some large .pm files with may too many interdependent classes in them because I cbf creating a central role file.
titsuki: no worries let me know if you think of anything better :)
Zoffix llfourn++ 17:05
17:07 jjido joined 17:11 jjido left 17:13 smls joined
gfldex is there a way to get hold of the return value of a wrapee inside the wrapper? 17:17
llfourn gfldex: do you mean with .wrap? 17:18
gfldex yes
llfourn m: sub foo { "inside" }; &foo.wrap: { my $res = callsame; $res.uc }; say foo(); 17:19
camelia rakudo-moar beb3c9: OUTPUT«inside␤»
llfourn hmm..
gfldex callsame and friends never return
llfourn err really :S 17:20
m: sub foo { "inside" }; &foo.wrap: { my $res = nextsame; $res.uc }; say foo();
gfldex whould i lie to you?
camelia rakudo-moar beb3c9: OUTPUT«inside␤»
llfourn what's the one that returns then?
I could have sworn callsame returns 17:21
m: sub foo { "inside" }; &foo.wrap: { my $res = callwith(); $res.uc }; say foo();
camelia rakudo-moar beb3c9: OUTPUT«inside␤»
gfldex i don't know the answer, hence my question.
llfourn callsame is meant to return
docs.perl6.org/language/functions # according to docs at least 17:22
jnthn m: use soft; sub foo { "inside" }; &foo.wrap: { my $res = callwith(); $res.uc }; say foo();
camelia rakudo-moar beb3c9: OUTPUT«INSIDE␤»
yoleaux 09:12Z <RabidGravy> jnthn: if you want to look at the weird channel/react/promise interaction I was on about yesterday you will need github.com/jonathanstowe/Audio-Lib...tag/v0.0.8 - libshout and icecast are available as packages on nearly all Linux and BSDs, you may need to adjust the icecast.xml
jnthn Note the `use soft` which is needed if you're going to wrap at runtime 17:23
llfourn m: sub foo { "inside" }; BEGIN &foo.wrap: { my $res = callwith(); $res.uc }; say foo();
camelia rakudo-moar beb3c9: OUTPUT«INSIDE␤»
llfourn jnthn++ thanks
dalek c: 04948f2 | (Zoffix Znet)++ | html/js/main.js:
Fix type error
17:24
17:30 buharin_ joined 17:35 firstdayonthejob joined
gfldex where do we doc pragmas like `use soft;`? 17:36
smls Could this bug be related to precomp? rt.perl.org/Ticket/Display.html?id...xn-1403174
^^ nine
Something seems to be going wrong when loading compunits that use parameterized types.
Zoffix Oh christ... in my Perl 6 Workshop posts, in the design I forgot to include how the function will know what API key to use! I wonder if I can spin it like the omission was deliberate all part of my plan.... 17:43
llfourn smls: you can tell if it's related to precomp by just doing "no precompilation;" at the top of the .pm files 17:44
and see if it still goofs
ugexe fwiw it works if you declare your modules `unit module A`, `unit module B` 17:45
so its printing once during precomp, and once during runtime 17:46
smls llfourn: Adding `no precompilation;` to B.pm indeed fixes it!
llfourn ;) 17:47
dalek c: 60e2099 | (Zoffix Znet)++ | html/css/style.css:
Fix CSS bug with title anchors
18:03
18:10 FROGGS joined
FROGGS o/ 18:11
18:13 hankache_ joined
psch o/ FROGGS 18:13
bartolin \o FROGGS 18:14
tadzik FROGGS! \o/ 18:16
FROGGS :o)
18:16 hankache left
Zoffix New post: Perl 6 Hands-On Workshop: Weatherapp (Part 3): perl6.party/post/Perl-6-Hands-On-Wo...pp--Part-3 18:18
18:20 daxim joined 18:23 mr-foobar left
llfourn Zoffix++ 18:23
18:24 xfix left 18:25 xfix joined 18:28 hankache_ left, hankache joined
Zoffix WANT! (camelia plush) scontent-yyz1-1.xx.fbcdn.net/v/t1....e=57CC298B 18:28
psch that is adorable 18:29
18:29 itaipu left
DrForr They're terribly cute. 18:29
llfourn haha that's awesome
18:29 vendethiel left, yqt joined
Emeric Camelia --> <3 18:30
tadzik aww :}
18:35 mr-foobar joined 18:53 darutoko left 18:54 grondilu joined 19:00 ssotka joined 19:01 labster joined 19:06 TakinOver joined 19:07 rindolf left 19:08 rindolf joined 19:21 zakharyas left 19:26 domidumont left 19:32 CIAvash left 19:51 TEttinger joined
masak tfw you start writing a blog post about something interesting, and finishing up the blog post gets further and further away because you keep finding more interesting things 19:57
19:57 xtreak joined, xtreak left
Zoffix What does 'tfw' mean? 19:58
grondilu that feel when
Zoffix ah
grondilu I did not know, had to look it up
Zoffix I tried to look it up but couldn't find anything useful :/
grondilu google found me the relevant entry as top choice. 19:59
masak I thought it meant "that feeling when"... but I'm getting old, so maybe it means "feel" :P
it's pretty common on Twitter
grondilu www.urbandictionary.com/define.php?term=TFW
masak would anyone here mind getting it as a minichallenge while I struggle to write it up? :)
Zoffix ehehe www.urbandictionary.com/define.php?term=Zoffix 20:00
tadzik lol 20:01
masak clicking urbandictionary links always fills me with trepidation 20:02
20:02 kaare_ left
tadzik I'm still a bit sad and a bit amused at what I got when looking up "AFAB" there 20:02
mst masak: I know it as 'that feeling when', but shortening feeling to feel seems to be a thing in general 20:03
tadzik . o O ( right in the feels )
huf i've seen fee-fees too
tadzik I read that as "feces" 20:04
huf eventually it'll be gnileef
masak mst: so far, I took "teh feelz" to be a l33t way to say "strong emotions"
tadzik it opens so many possibities too!
"I want to be hardcore but I'm sensitive inside" :]
masak maybe it's a soft core within a bigger hard core 20:05
tadzik ooh
masak like Toffifees 20:06
tadzik giggles
oh, sorry: "teh giggz"
mst masak: ARMADILLO
CRUNCHY ON THE OUTSIDE, CHEWY ON THE INSIDE
masak heh 20:07
20:07 TEttinger left
tadzik hm, so soft core within a bigger hard-core.. that makes it dual-core? 20:08
20:11 jjido joined 20:32 ecocode left, huggable left, huggable joined 20:38 _28_ria left 20:40 jjido left 20:41 _28_ria joined
Zoffix Does my code look really "clever" on perl6.party/post/Perl-6-Hands-On-Wo...pp--Part-3 ? 20:42
20:42 jjido joined
Zoffix Wondering if I should bother responding to this comment or to chuck it into the troll bin: www.reddit.com/r/programming/comme...ng/d3ocbmn 20:42
dalek c: c72d7ba | (Jan-Olof Hendig)++ | doc/Type/IO/Socket/Async.pod:
Fixed typo and a broken link
20:43
mst Zoffix: no, it looks exactly the right level of stupid for test code to me
Zoffix stupid? :/
gnull m: my $a = dir '/'; say $a; 20:44
camelia rakudo-moar 4a7eaa: OUTPUT«("/boot".IO "/home".IO "/opt".IO "/srv".IO "/tmp".IO "/usr".IO "/var".IO "/etc".IO "/dev".IO "/proc".IO "/sys".IO "/run".IO "/lib".IO "/sbin".IO "/bin".IO "/lib64".IO "/mnt".IO "/root".IO "/selinux".IO)␤»
gnull m: my @a = dir '/'; say @a;
camelia rakudo-moar 4a7eaa: OUTPUT«["/boot".IO "/home".IO "/opt".IO "/srv".IO "/tmp".IO "/usr".IO "/var".IO "/etc".IO "/dev".IO "/proc".IO "/sys".IO "/run".IO "/lib".IO "/sbin".IO "/bin".IO "/lib64".IO "/mnt".IO "/root".IO "/selinux".IO]␤»
gnull what the hack?
Zoffix gnull, ? 20:45
gnull why can i store array into scalar?
smls because this is not Perl 5 :P
moritz because an array is an object
Zoffix gnull, because this isn't Perl 5 :P
gnull I didn't expect the first example to work)
mst Zoffix: replied.
Zoffix: because I could say the last sentence. 20:46
AlexDaniel well, you can store arrayref in a scalar in perl 5
Zoffix mst++ thanks :D
AlexDaniel my $x = [4, 8, 15, 16]
smls gnull: In Perl 6, a $ variable is a container that can hold any object.
which includes Array objects.
Zoffix gnull, the @ and % sigils are more about getting Positional and Associative roles for free, rather than storing specifically Arrays or Hashes 20:47
At least that's my feel for them. Not that I'm an expert
gnull does containig array in `$` somehow differ from `@` ?
AlexDaniel you have to access elements like $x->[1] though (in perl 5)
smls gnull: A @ variable is always a *defined* Array object. And assigning to it, replaces the elements of the array instead of creating a new one. 20:48
gnull m: sub f(@x){say @x}; my $a = [1,2,3]; f $a;
camelia rakudo-moar 4a7eaa: OUTPUT«[1 2 3]␤»
smls Whereas a $ variable starts out undefined,m and can hold any defined or undefined value/object.
Zoffix m: my @a; say @a.WHAT; my Array $a; say $a.WHAT 20:49
camelia rakudo-moar 4a7eaa: OUTPUT«(Array)␤(Array)␤»
Zoffix smls, I don't get what you mean. 20:50
I guess my question would be: why the hell would I want to ever use @a or %a?
smls m: my @a; say @a; my Array $a; say $a
camelia rakudo-moar 4a7eaa: OUTPUT«[]␤(Array)␤»
RabidGravy m: my @a; say @a.defined; my Array $a; say $a.defined
camelia rakudo-moar 4a7eaa: OUTPUT«True␤False␤»
gnull YEs, what is the fundamental difference? 20:51
AlexDaniel the difference is in syntax, basically
m: my $x = 4, 8, 15; # can't do that
camelia rakudo-moar 4a7eaa: OUTPUT«WARNINGS for /tmp/Uh4kxUUQMT:␤Useless use of constant integer 15 in sink context (lines 1, 1)␤Useless use of constant integer 8 in sink context (lines 1, 1)␤»
AlexDaniel m: my Sx = 4, 8, 15; # can do that
camelia rakudo-moar 4a7eaa: OUTPUT«5===SORRY!5=== Error while compiling /tmp/zKRJG4kSUw␤Malformed my (did you mean to declare a sigilless \Sx or $Sx?)␤at /tmp/zKRJG4kSUw:1␤------> 3my Sx7⏏5 = 4, 8, 15; # can do that␤»
AlexDaniel oops
m: my @x = 4, 8, 15; # can do that
camelia ( no output )
20:52 mohae_ joined
AlexDaniel m: my $x = (4, 8, 15, 16); say ‘hi’ for $x # does not DWIM 20:52
camelia rakudo-moar 4a7eaa: OUTPUT«hi␤»
AlexDaniel m: my @x = (4, 8, 15, 16); say ‘hi’ for @x # DWIMs
camelia rakudo-moar 4a7eaa: OUTPUT«hi␤hi␤hi␤hi␤»
gnull assigning to $a happens in scalar context, but to @a is in list context. Right?
AlexDaniel m: my $x = (4, 8, 15, 16); say ‘hi’ for @$x
camelia rakudo-moar 4a7eaa: OUTPUT«hi␤hi␤hi␤hi␤»
smls gnull: Yes.
Well, there is no context in the PErl 5 sense
but assigning to @a accepts a list on the right-hand side 20:53
20:54 mohae left
smls Zoffix: You could get away without ever using @ variables. At the end of the day, what they offer over $ variables is convenience for working with arrays. 20:54
Zoffix I see. So they'
I see. So they're far less "important" than in Perl 5...
or "fundamental" I guess
smls Well, I do still use them all the time... :P 20:55
gnull m: my $a = [1,2,3]; say @$a;
camelia rakudo-moar 4a7eaa: OUTPUT«[1 2 3]␤»
gnull m: my $a = [1,2,3]; &$a;
camelia ( no output )
gnull feels like storing an array in $var is like references in perl5 20:56
smls gnull: You can think of every $ variable in Perl 6 as an implicit reference, if that helps. 20:57
gnull In the last example I'm trying to derefer a reference to an array as function
m: my $a = [1,2,3]; say &$a; 20:58
camelia rakudo-moar 4a7eaa: OUTPUT«[1 2 3]␤»
smls gnull: There is Perl 5-like referencing/dereferencing in Perl 6.
AlexDaniel Zoffix: you can get away without @ in perl 5 as well
Zoffix AlexDaniel, true
gnull, there is no references in Perl 6. 20:59
gnull Looks like &$a evaluates to an array. But I'm trying to derefer it as a function
mst in perl5 you effectively only need @foo as sugar barring maaaybe performance bits too
smls gnull: Oops, I meant "there is *no* ..." 21:00
The @() contectualizer in @$a is simply short for $a.list
No idea what &() even does 21:01
Zoffix What does &$a do? I don't see & as a prefix op on docs.perl6.org/language/operators
m: my $x = 5; say &$x() 21:02
21:02 FROGGS left
camelia rakudo-moar 4a7eaa: OUTPUT«No such method 'CALL-ME' for invocant of type 'Int'␤ in block <unit> at /tmp/n61yoUs0cn line 1␤␤» 21:02
Zoffix m: my $x = 5; say &$x
camelia rakudo-moar 4a7eaa: OUTPUT«5␤»
gnull m: my $x = 5; say $x()
camelia rakudo-moar 4a7eaa: OUTPUT«No such method 'CALL-ME' for invocant of type 'Int'␤ in block <unit> at /tmp/m0ldQ8G7RO line 1␤␤»
smls Zoffix: design.perl6.org/S03.html#line_222 21:03
gnull I tried to derefer like in perl5, now I see that it doesn't work. Looks like & before $variable does nothing.
smls Zoffix: They are contextualizers (i.e. special syntax), not prefix operators.
$() calls .item, @() calls .list, %() calls .hash. 21:04
Zoffix & calls... ?
smls No idea.
Zoffix :P
gnull m: my $a = [1,2,3]; say a.list;
camelia rakudo-moar 4a7eaa: OUTPUT«5===SORRY!5=== Error while compiling /tmp/Uls0EwDttb␤Undeclared routine:␤ a used at line 1␤␤»
gnull m: my $a = [1,2,3]; say $a.list; 21:05
camelia rakudo-moar 4a7eaa: OUTPUT«[1 2 3]␤»
gnull m: my $a = [1,2,3]; say $a.list.list;
camelia rakudo-moar 4a7eaa: OUTPUT«[1 2 3]␤»
Zoffix gnull, personally, I found forgetting all of my Perl 5 helpful when learning Perl 6. It's just too different a language to try to just map the concepts and end up with decent code.
smls Well, no need to forget all of Perl 5. Just everything about references... :P 21:06
Zoffix and the subroutine arguments/parameters
gnull Fortunately I haven't dived deep into perl5, so will not take much time to forget it
Zoffix :) 21:07
gnull Is there a way to get all of class instance methods in perl6? I mean everything that can go after `$a.` 21:09
Something like `dir` in python?
smls $a.^methods
m: say "Hello world".^methods 21:11
camelia rakudo-moar 4a7eaa: OUTPUT«(BUILD Int Num chomp chop pred succ simplematch match ords samecase samemark samespace word-by-word trim-leading trim-trailing trim encode NFC NFD NFKC NFKD wordcase trans indent codes chars uc lc tc fc tclc flip ord WHY WHICH Bool Str Stringy DUMP ACCEPTS…»
gnull my $a = [1,2]; my @b = [1, 2]; say $a.^methods eqv @b.^methods
m: my $a = [1,2]; my @b = [1, 2]; say $a.^methods eqv @b.^methods 21:12
camelia rakudo-moar 4a7eaa: OUTPUT«True␤»
smls Zoffix: Do you know if there's a way to add diagrams/images to the content p6doc pages? 21:17
Zoffix No idea.
Well, we have type charts, so I guess there *is* a way :)
Like this one: docs.perl6.org/type/BagHash#See_Also 21:18
geekosaur gnull, that probably won't help because there's this thing where an item acts like an array-like thing with one item in it
21:18 wamba left
smls I don't think those are included from the POD content though 21:18
but rather, added procedurally to type pages by htmlify
gnull Thank you. It became much more clear for me. 21:19
geekosaur m: my $x; my @x; say $x.HOW; say @x.HOW 21:21
camelia rakudo-moar 4a7eaa: OUTPUT«Perl6::Metamodel::ClassHOW.new␤Method 'gist' not found for invocant of class 'Perl6::Metamodel::ClassHOW+{<anon>}'␤ in block <unit> at /tmp/RAegQ2wWx8 line 1␤␤»
21:21 Emeric left
geekosaur neither of those very helpful, sigh 21:21
arnsholt m: my $x; say $x.HOW.^name # maybe? 21:23
camelia rakudo-moar 4a7eaa: OUTPUT«Perl6::Metamodel::ClassHOW␤»
21:23 rurban joined, rurban left
arnsholt Right. Not terribly helpful either, I suppose 21:23
21:24 mohae_ left 21:26 hankache left
smls What kind of help did you expect from it? 21:28
21:29 geraud joined
geekosaur was hoping there'd be more differing between them. I think the first one was as close as I got; the ClassHOW with Positional role mixed in didn't have a .gist 21:37
21:40 nowan left 21:43 nowan joined 21:53 BenGoldberg joined
gnull Hmm, is there a way to make a regexp from string at runtime? 22:03
For example, I want the user to supply the regex in config. 22:04
geekosaur $foo interpolates literally in a regex, <$foo> interpolates as a regex 22:06
22:06 brabo left, brabo joined
gnull Cool, thanks. 22:15
22:15 spider-mario left
anomie__ How could I print an Int as a unicode code point? 22:17
smls m: say 123.chr
camelia rakudo-moar 4a7eaa: OUTPUT«{␤»
anomie__ Ah, all right. Thanks. 22:18
22:18 RabidGravy left
BenGoldberg m: say chr 123 22:19
camelia rakudo-moar 4a7eaa: OUTPUT«{␤»
22:19 firstdayonthejob left, titsuki left, bjz left
tailgate I'm trying to figure out why this code requires an instance: I'd like it to be a static variable. 22:21
gist.github.com/ahalbert/e10146b45...9610e9e2e0
Zoffix tailgate, because @.elements is an instance attribute. You may want to use my @.elements 22:22
tailgate thanks 22:23
Zoffix It may also need `is rw` to make it writable, though I don't remember if class attributes are writable by default
m: class Foo { my @.meow }; Foo.meow = ^10; say Foo.meow 22:24
camelia rakudo-moar 4a7eaa: OUTPUT«[0 1 2 3 4 5 6 7 8 9]␤»
Zoffix they are
22:30 rvchangue joined 22:31 ssotka left 22:32 BenGoldberg left 22:34 BenGoldberg joined 22:39 BenGoldberg left 22:40 smls left 22:41 BenGoldberg joined 22:42 titsuki joined 22:46 bjz joined, diakopter left 22:48 BenGoldberg left
anomie__ Heh, my perl script is gonna be a script to generate every possible emoji character (including the combinatorial ones). 22:50
22:50 BenGoldberg joined 22:52 diakopter joined 22:55 nadim left 22:56 kurahaupo left, chee joined, anomie__ left 22:57 chee left, chee joined 22:58 AlexDaniel left, BenGoldberg left 23:00 bjz left 23:01 jjido left 23:06 BenGoldberg joined 23:13 anomie__ joined
anomie__ So, how do I define a range/array of Ints as a subroutine's signature? 23:13
Zoffix m: sub foo (@foo where { .all ~~ Int }) { say @foo }; say foo [1, 2, 3] 23:14
camelia rakudo-moar 4a7eaa: OUTPUT«[1 2 3]␤True␤»
anomie__ Thanks. 23:16
Zoffix m: my @rray of Int = 1, 2, 3, 'a' 23:17
camelia rakudo-moar 4a7eaa: OUTPUT«Type check failed in assignment to @rray; expected Int but got Str ("a")␤ in block <unit> at /tmp/0NnRxToN9n line 1␤␤»
Zoffix m: sub foo (@foo of Int) { say @foo }; say foo [1, 2, 3]
camelia rakudo-moar 4a7eaa: OUTPUT«5===SORRY!5=== Error while compiling /tmp/kapVti1LxH␤Cannot call trait_mod:<of>(Parameter, Int); none of these signatures match:␤ (Mu:U $target, Mu:U $type)␤ (Routine:D $target, Mu:U $type)␤at /tmp/kapVti1LxH:1␤»
Zoffix I wonder, is the latter failing just a matter of defining a new multi for the trait_mod:<of>? 23:18
Seems a useful and oft-requested functionality.
anomie__ Yeah. 23:20
arnsholt m: sub foo(int @foo) { ... } # <- not what you want? 23:26
camelia ( no output )
Zoffix Nope 23:27
m: sub foo(int @foo) { ... }; foo [1, 2, 3] 23:28
camelia rakudo-moar 4a7eaa: OUTPUT«Type check failed in binding @foo; expected Positional[int] but got Array ($[1, 2, 3])␤ in sub foo at /tmp/6JQeHZzegD line 1␤ in block <unit> at /tmp/6JQeHZzegD line 1␤␤»
Zoffix I think the term for your version is "parameterized", while the original regards the contents of the array
23:31 adu joined 23:38 rindolf left
arnsholt Zoffix: I think that's because [1,2,3] is Array[Any] 23:39
m: sub foo(int @foo) { say @foo }; my int @foo = 1,2,3; foo(@foo) # Should work, I think?
camelia rakudo-moar 4a7eaa: OUTPUT«1 2 3␤»
23:39 chee left 23:40 chee joined 23:45 jack_rabbit joined 23:49 jack_rabbit left 23:50 tardisx joined 23:51 tardisx left
Zoffix Ah, I see now. 23:52
Still, it
Still, it'd require coercing to Array[Int] every time you want to use that sub which is LTA
arnsholt IIRC, making [...] intuit types has been discussed, but ultimately rejected 23:58