»ö« 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:05 webstrand left 00:06 webstrand_ joined 00:12 huggable joined 00:21 ssotka left
stevieb reading through some perl6 test suite to learn as I write my own, and am wondering if the line in the following link should say "can call public method from outside the class". I just am trying to confirm what I'm trying to grasp. github.com/perl6/roast/blob/master...vate.t#L17 00:21
Zoffix stevieb, the test calls public `public` that in turn calls a private method from within that class, which is what the test tests 00:23
The call is on line 13
stevieb d'oh! a case of not paying enough attention :) 00:24
so effectively, it's just ensuring that the private method can and is being called, by using a public method. Thanks Zoffix 00:25
00:38 AlexDaniel joined
tbrowder 'ello p6 people, just attended, at YAPC::NA::2016, a day full of damian waxing wonderfully on p6 trans paradigm programming, and he got us all excited about p6 and p6 grammars 00:42
llfourn tbrowder: can't wait for vid 00:43
Zoffix llfourn, won't be. It's a paid course.
llfourn oh =(
Zoffix He'll be in Toronto for Jun 27 and 28. Maybe you can attend :) 00:44
tbrowder so my question for the experts here is: how can I use p6 grammar to parse a code block and print out a parse tree (a simple example needed)? Damian showed an example of doing such with an example grammar, but how can we do the same thing with a chunk of p6 code? 00:45
llfourn I guess no vid there either?
I'm in australia so It's tricky
Zoffix llfourn, there will be and you can view live through google hangout. 00:46
llfourn oh sweet
llfourn marks the calendar
Zoffix llfourn, this is the first one: www.meetup.com/Toronto-Perl-Mongers...231418224/
And the other one: www.meetup.com/Toronto-Perl-Mongers...231418278/ 00:47
llfourn Zoffix: cheers!
tbrowder I think we need to use nqp, but I'm not positive about it 00:49
llfourn tbrowder: you can do perl6 --target=parse to "print it out"
but if you want to get the nqp match object for actually using in code there is a way 00:50
but it's slightly more involved
tbrowder that's what I want (read: "need to do for debugging p6 grammar") 00:51
Zoffix tbrowder, there's Grammar::Debugger
llfourn ^^ it's *very* useful 00:52
Zoffix tbrowder,
tbrowder, github.com/jnthn/grammar-debugger
tbrowder, inside of it is Grammar::Tracer that's neat
tbrowder thanks, I'll try that...
llfourn tbrowder: oh did you mean you need it for debugging *the* Perl 6 grammar or *a* grammar written in Perl 6? 00:53
00:56 Zero_Dogg left, Zero_Dogg joined
tbrowder ref: damian: I (and others) asked him about p6 best practices and his basic reply was he hasn't written enough code to determine that yet, but I was interested specifically in how he call a sub in 06 compared to p5 and he now seems to favor the list approach versus parens (opposite to p5 because of the vagaries of p5); specifically he likes the call using 00:58
the list approach this way for sub foo (which I'm not sure I've seen documented), e.g., "foo: arg1, arg2;" (note the colon introducing the args)
llfourn: *the* Perl 6 grammar 00:59
Zoffix m: sub foo { say $^a, $^b }; foo: 2, 3 01:00
camelia rakudo-moar 1d93ad: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 2 in sink context (lines 1, 1)␤Useless use of constant integer 3 in sink context (lines 1, 1)␤»
stevieb m: sub foo($x){$x.say}; foo: 1;
camelia rakudo-moar 1d93ad: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 1 in sink context (line 1)␤»
llfourn it's only for Object.foo:
Zoffix tbrowder, ? are you sure he wasn't talking about methods and not subs
stevieb Zoffix: one line above your question 01:01
tbrowder hm, method for sure, but I thought subs, too (but I'm not a great listener)
Zoffix :) 01:02
stevieb m: class X{method foo($x){$x.say}}; my $x=X; $x.foo: 1;
camelia rakudo-moar 1d93ad: OUTPUT«1␤»
01:03 Zoffix left
tbrowder m: sub foo ($x) { say $x } foo: 1 01:05
camelia rakudo-moar 1d93ad: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Strange text after block (missing semicolon or comma?)␤at <tmp>:1␤------> 3sub foo ($x) { say $x }7⏏5 foo: 1␤ expecting any of:␤ infix␤ infix stopper␤ statement end…»
tbrowder m: sub foo ($x) { say $x } ;foo: 1
camelia rakudo-moar 1d93ad: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 1 in sink context (line 1)␤»
tbrowder m: sub foo ($x) { say $x } ;foo: 1;
camelia rakudo-moar 1d93ad: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 1 in sink context (line 1)␤»
01:06 Zoffix joined
stevieb tbrowder: only works on an object: 01:06
tbrowder hm, i guess i was asleep
stevieb m: class X{method foo($x){$x.say}}; my $x=X; $x.foo: 1;
camelia rakudo-moar 1d93ad: OUTPUT«1␤»
Zoffix m: class X{method foo($x){$x.say}}; my $x=X; foo $x: 1; 01:07
camelia rakudo-moar 1d93ad: OUTPUT«1␤»
Zoffix Oh!
For the first time, that usage clicked for me.
Doesn't look odd and weird anymore :)
method meth (obj: param) -> meth obj: param 01:08
01:08 molaf left
stevieb I see how that works... took me a minute 01:09
tbrowder well, in my defense he was mainly using methods heavily, and, as usual, i assumed too much
01:09 Util_ is now known as Util
tbrowder Util was there, and he was much smarter and more alert 01:10
01:10 webstrand joined
llfourn tbrowder: sorry I can't remember how to get a parse tree from Perl6::Gramamr, though I know it's possible. 01:10
m: use nqp; my $comp = nqp::getcomp("perl6"); note $comp.compile("say q|hello world|",:target<parse>) # semething lke this but must be missing a step 01:12
camelia rakudo-moar 1d93ad: OUTPUT«===SORRY!===␤compunitmainline requires an MVMCompUnit␤»
01:13 webstrand_ left
tbrowder I have a couple more classes with damian and I'll try to be more exacting 01:14
llfourn does damian hack much on nqp though?
m: use nqp; my $comp := nqp::getcomp("perl6"); my $p := $comp.eval("say q|hello world|",:target<parse>); note $p.dump # I DID IT! 01:16
camelia rakudo-moar 1d93ad: OUTPUT«- statementlist: say q|hello world|␤ - statement: 1 matches␤ - EXPR: say q|hello world|␤ - longname: say␤ - name: say␤ - identifier: say␤ - args: q|hello world|␤ - arglist: q|hello world|␤ - EX…»
llfourn tbrowder: ^^
tbrowder hm, I just tried with perl6 repl and this worked:
m: sub foo($x){say $x}; foo: 3;
camelia rakudo-moar 1d93ad: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 3 in sink context (line 1)␤»
tbrowder so what's going on???
01:17 webstrand left
llfourn doesn't work for me? 01:17
01:17 webstrand_ joined
tbrowder what rakudo? 01:17
geekosaur : is only used with methods, not subs
you have in your example a label "foo:" and a value in sink context (which produces a warning)
llfourn well camelia is usually the latest?
tbrowder got to go to bed, but this is interesting; would appreciate a simple example of testing p6 grammar, g'night! 01:19
llfourn tbrowder: night 01:20
01:21 molaf joined 01:28 sherwool left 01:29 FROGGS left 01:41 webstrand joined 01:42 FROGGS joined 01:43 webstrand_ left 01:46 ilbot3 left 01:47 webstrand left, webstrand_ joined, ilbot3 joined 01:49 Xliff left, Xliff joined 01:58 Khisanth left 02:10 webstrand_ left 02:11 Khisanth joined 02:12 webstrand joined 02:14 ssotka joined 02:22 noganex joined 02:25 noganex_ left 02:30 webstrand left 02:33 webstrand joined 02:34 nchambers joined 02:35 AlexDaniel left 02:47 webstrand left 02:48 kid51 left 03:32 skids left
Util geekosaur: ": is only used with methods, not subs" is _almost_ true. 03:36
geekosaur, tbrowder, llfourn: See "infix:<:>, the invocant marker" at design.perl6.org/S03.html#Comma_ope...precedence
Specifically: "The special form is recognized only after a dotty method call, or after the right parenthesis of a method or function call." 03:37
Util returns to slide making (sliding?)
llfourn o.o
m: my @a; @a.push(): 4,5,6; say @a; 03:38
camelia rakudo-moar 1d93ad: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Confused␤at <tmp>:1␤------> 3my @a; @a.push():7⏏5 4,5,6; say @a;␤ expecting any of:␤ colon pair␤»
llfourn m: my @a; push(@a): 4,5,6; say @a;
camelia rakudo-moar 1d93ad: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Confused␤at <tmp>:1␤------> 3my @a; push(@a):7⏏5 4,5,6; say @a;␤ expecting any of:␤ colon pair␤»
llfourn m: my @a; push(@a, 1,2,3): 4,5,6; say @a; 03:39
camelia rakudo-moar 1d93ad: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Confused␤at <tmp>:1␤------> 3my @a; push(@a, 1,2,3):7⏏5 4,5,6; say @a;␤ expecting any of:␤ colon pair␤»
llfourn seems like that's either NYI or the idea was dropped?
03:41 colomon left, colomon joined
Util llfourn: Hmmm. Good tests; I think I agree (NYI|dropped). Finding it in the doc is as far as I can take it tonight. 03:41
03:50 rgrinberg left 03:57 rgrinberg joined 04:05 Cabanossi left
Zoffix Is there a way to use a variable for the base with the :16('Str') notation? 04:07
m: $_ = '36'; say :"$_"('FIZZ').base: 35 04:08
camelia rakudo-moar 1d93ad: OUTPUT«5===SORRY!5===␤Argument to "say" seems to be malformed␤at <tmp>:1␤------> 3$_ = '36'; say7⏏5 :"$_"('FIZZ').base: 35␤Confused␤at <tmp>:1␤------> 3$_ = '36'; say :7⏏5"$_"('FIZZ').base: 35␤ expecting any of:␤ colon pa…»
04:08 Cabanossi joined 04:11 huggable left 04:12 huggable joined 04:14 a3r0_ is now known as a3r0 04:17 rgrinberg left
Zoffix m: say 32..2 04:21
camelia rakudo-moar 1d93ad: OUTPUT«32..2␤»
Zoffix m: say 32…2
camelia rakudo-moar 1d93ad: OUTPUT«(32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2)␤»
Zoffix <3 Perl 6
04:25 TEttinger joined 04:32 BenGoldberg left
Zoffix m: 5.base: 1 04:41
camelia rakudo-moar 1d93ad: OUTPUT«base argument to base out of range. Is: 1, should be in 2..36␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
Zoffix Disserpointing! :)
04:44 khw left
Zoffix m: use MONKEY-TYPING; augment class Int { multi method base(1) { '0' x self } }; say 5.base: 1 04:45
camelia rakudo-moar 1d93ad: OUTPUT«00000␤»
Zoffix \o/
m: gist.github.com/zoffixznet/be1ba87...5cacc96bdb 04:47
camelia rakudo-moar 1d93ad: OUTPUT«This representation (Null) does not support elems (for type VMNull)␤ in any at /home/camelia/rakudo-m-inst-1/share/perl6/runtime/CORE.setting.moarvm line 1␤ in method base at <tmp> line 2␤ in block at <tmp> line 7␤ in block at <tmp> line 6…» 04:48
Zoffix ¯\_(ツ)_/¯
m: say "0" x :36("FIZZBUZZ") 04:52
camelia rakudo-moar 1d93ad: OUTPUT«repeat count > 1073741824 arbitrarily unsupported...␤ in block <unit> at <tmp> line 1␤␤»
Zoffix probably 'cause of that
1am :'( gotta wake up at 6:30am. Gonna look at this writing and think self stupid in the morning lol :)
llfourn what's the idomatic way to check that every element of an array is an Int? 04:54
m: sub foo(@a where { .all ~~ Int }) { }; foo([1,2,3]) # works 04:58
camelia ( no output )
llfourn m: sub foo(@a where *.all ~~ Int) { }; foo([1,2,3]) # doesn't
camelia rakudo-moar 1d93ad: OUTPUT«Constraint type check failed for parameter '@a'␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
Xliff m: sub foo(@a where * ~~ Int) { }; foo([1,2,3]) 05:16
camelia rakudo-moar 1d93ad: OUTPUT«Constraint type check failed for parameter '@a'␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
Xliff ¯\_(ツ)_/¯ 05:17
05:27 _28_ria joined 05:43 domidumont joined 05:47 lizmat joined 05:48 woolfy joined, domidumont left
Util llfourn: Someday, it will be `sub foo( Int @a ) {...}` . The failing today is that [1,2,3] is not automatically an Array of Int. 05:52
m: sub foo(Int @a) { say @a.perl; }; foo([1,2,3]); 05:53
camelia rakudo-moar 1d93ad: OUTPUT«Type check failed in binding @a; expected Positional[Int] but got Array ($[1, 2, 3])␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
Util m:sub foo(Int @a) { say @a.perl; }; my Array[Int] $z .= new: 1, 2, 3; foo($z);
m: sub foo(Int @a) { say @a.perl; }; my Array[Int] $z .= new: 1, 2, 3; foo($z);
camelia rakudo-moar 1d93ad: OUTPUT«Array[Int].new(1, 2, 3)␤»
Util m: sub foo(Int @a) { say @a.perl; }; my Array[Int] $z .= new: 1, 2, 3.5; foo($z);
camelia rakudo-moar 1d93ad: OUTPUT«Type check failed in assignment to ; expected Int but got Rat (3.5)␤ in block <unit> at <tmp> line 1␤␤»
Util In the meantime, your .all solution looks good.
llfourn Util: there has been discussion of making [1,2,3] automatically an array of Int?
06:00 FROGGS left
psch i don't think we can do that 06:02
types are nominal, after all
llfourn right.
psch which i understand as "you have to tell the compiler what type you want here, or it'll be Any" 06:03
well, in this instance, and practically speaking only
llfourn m: say [1,2,3] ~~ Array[Int] 06:04
camelia rakudo-moar 1d93ad: OUTPUT«False␤»
llfourn I feel like there should be a way of easily creating a runtime test against Array[Int]
like shorthand for say [1,2,3] ~~ subset RuntimeArrayIntTest of Array where { .all ~~ Int } 06:05
Array[Int].subset #maybe? 06:06
06:06 jjido joined
psch but [1,2,3] is no Array[Int]. it's Array[Any] 06:06
that's kind of the point, really :)
llfourn yes but I want a quick syntax to create the corresponding runtime check
psch what's wrong about a sub (or two multis) that returns True or False if that check passes? 06:07
stuff it into some List::Util module if you need it that often
llfourn maybe a module is the solution
psch and like, [1,2,3].all({ $_ ~~ Int }) is shorter and does the same
llfourn yeah but it is ugly 06:08
06:08 jjido left
psch doesn't think so 06:08
llfourn doing foo( @a where { .all ~~ Int } ); all the time seems wrong
psch well, alternative you can declare @a as Int @a 06:09
llfourn well, usually the problem occurs for me in attributes
psch and create typed arrays when you need them consistenly
+t
06:09 domidumont joined
llfourn right the problem is for attribtues not subs 06:09
psch m: class A { has Int @.a }; A.new(a => @ = Array[Int].new(1,2,3)).perl.say 06:10
camelia rakudo-moar 1d93ad: OUTPUT«A.new(a => Array[Int].new(1, 2, 3))␤»
psch alternatively put the ~~ Int check into BUILD
llfourn yeah that's what I want to avoid here :)
psch what? putting it into BUILD? 06:11
llfourn writing runtime type check code
06:11 domidumont left
psch then use types consistenly and force your users to use them as well vOv 06:11
llfourn my %h = (:a<1 2 3>); sub (Int :@a) { say @a }.(a => %h<a>) # this roughly approximates the problems I run into
m: my %h = (:a<1 2 3>); sub (Int :@a) { say @a }.(a => %h<a>) # this roughly approximates the problems I run into
camelia rakudo-moar e3a3d2: OUTPUT«Type check failed in binding @a; expected Positional[Int] but got List ($(IntStr.new(1, "1"),...)␤ in sub at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
06:12 domidumont joined
llfourn I'd rather let my users throw whatever at it and just have runtime checks in some situations. 06:12
psch okay, so you want to have runtime checks but don't want to write them yourself..?
llfourn but I'd like to have a quick way to wip up a runtime check
exactly
psch i mean, i'm sorry but i really don't see the problem
llfourn maybe a module is the solution... 06:13
06:13 jjido joined
llfourn well perl 5 has Type::Tiny 06:13
psch i don't see how ~20 chars is not "a quick way to wip (sic) a runtime check"
llfourn for this purpose
because it's declaritive rather than procedural
psch i don't think i agree with that 06:14
llfourn ok well different preferences then :)
psch declarative type checks are when you declare (like, in a signature or declarator) the type
checking the content of an under-typed array during e.g. BUILD looks very procedural to me
06:14 Actualeyes left
llfourn yeah so, sub foo(@a where IntArray) { } is nicer than foo(@a where { .all ~~ Int } 06:15
psch that i think is preference. they do (depending on IntArray) the same thing
llfourn that's all I'm saying -- and since it's a common pattern I might write a module to produce corresponding runtime checks for types like Array[Int] 06:16
psch in any case, i think, specifically regarding Attributes, a trait might look nice for what you're trying
llfourn hmm that's an interesting idea.. 06:17
06:22 firstdayonthejob joined 06:23 domidumont left 06:25 _mg_ joined
psch hm, although moving the trait result to the right spot might be a bit difficult 06:25
maybe you'd be better of with a different metaclass that gives you that kind of check for all aggregate Attributes
or maybe just a different metaclass for Attributes 06:26
llfourn I think what I really want is parameterized subset. like has Arrayish[Int] $.a; where Arrayish behaves like Array[Int] in Type::Tiny. 06:27
06:27 ssotka left 06:30 domidumont joined 06:32 mls_ joined 06:33 jjido left 06:36 mls left 06:38 jjido joined 06:41 firstdayonthejob left 06:42 vendethiel- left 06:45 Actualeyes joined 06:52 grondilu joined
moritz Zoffix++ # Rakudo #100 07:00
07:02 jjido left
masak good Monday, #perl6 07:08
ooh, Zoffix++ # rel
07:12 abraxxa joined 07:13 darutoko joined
masak arnsholt: warm congratulations on the 3-days-old. (4-days-old now, I guess. they grow up so fast!) 07:15
moritz ooh, I missed that! arnsholt++ 07:19
and arnsholt.family++ :-)
07:20 wamba joined 07:21 sno left 07:23 jjido joined 07:27 jjido left 07:30 BenGoldberg joined 07:33 zzzzzzzzz joined 07:44 CQ left 07:51 lizmat left 07:54 lizmat joined 07:55 woolfy left 07:57 woolfy joined, _28_ria left
abraxxa arnsholt: congratulations as well! 07:58
08:03 bjz joined 08:04 BenGoldberg left 08:09 cur8or joined 08:11 vytas left, huggable left 08:12 bjz left, huggable joined, dakkar joined 08:13 _28_ria joined 08:14 vytas joined 08:15 brrt joined 08:16 RabidGravy joined 08:25 araujo joined 08:30 jack_rabbit left 08:35 girafe left 08:36 sno joined 08:42 rindolf joined 08:44 bjz joined 08:49 CIAvash joined 08:51 iH2O joined 08:52 iH2O left 08:55 bjz left 08:56 andrewalker joined 08:57 ocbtec joined 08:59 bjz joined, rkr joined 09:02 donaldh joined 09:04 mls_ is now known as mls
arnsholt Thank you, everyone! =) 09:06
jnthn Morning, #perl6 09:08
arnsholt: Congrats from me also! :-)
moritz mornthn
hahainternet morning all, congratulations arnsholt 09:09
masak wow, it took us until 2016 to come up with "mornthn"!? :P
09:09 g4 joined
jnthn Sounds like the kind of sound I make in a morning :P 09:10
RabidGravy :)
I'm well into my second coffee and still haven't woken up fully 09:11
hahainternet 1/2 way through my tea :)
09:12 rkr left
tadzik yay, congrats arnsholt! 09:12
09:13 Zero_Dogg left 09:14 Zero_Dogg joined 09:15 TEttinger left
brrt backlogs 09:17
congrats arnsholt :-) 09:18
arnsholt masak: jnthn is chief punsmith of #perl6, but I guess he couldn't come up with that particular one himself. So he had to wait for someone else to do it =) 09:19
masak .oO( eventual pun-ishment ) 09:20
09:22 zakharyas joined, araujo_ joined 09:24 kerframil joined, kerframil left 09:26 araujo left, araujo_ left 09:28 rkr joined 09:29 rkr left, rkr joined 09:36 buharin joined
buharin sup 09:44
09:45 El_Che joined
arnsholt masak: I tried to make an eventual consistency-based follow-up pun to that, but failed sadly =( 09:53
09:58 kerframil joined 10:00 zakharyas left 10:03 brrt left 10:05 El_Che left 10:07 El_Che joined 10:23 colomon left, colomon joined, jjido joined 10:24 rgrinberg joined 10:25 _mg_ left 10:28 jjido left 10:41 jonadab left 10:46 mr-foobar left 10:49 rkr left 10:50 kid51 joined, kid51 left, kid51 joined 10:51 kid51 left, kid51 joined 10:58 sjoshi joined, eroux joined 10:59 brrt joined 11:12 Emeric joined 11:14 eugen joined 11:17 xnrand left 11:18 xnrand joined
masak arnsholt: don't worry; you'll succeed... eventually :P 11:21
11:22 _mg_ joined 11:25 bartolin joined
arnsholt I'll make sure to tell you when I do! 11:25
masak push-based ftw 11:29
11:37 stmuk_ joined 11:39 stmuk left, rgrinberg left 11:40 xnrand left 11:42 kid51 left, xnrand joined 11:43 Gothmog_ joined
[Coke] . 11:53
12:00 brrt left 12:01 sjoshi left 12:10 bjz left 12:11 donaldh left, huggable left 12:12 huggable joined, baest_ joined, bjz joined 12:13 shmibs left, baest left, shmibs joined 12:14 yanmc left 12:15 Gruber left, stmuk_ left, Grrrr joined, stmuk_ joined, llfourn left 12:16 dj_goku left, llfourn joined, yanmc joined, dj_goku joined, dj_goku left, dj_goku joined, mr-foobar joined 12:17 cosarara_ left, tailgate left
dalek c: b7f2831 | (Tom Browder)++ | doc/Programs/README.md:
add info on doc sorting in this directory
12:17
c: 7e1403a | (Tom Browder)++ | doc/Programs/README.md:
Merge pull request #607 from tbrowder/readme-prog-files

add info on doc sorting in this directory
12:18 lizmat left 12:19 lizmat joined 12:20 grondilu left, gregf_ joined
buharin hey, I am reading last time Perl6 documentation 12:20
but there are some lacks of information
if I want to fullfill it, I need PR on git? 12:21
12:21 cosarara joined
lizmat buharin: yes please 12:21
12:21 Khisanth left
buharin lizmat: thank you my friend 12:22
12:22 Woodi left 12:23 grondilu joined 12:24 jferrero joined
literal m: my %a = foo => 5; my %b = bar => 6; say %a »+« %b 12:24
camelia rakudo-moar e3a3d2: OUTPUT«Use of uninitialized value of type Any in numeric context in block <unit> at <tmp> line 1␤Use of uninitialized value of type Any in numeric context in block <unit> at <tmp> line 1␤{bar => 6, foo => 5}␤»
literal those warnings shouldn't happen, right? 12:25
12:25 kmwallio joined, cosimo joined
gfldex m: my %a = foo => 5; say (+%a).WHAT 12:25
camelia rakudo-moar e3a3d2: OUTPUT«(Int)␤»
literal maybe my code example is outdated, I got it from S03 12:26
from a section saying that this would give you a union of the keys
12:27 autarch left 12:28 grondilu left, grondilu joined 12:29 cognominal joined, autarch joined 12:32 Woodi joined
[Coke] tbrowder: regarding #607 on docs... why *is* it different for this folder? 12:33
is the goal for them all to be the same at some point?
literal: are you reading S03 via the web or the repo? 12:34
12:34 krakan joined
[Coke] (the website has a message at the top) 12:34
12:43 bhm left, bhm joined 12:44 lizmat left 12:45 andreoss joined, mattp_ joined
andreoss is there a variable for a separator character for PATH variable? 12:46
timotimo i think there is one 12:47
literal [Coke]: yeah, the webpage 12:48
I did notice the message :)
[Coke] m: $*DISTRO.path-sep.say
camelia rakudo-moar e3a3d2: OUTPUT«:␤»
stevieb ohhh that's handy! 12:49
andreoss [Coke]: thanks, docs are missing this one
masak .oO( ohhh that's ✋y ) 12:50
andreoss is there a function which parses PATH variables?
masak andreoss: .comb($*DISTRO.path-sep) :)
er, .split, of course
gfldex m: IO::Spec::Unix.new.dir-sep.say
camelia rakudo-moar e3a3d2: OUTPUT«/␤»
gfldex m: $*SPEC.dir-sep.say 12:51
camelia rakudo-moar e3a3d2: OUTPUT«/␤»
gfldex there you go
masak m: IO::Spec::Unix.dir-sep.say
camelia rakudo-moar e3a3d2: OUTPUT«/␤»
12:52 sufrostico joined
stevieb m: $*DISTRO.^methods.say 12:52
camelia rakudo-moar e3a3d2: OUTPUT«(BUILD cur-sep Str gist release is-win path-sep name auth version signature desc)␤»
gfldex there are no spec tests for dir-sep, so consider it an implementation detail
stevieb a lot of these little tricks are going to significantly lessen the number of lines of code when I port some of my perl5 modules to perl6 :) 12:54
12:54 eroux left 12:56 donaldh joined 12:58 mspo_ is now known as mspo 12:59 stevieb left 13:01 Sgeo left 13:02 Khisanth joined 13:03 lizmat joined 13:05 Woodi left 13:06 Woodi joined 13:11 abruanese left 13:13 eroux joined, skids joined
dalek c: 5097c4d | (Zoffix Znet)++ | README.md:
Enumerate third party code in LICENSE
13:16
13:17 buharin left 13:22 Zero_Dogg left
dalek href="https://perl6.org:">perl6.org: 8d84259 | (Zoffix Znet)++ | / (2 files):
Add legal
13:22
13:22 zakharyas joined 13:23 Zero_Dogg joined, tadzik joined 13:26 brrt joined 13:27 andreoss left, cpage_ left
dalek href="https://modules.perl6.org:">modules.perl6.org: e02a997 | (Zoffix Znet)++ | README.md:
Add legal
13:30
13:30 iH2O joined
dalek href="https://modules.perl6.org:">modules.perl6.org: fdaa886 | (Zoffix Znet)++ | README.md:
Remove duplicate header
13:35
13:36 abruanese joined 13:38 M-matthew joined, M-Illandan joined 13:39 zakharyas left 13:44 sufrostico left, g4 left, stevieb joined 13:46 andreoss joined 14:00 brrt left 14:01 Sgeo joined
stevieb getting my hands dirty by slowly writing a module and tests. upon running a test, I get ``Package Log::Simple already has a method _0...'' at t/000-load.t line 17. _0 is a valid method, but I don't understand how it already exists. My tests are scoped in subtests, and each subtest creates a new object. It's the second subtest that barfs. I've fiddled around and can't sort out what's happening. Could someone, if they have the time, 14:03
have a quick peek and point out my err? code flow is ``new().generate-log-methods().add-method()''. Code: github.com/stevieb9/perl6-log-simp...Simple.pm6 Test: github.com/stevieb9/perl6-log-simp...000-load.t
timotimo you shouldn't add methods in the constructor 14:04
14:04 khw joined
timotimo they are added to the type, not to the instance 14:04
so the second time you run new, you'll be re-adding the methods, and correctly get the complaint that the methods are already there 14:05
gfldex unless you test if the method already exists
or you move the adding method stuff into a BEGIN block in the module 14:06
timotimo or if you also create a new class every time
stevieb so, even though the instantiation happens within their own separate scope, the class itself remembers that the new methods have been added? 14:07
timotimo instantiation?
stevieb sorry, object creation
gfldex classes are objects, so what object is created? 14:08
timotimo yeah, the methods you're adding are landing in the type object, which only one exists of
jnthn Objects share a class (well, strictly, a meta-object), and adding a method is an operation on the meta-object.
It's nothing to do with scope, really. It's simply that objects don't carry methods, but rather they are of a certain type and that has the methods. 14:09
mst stevieb: adding methods to an object at runtime is rarely a good idea, since you end up adding them to the class
stevieb oh, ok, now I understand. This is perl5 thinking I believe that's causing me confusion.
mst in perl5 the usual approach is to rebless yourself into an empty subclass of your 'real' class first
no, this would be completely broken in perl5 too
'adding methods in BUILD' is one of the most common Moo/Moose antipatterns
stevieb ok, so instead of the XY problem approach, I'll state what I'm trying to achieve and request feedback on that :) I want to be able to accept a list of names at runtime, and then dynamically add those as methods to a specific object only. Can someone let me know how to approach this, or point me to docs that may exist? or is my thnking all wrong here? 14:13
14:13 tailgate joined
stevieb ...the existing default dynamic methods should be applied at the class level for all objects, but only once (which I will play with BEGIN to try this) 14:14
gfldex the docs you are asking for will go here: doc.perl6.org/language/typesystem
(at some point before or after Christmas)
nine stevieb: that still sounds like a means to achieve a goal rather than the goal itself 14:15
gfldex see: design.perl6.org/S12.html#FALLBACK_methods
nine stevieb: but if you really need that, I'd save those names in an attribute and use FALLBACK
timotimo actually, i'd go with a very different approach
nine stevieb: it's like AUTOLOAD in Perl 5
timotimo why not have it like "use Log::Simple <foo bar baz error warning>"
stevieb timotimo: yeah, that's a very sane and easy to implement approach 14:16
timotimo yeah, you should try it that way
you'd probably create a class inside EXPORT then, like in my ADT module 14:17
stevieb I will take a read of FALLBACK as well. Learning a little every day, and finding I'm liking perl6 quite a lot
timotimo: I'll take a look at ADT as well
timotimo the drawback of FALLBACK is you won't see the methods in .^methods before they have been "tried"
whereas with the EXPORT version, you'll be able to properly introspect 14:18
stevieb I like that idea. The way it is now (and how I would have continued trying) states ANON for all the auto-generated methods, so I can't really test to see if they exist with ^methods 14:19
I appreciate the patence and advice provided here on #perl6 14:20
14:22 cur8or left
gfldex m: class L { method log($l, $s) { say "$l, $s" }; method FALLBACK($name, |c) { my $c = $name; self.^add_method($name, method ($s) { log($c, $s) }); self.^compose(); self."$name"(|c) } }; my $log = L.new; $log.log0("foo"); 14:23
camelia rakudo-moar e3a3d2: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5log0' (indicated by ⏏)␤ in method <anon> at <tmp> line 1␤ in method FALLBACK at <tmp> line 1␤ in any at gen/moar/m-Metamodel.nqp line 3055␤ in bl…»
14:24 abruanese left
timotimo i think you have to just return the method in question from FALLBACK and it'll add the method for you automatically 14:24
has been a while since i last used fallback, though
14:25 _mg_ left, abruanese joined 14:30 abruanese left 14:33 iH2O left 14:36 atweiden joined, abruanese joined
nine timotimo: no, that's add_fallback. FALLBACK will just be called and is expected to do whatever the called method would have done. There are examples of usage for both ways in Inline::Perl5 14:41
gfldex m: gist.github.com/gfldex/51bc1f2d2ec...9530acca4d 14:42
camelia rakudo-moar e3a3d2: OUTPUT«0: foo␤1: bar␤»
gfldex stevieb: ^^^
nine m: class Foo { method FALLBACK($name, *@args, *%args) { say $name, @args, %args; }; }; Foo.new.bar(1, 2, :baz<qux>);
camelia rakudo-moar e3a3d2: OUTPUT«bar[1 2]{baz => qux}␤»
gfldex stevieb: what you actually want are hygenic macros because ^.compose will make the optimizer unhappy 14:43
nine gfldex: using add_method will again add the method to the class instead of just the object
gfldex i believe that is intentional 14:44
nine gfldex: to quote stevieb: "and then dynamically add those as methods to a specific object only" irclog.perlgeek.de/perl6/2016-06-20#i_12698309
gfldex given the module he linked earlier I am guessing that his initial stated intention is wrongish 14:45
stevieb gfldex: thanks for that example! I'll have to read up on docs and digest it all. 14:46
14:47 cpage_ joined
stevieb The original idea was to have all _N() methods added once, and should be available to all objects created. These are the default log methods. then, if desired, a user can send in labels eg: (debug, info etc), and on the object only, map those labels to their corresponding numbered method. I apologize for being as clear as mud 14:48
gfldex stevieb: adding methods at runtime will make it harder for the compiler to help with good error messages/optimisations at compile time 14:49
nine gfldex: ok, just go with timotimo++'s "use Log::Simple <foo bar baz error warning>" approach then :) 14:50
stevieb gfldex: I'm going to just not do that at all, as I definitely don't know enough yet anyhow. I'm just going to trudge along and get the rest of the module working properly before I start looking at doing more trickery :)
timotimo the compiler can't know anything about methods at compile time anyway; whether you've added methods to an object at run time or not doesn't make a difference to it unless you're using the object before methods are added and afterwards, maybe 14:53
gfldex stevieb: you may find the following helpful gfldex.wordpress.com/2016/01/18/a-...direction/
stevieb gfldex: thank you. I was just searching for docs/examples on export, so yes, that's handy 14:55
timotimo writing a class { has $.foo } is equivalent to writing ClassHOW.new_type + adding the attribute + composing the class via the MOP
it wouldn't make sense to offer a MOP if it wasn't exactly as powerful as what regular syntax allows you to do 14:56
14:58 abruanese left 14:59 jjido joined 15:03 johnjohn101 left 15:04 jjido left, domidumont left 15:08 abruanese joined 15:14 ssotka joined 15:16 adu joined
timotimo seeing some livetweets from a perl conference where right now damian conway seems to be talking about perl6 15:17
lizmat yes he is :-)
timotimo one POC in the audience is also pointing out the distinct whiteness of the whole audience and speakers 15:18
stmuk_ POC?
timotimo (but at least someone put LL Cool J on one slide, so that makes 3 POC in total apparently)
person of color
nine timeless: tell that to the creators of other languages with a MOP like Python ;)
literal ah, I love when this language allows me to eliminate boilerplate. Nice to be able to do "for @a -> (:$foo, :$bar) { ... }" to reference the keys of a hash in each iteration with minimal typing 15:21
BrokenRobot timotimo: last year some sort of JS conf tweeted a photo and it's literally ALL white males :)
timotimo yeah, it's not uncommon to have white males as the biggest chunk of the audience by far ... :( 15:22
stmuk_ I guess YAPC::Asia didn't have that problem 15:23
timotimo i don't think i'm in a position to make it better, but i'm pretty sure there's some things i'd do without thinking that turns off people from minorities :\ 15:24
BrokenRobot Like "POC"? :)
timotimo hm?
mst BrokenRobot: um. PoC is, according to most of the internet at this point, the politically correct term to use, and you can expect to be yelled at if you use anything else 15:25
BrokenRobot ¯\_(ツ)_/¯ Just a weird term to use to refer to a human :) OTOH I didn't even know there were races of humans until I was 15 so what do I know 15:26
nine mst: sometimes you just cannot win ;) dearblankpleaseblank.com/permalink....wid=216204
mst bahahahahaha 15:27
nine The whole obsession with skin color is one of the most ridiculous obsessions of the human race (pun very much intended) 15:29
mst :D 15:30
BrokenRobot :)
timotimo yeah, but we'll not make it better by saying "oh, we're completely color blind here" or ignoring that these people tend to get a lot of BS
nine of course not :) 15:31
andreoss \part
15:31 andreoss left
tony-o one of my favorite parts of the marine corps: i.imgur.com/GmUKeRh.jpg 15:32
15:32 profan_ is now known as profan
nine timotimo: btw. considering that 2/3 of humanity are Asian and more than half of humanity is female, speaking of "minorities" may already be part of the problem. 15:32
tony-o relevant to skin color ^
timotimo the thing about that is that these people don't get viewed by others as part of the global mass of people they would rightfully be a part of 15:33
BrokenRobot Well, maybe the person who pointed out the "distinct whiteness" may offer some ideas on what that is so?
timotimo it's all local