»ö« 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.
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
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
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␤»
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)␤»
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
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
tbrowder Util was there, and he was much smarter and more alert 01:10
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␤»
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???
llfourn doesn't work for me? 01:17
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
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?
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
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…»
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
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! :)
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
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?
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
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
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
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
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␤␤»
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
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
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
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
moritz Zoffix++ # Rakudo #100 07:00
masak good Monday, #perl6 07:08
ooh, Zoffix++ # rel
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++ :-)
abraxxa arnsholt: congratulations as well! 07:58
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
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 :)
tadzik yay, congrats arnsholt! 09:12
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
buharin sup 09:44
arnsholt masak: I tried to make an eventual consistency-based follow-up pun to that, but failed sadly =( 09:53
masak arnsholt: don't worry; you'll succeed... eventually :P 11:21
arnsholt I'll make sure to tell you when I do! 11:25
masak push-based ftw 11:29
[Coke] . 11:53
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
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
lizmat buharin: yes please 12:21
buharin lizmat: thank you my friend 12:22
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
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
[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
[Coke] (the website has a message at the top) 12:34
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«/␤»
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
dalek c: 5097c4d | (Zoffix Znet)++ | README.md:
Enumerate third party code in LICENSE
13:16
dalek href="https://perl6.org:">perl6.org: 8d84259 | (Zoffix Znet)++ | / (2 files):
Add legal
13:22
dalek href="https://modules.perl6.org:">modules.perl6.org: e02a997 | (Zoffix Znet)++ | README.md:
Add legal
13:30
dalek href="https://modules.perl6.org:">modules.perl6.org: fdaa886 | (Zoffix Znet)++ | README.md:
Remove duplicate header
13:35
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
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
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
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…»
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
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
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
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
tony-o one of my favorite parts of the marine corps: i.imgur.com/GmUKeRh.jpg 15:32
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
BrokenRobot doesn't even pretend to know the solution to this problem
mspo what's the gender mix?
BrokenRobot s/what that/why that/;
tony-o www.unprecedentedmediocrity.com/rac...ake-notes/
timotimo you can ask the POC why there aren't more POC in tech, but if you do that, you can very easily seem like a total arsehole
tony-o mspo: of the population? 15:34
stmuk_ damian is being streamed ...odd I didn't think he liked that
mspo tony-o: of the conference population
mst the problem is you need to figure out (1) who might be interested in turning up (2) why the ones who didn't didn't, and if we can do something about that
timotimo like, even inside an asian country, an asian person can be treated like shit for "being a minority" if they are put into a circle of thirty white doods
mst and both of those are really tricky
tony-o timotimo: or even other asians. 15:35
mspo timotimo: or the wrong type of asian
timotimo that too, yes
mst right, europe mostly specialises in hating each other for being the wrong sort of white people
tony-o that seems congruent, people will find a way to discriminate, if not by skin color then by something else
timotimo even if the race/skin tone/language/... are the same, they could still be gay or trans or atheist or of the wrong religion, or wear the wrong kind of clothes
i think i'm going off on a tangent here
tony-o yes :) 15:36
mspo eat the wrong type of bread
(encountered this in real life)
timotimo what, really?
BrokenRobot drink the wrong kind of beer....
mst use the wrong sort of text editor
BrokenRobot .. oh wait.. that was in a #perl channel! :P
timotimo well, yeah, wrong kind of beer that's in cologne and düsseldorf
tony-o get out mst. 15:37
:p
timotimo text editors is pretty funny until you have to explain to an outsider interested in becoming an insider and it's basically another thing they have to learn in order to be accepted 15:38
hoelzro I remember telling one of my sisters that programmers have arguments about which language is best - it blew her mind
timotimo "oh and btw if someone mentions MongoDB, be sure to point at them and laugh, otherwise you're not with the *in* crowd"
tony-o timotimo: and vim isn't easy to explain anyway
timotimo vim isn't easy to explain away :)
"nerd culture"/"programmer culture" sometimes feels a bit like the treehouse allegory :| 15:39
profan hoelzro: ahaha, this is one of those things hardest for people outside to understand in my experience 15:40
stmuk_ is everyone watching damian? 15:41
timotimo finds it easy to complain, hard to measure what's actually pertinent
can you give a link to the place where damian can be watched?
BrokenRobot is working, so no
mst trout.me.uk/mongodb.jpg
gfldex stmuk_: i'm not because i'm missing a link
mspo www.youtube.com/watch?annotation_i...q2HkAYbG5o
timotimo that's sawyer, though? 15:42
oh, no, it is actually damian
stmuk_ no it's sawyers new look 15:43
timotimo :D 15:43
i hate that it's only on the left ear :(
hoelzro profan: I think it sheds some light on just how silly it is =) 15:44
mspo timotimo: glad it isn't just me
timotimo i bet a nice little one-liner for pulseaudio could fix it for me 15:45
profan hoelzro: indeed
nine Oh would someone give TheDamian a real quantum computer already? 15:49
stmuk_ a hackentosh one? 15:51
dogbert17 o/ #perl6 16:00
BrokenRobot \o
dogbert17 Hi Zoffix :)
I have the 'stupid question of the day' 16:01
dogbert17 my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for $p { .say }; for $p { .say } # why can I consume this twice? 16:01
m: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for $p { .say }; for $p { .say } # why can I consume this twice?
camelia rakudo-moar e3a3d2: OUTPUT«(Seq)␤(eggs => 1 bacon => 1)␤(eggs => 1 bacon => 1)␤»
hoelzro m: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT
camelia rakudo-moar e3a3d2: OUTPUT«(Seq)␤»
hoelzro hmm...good question 16:02
BrokenRobot m: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for |$p { .say }; for |$p { .say }
camelia rakudo-moar e3a3d2: OUTPUT«(Seq)␤eggs => 1␤bacon => 1␤This Seq has already been iterated, and its values consumed␤(you might solve this by adding .cache on usages of the Seq, or␤by assigning the Seq into an array)␤ in block <unit> at <tmp> line 1␤␤»
BrokenRobot bisect: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for $p { .say }; for $p { .say } 16:03
bisectable BrokenRobot: on both starting points the exit code is 0 and the output is identical as well
BrokenRobot m: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for $p { .WHAT.say }; for $p { .WHAT.say } 16:06
camelia rakudo-moar e3a3d2: OUTPUT«(Seq)␤(Seq)␤(Seq)␤»
nine Listening to TheDamian's great message, I still can't help but think, despite all it's greatness - and this will ultimately lead to a Perl 7 - Perl 6 still does not exactly do what I mean, it still does what I say. So I guess Perl 7 will have to be built on top of an epic AI core.
BrokenRobot dogbert17: I'm no expert, but it looks like in this case for just passes a singular seq inside the loop instead of iterating over each pair 16:07
BrokenRobot
.oO( lizmat sure naps a lot.... lucky )
16:08
dogbert17 BrokenRobot: I agree but shouldn't it iterate of the pairs? 16:11
hoelzro hmm...is it that the seq's iterator will iterate until IterationEnd, and then set itself up in a state as if it were iterating from the beginning again, instead of setting itself up to just keep returning IterationEnd?
gfldex github.com/rakudo/rakudo/blob/nom/...gy.pm#L154 16:12
hoelzro oh, I think I understand 16:13
m: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for $p { .say }; for $p { .say } # why can I consume this twice?
camelia rakudo-moar a22316: OUTPUT«(Seq)␤(eggs => 1 bacon => 1)␤(eggs => 1 bacon => 1)␤»
hoelzro m: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for @($p) { .say }; for @($p) { .say } # why can I consume this twice?
camelia rakudo-moar a22316: OUTPUT«(Seq)␤eggs => 1␤bacon => 1␤eggs => 1␤bacon => 1␤»
hoelzro hmm, maybe not
I figured that it was basically calling $p.say twice, and Seq.gist is impl'd as self.cache.gist 16:14
dogbert17 gfldex: have looked at the code but can't say it has made me wiser :(
hoelzro m: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for @($p) { say "$_ {$++}" }; for @($p) { "$_ {$++}" } # why can I consume this twice?
camelia rakudo-moar a22316: OUTPUT«WARNINGS for <tmp>:␤Useless use of "$_ {$++}" in expression "$_ {$++}" in sink context (line 1)␤(Seq)␤eggs 1 0␤bacon 1 1␤»
hoelzro m: my $b = bag <bacon eggs>; my $p = $b.pairs; say $p.WHAT; for @($p) { say "$_ {$++}" }; for @($p) { say "$_ {$++}" } 16:15
camelia rakudo-moar a22316: OUTPUT«(Seq)␤eggs 1 0␤bacon 1 1␤eggs 1 0␤bacon 1 1␤»
BrokenRobot hoelzro: that makes a list
Isn't that a way to make a Seq consumable more than once?
hoelzro @($p)? right, but that should drain the iterator
hoelzro if you assign the result of @($p), yes 16:15
BrokenRobot Ah
hoelzro it doesn't cache the results, afaik
hoelzro Seq is a weak spot for me in Perl 6, thought, so I could be wrong 16:16
gfldex the iterator is created of %!elems of the bag 16:17
that hash is persistent
also there is Set::cache what means that Sets can be consumed but don't have to 16:19
dogbert17 gfldex: does that mean that the contents, if that's the correct wording, decides wheather a Seq is consumed or not? 16:21
dogbert17 clearly confused
gfldex the content or you
by calling .cache you can make it's values persistent if you call that method befor iteration 16:22
dogbert17 gfldex: but that is not necessary in this particular case?
could some amendments in doc.perl6.org/type/Seq be in order? 16:24
gfldex "However, calling .cache on a Seq will return a List that is still lazy, but stores the generated values for later access." 16:26
m: my @a = lines; @a.WHAT.say; @a.say; 16:27
camelia rakudo-moar a22316: OUTPUT«(Array)␤[Céad slán ag sléibhte maorga Chontae Dhún na nGall Agus dhá chéad slán ag an Eireagal ard ina stua os cionn caor is coll; Nuair a ghluais mise thart le Loch Dhún Lúich’ go ciúin sa ghleann ina luí I mo dhiaidh bhí gleanntáin ghlas…»
dogbert17 gfldex: I didn't see any call to .cache in Baggy.pm though 16:28
gfldex nor do you need that
dogbert17 obvoisly not :) I need to wrap my brain around this it seems 16:29
gfldex if you want to iterate over a listy thing twice you assign it to a @-sigiled container and it will be maintained
dogbert17 I'm with you so far :) 16:30
gfldex m: for lines { .say }; for lines { .say }; 16:33
camelia rakudo-moar a22316: OUTPUT«5===SORRY!5===␤Function 'lines' needs parens to avoid gobbling block␤at <tmp>:1␤------> 3for lines { .say }7⏏5; for lines { .say };␤Missing block (apparently claimed by 'lines')␤at <tmp>:1␤------> 3for lines { .say }7⏏5; for line…»
gfldex m: for lines() { .say }; for lines() { .say };
camelia rakudo-moar a22316: OUTPUT«Céad slán ag sléibhte maorga Chontae Dhún na nGall␤Agus dhá chéad slán ag an Eireagal ard ina stua os cionn caor is coll;␤Nuair a ghluais mise thart le Loch Dhún Lúich’ go ciúin sa ghleann ina luí␤I mo dhiaidh bhí gleanntáin ghlas’ G…»
gfldex old example is old
m: my @a = 1,2,3; my @b = <a b c>; my \c = @a Z=> @b; .say for c; .say for c; 16:34
camelia rakudo-moar a22316: OUTPUT«1 => a␤2 => b␤3 => c␤This Seq has already been iterated, and its values consumed␤(you might solve this by adding .cache on usages of the Seq, or␤by assigning the Seq into an array)␤ in block <unit> at <tmp> line 1␤␤»
dogbert17 ok, just to add to my stupidity, what does \c do? 16:37
BrokenRobot dogbert17: containerless var 16:39
well.. not really a "var" more like a constant, since you can't change it
AlexDaniel er, do we have any docs for that?
BrokenRobot m: my \Δ = 'meow'; say Δ
camelia rakudo-moar a22316: OUTPUT«meow␤»
BrokenRobot m: my \Δ = 'meow'; Δ = 5
camelia rakudo-moar a22316: OUTPUT«Cannot modify an immutable Str␤ in block <unit> at <tmp> line 1␤␤»
AlexDaniel m: my \pi = 3; say pi # ouch 16:40
camelia rakudo-moar a22316: OUTPUT«3␤»
dogbert17 BrokenRobot: many thanks
gfldex m: my Int $a; my \b := $a; b = 10; dd $a, b;
camelia rakudo-moar a22316: OUTPUT«Int $a = 10␤Int $a = 10␤»
gfldex it's very variable 16:41
m: my Int $a; my \b = $a; b = 10; dd $a, b;
camelia rakudo-moar a22316: OUTPUT«Int $a = 10␤Int $a = 10␤»
gfldex and an implicit binding
BrokenRobot neat. gfldex++
AlexDaniel cool, what about docs?
ah 16:42
here
doc.perl6.org/language/variables#Si..._variables
containerless sigilless variables!
gfldex also doc.perl6.org/language/containers#Binding
BrokenRobot That section isn't too descriptive for someone who doesn't know wtf "lexpad" is :/ 16:43
gfldex sigilless variables will never introduce a _new_ container
dogbert17 gfldex: nice, it seems I have some reading to do
BrokenRobot Ah, OK. There's a sentence at the start of the page "At run time, a variable appears as an entry in a lexical pad, or lexpad for short. This is a per-scope data structure that stores a pointer for each variable." 16:44
m: my Int $a; my \b = $a; b = 10; dd $a, b; my $z = 42; b = $z; dd $a, $z, b 16:46
camelia rakudo-moar a22316: OUTPUT«Int $a = 10␤Int $a = 10␤Int $a = 42␤Int $z = 42␤Int $a = 42␤»
BrokenRobot trippy
BrokenRobot oh, it just uses the value the second time. Never mind :) 16:47
gfldex m: my \b = 42; b = 43;
camelia rakudo-moar a22316: OUTPUT«Cannot modify an immutable Int␤ in block <unit> at <tmp> line 1␤␤»
gfldex literals don't come with buildin containers. Binding to a literal will not create a container. Literals are constant. 16:48
therefore calling sigilless variables, sigilless variables is a bit missleading 16:49
tbrowder [Coke]: I made it different because the order seems to be more desirable IMHO, and it can be done by the file name and the correct sort (htmlify.p6 was modded by me to do that for the Programs dir and tab) 17:01
tony-o m: my \b = $(42); b = 43; b.say; 17:04
camelia rakudo-moar a22316: OUTPUT«Cannot modify an immutable Int␤ in block <unit> at <tmp> line 1␤␤»
tony-o m: my $x = 42; my \b = $x; b = 43; b.say;
camelia rakudo-moar a22316: OUTPUT«43␤»
tony-o m: my \b = (my $x = 42); b = 43; b.say; 17:05
camelia rakudo-moar a22316: OUTPUT«43␤»
dalek c: 5ac6d7b | (Zoffix Znet)++ | doc/Programs/01-debugging.pod:
Link to repos
17:06
BrokenRobot m: my \b = $ = 42; b = 43; b.say; 17:07
camelia rakudo-moar a22316: OUTPUT«43␤»
sena_kun m: my Int $num = 3; "abcc" ~~ /"ab" 'c' ** 1..$num/; 17:28
camelia rakudo-moar a22316: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed Range␤at <tmp>:1␤------> 3Int $num = 3; "abcc" ~~ /"ab" 'c' ** 1..7⏏5$num/;␤»
pmichaud good afternoon, #perl6
sena_kun Documentation is a bit obscure about interpolation of variables into regexes(if it's not another regex). Is it possible at all?
BrokenRobot m: my Int $num = 3; say "abcc" ~~ /"ab" 'c' ** {1..$num}/; 17:29
camelia rakudo-moar a22316: OUTPUT«「abcc」␤»
sena_kun BrokenRobot, ouch. Thanks a lot.
BrokenRobot sena_kun: seems wrong actually 17:30
BrokenRobot m: my Int $num = 3; say "abccccccccccc" ~~ /"ab" 'c' ** {5..$num}/; 17:30
camelia rakudo-moar a22316: OUTPUT«Nil␤»
BrokenRobot Oh, num is 3
sena_kun BrokenRobot, trying it in actual regex now...
BrokenRobot m: my Int $num = 3000; say "abccccccccccc" ~~ /"ab" 'c' ** {5..$num}/; 17:31
camelia rakudo-moar a22316: OUTPUT«「abccccccccccc」␤»
BrokenRobot never mind :P
pmichaud I believe that variables in range quantifiers is NYI in rakudo. 17:33
dalek c: ffb9ce7 | (Wenzel P. P. Peppmeyer)++ | doc/ (2 files):
update example and error message
jnthn It...just worked in the example above? :)
pmichaud oh, I could be wrong about that. :)
m: my $num = 7; say "abcccccccccccccccc" ~~ / "ab" 'c' ** (5..$num)/; 17:34
camelia rakudo-moar a22316: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Quantifier quantifies nothing␤at <tmp>:1␤------> 3ay "abcccccccccccccccc" ~~ / "ab" 'c' **7⏏5 (5..$num)/;␤»
pmichaud m: my $num = 7; say "abcccccccccccccccc" ~~ / "ab" 'c' ** {5..$num}/; 17:34
camelia rakudo-moar a22316: OUTPUT«「abccccccc」␤»
pmichaud okay, it works.
diakopter istr working on that 17:35
maybe not though!
diakopter er no, I didn't do that particular thing 17:37
jnthn I think it was FROGGS++ :) 17:42
mspo any more p6 talks streaming today? 18:18
[Coke] waves at pmichaud 18:19
pmichaud waves to [Coke]
there's two more p6 talks today, I think
switching rooms 18:21
vendethiel is it YAPC::NA time? 18:22
moritz it is 18:24
pmichaud about to start: "Perl 6 and the Zen of Erlang" www.yapcna.org/yn2016/talk/6600 18:25
afterwards: "Perl 6 - Why did they do *that*?" www.yapcna.org/yn2016/talk/6645
pmichaud I don't know if they're streaming. 18:26
DrForr_ Just the keynotes are streaming. 18:28
perigrin They should be posted quickly, we've been *promised* quickly posted. 18:32
timotimo wow, you mean those promises are going to actually be kept? 18:36
Woodi thanx YAPC for Damian video! but wondering do I need to pay now ? :) 18:38
BrokenRobot You could pitch in to TPM for funding his Toronto talks next week (and yes, both will be recorded): www.gofundme.com/damian_conway 18:46
tony-o timotimo: what ever happened with the servers that were donated ~2 years ago, are those still running the perl6 docs/sites ? 18:47
BrokenRobot One: www.meetup.com/Toronto-Perl-Mongers...231418224/ and the other: www.meetup.com/Toronto-Perl-Mongers...231418278/
timotimo tony-o: that's what runs p6c.org 18:48
timotimo i hadn't realized that's already 2 years old 18:48
tony-o it may be less, i have so much old code lying around it's difficult to put a timeline on anything in p6 18:51
yanmc what's preferred in a shebang, perl with `use 6.c' or just perl6? 18:53
dogbert17 is gfldex still around? 18:54
mst perl6 with 'use 6.c'
tony-o yanmc: i use 'perl6' 18:55
[Coke] perl with use 6.c -- won't work. 18:56
mst right
perl6 in the shebang, but 'use 6.c' is still a good thing
[Coke] perl6 -- will eventually have issues when the next spec is released.
mst is correct.
yanmc got it, thanks guys
dogbert17 I have tried to write some docs for method pairs in Baggy, is it ok? gist: gist.github.com/dogbert17/efcb4849...942b42fbf3 18:59
moritz dogbert17: "the weight that element. 19:08
"
the weight *of* that element
otherwise, good
dogbert17 moritz: oops, will fix ...
moritz maybe you want to add an example with a weight != 1 19:09
dogbert17 moritz: will do
moritz m: say bag(<bacon egg bacon>).pairs.sort
camelia rakudo-moar 0e10f4: OUTPUT«(bacon => 2 egg => 1)␤»
dogbert17 I'll steal it :)
moritz well, I mostly stole it from you in the first place :-) 19:10
dogbert17 :-)
dalek c: 74757ad | (Jan-Olof Hendig)++ | doc/Type/Baggy.pod:
Added docs for method 'pairs' in Baggy. moritz++
19:13
dogbert17 method 'pairs' in Baggy sounded better than Baggy.pairs methinks 19:16
lizmat
.oO( good thing we don't have a "pants" method )
19:17
moritz I'm sure TimToady will find a good rationale for including one
:-)
[Coke] was happy to hear the liz/wendy shoutout in the keynote *kermit arm flail8
m: Cat.new:pants 19:18
camelia rakudo-moar 8ad19e: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared name:␤ Cat used at line 1. Did you mean 'Rat'?␤␤»
moritz m: ::Cat.new:pants
camelia rakudo-moar 8ad19e: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤No such symbol 'Cat'␤at <tmp>:1␤------> 3::Cat7⏏5.new:pants␤»
Xliff .tell FROGGS I've submitted the PR. Hope to hear from you soon. 19:19
yoleaux Xliff: I'll pass your message to FROGGS.
dogbert17 lizmat: how is YAPC? 19:20
lizmat dogbert17: it's cool with a lot of Perl 6 :-) 19:25
Xliff Are there going to be slide? 19:31
Please tell me there will be slides.
For us unlucky people who were unable to attend.
lizmat I understand there'll be at least videos
Xliff Ooh! bag =:= histogram? 19:32
moritz yes 19:33
Xliff [Coke], liz/wendy?
Lisa and Wendy?
lizmat Liz
no royalty involved 19:34
Xliff kk... not who I am thinking of, then.
lizmat++
Dude, I still can't believe he's gone.
dogbert17 lizmat: sounds nice
Prince?
Xliff dogbert17, Yes.
moritz Xliff: if you've ever mit lizmat and wendy, you won't forget :-)
*met
Xliff LOL! 19:35
moritz, I bet
So...YAPC videos... I will search for them later.
raiph can lizmat or anyone else advise on who to contact re www.reddit.com/r/perl/comments/4oy...am/d4h1f71 ? 19:45
lizmat please report on the #yapc channel on irc.perl.org and mention it to e.g. genehack 19:46
BrokenRobot raiph: BTW, I saw some commits go into Rakudo, but they were credited to just `raiph` in the release log. If in the future you want to be credited by some other name, please submit a PR adding yourself to github.com/rakudo/rakudo/blob/nom/CREDITS 19:48
raiph lizmat: thanks
BrokenRobot: thanks 19:49
perlpilot_tpc BrokenRobot++ (I don't know entirely why, but I find it important that people be credited the way they want to be) 19:50
dogbert17 moritz: is it ok if I trouble you with one more doc gist? 19:53
dalek c: c6e9981 | (Jan-Olof Hendig)++ | doc/Type/Baggy.pod:
Added docs for Baggy.antipairs
20:04
moritz dogbert17: sure 20:05
dogbert17 moritz: I jumped the gun and committed just above your reply, sorry :( 20:10
moritz dogbert17: I'm fine with that 20:11
moritz dogbert17: you're free to commit without any sort of pre-review :-) 20:11
perlpilot_tpc dogbert17: forgiveness >>> permission
moritz m: say bag(<eggs bacon>).antipairs 20:12
camelia rakudo-moar 8ad19e: OUTPUT«(1 => bacon 1 => eggs)␤»
moritz dogbert17: in that example, the 2 is a bit of a mistery
dogbert17 moritz: not only that, I seem to have destroyed the page although I don't know how 20:13
see doc.perl6.org/type/Baggy 20:14
how on earth did my commit manage to do that, hmm 20:15
yanmc m: my @t = 1, 3; say $@t
camelia rakudo-moar 8ad19e: OUTPUT«[1 3]␤»
yanmc the double sigil, isn't that how to get the length of a list? 20:16
moritz doc.perl6.org/build-log/build-2016-...5+0000.log says
Use of uninitialized value $source-name of type Any in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in sub extract-pod at ./htmlify.p6 line 189
Baggy does not have an =SUBTITLE
oh, sorry for spamming
yanmc: no, that's perl 5 thinking
perlpilot_tpc m: my @t = 1, 3; say +@t;
camelia rakudo-moar 8ad19e: OUTPUT«2␤»
moritz yanmc: @t.elems or +@t
yanmc: scalar context doesn't lose information as in p5 20:17
dogbert17 moritz: strange, I can see it in the document, running htmlify now 20:19
moritz dogbert17: agreed, something is triggering a strage corner case in htmlify
yanmc hmm, thanks, I don't know that much about p5 though
yanmc so it automatically does the right thing, as in 20:20
m: my @t = 1, 3; say ([+] @t) / @t
camelia rakudo-moar 8ad19e: OUTPUT«2␤»
dogbert17 moritz: on this page, doc.perl6.org/type.html, role is suddenly written twice
moritz yanmc: yes, that's numeric context
dogbert17: "huh" 20:21
dogbert17 role, role Baggy Collection of distinct weighted objects 20:22
moritz dogbert17: did you happen to check the HTML before that commit?
dogbert17 moritz: no :( but I should have. oO(the changes looked so innocent) 20:23
moritz no, that's fine, something in the tooling is brittle 20:24
dogbert17 moritz: I'll try to figure it out
dalek c: ebb259c | moritz++ | doc/Type/Baggy.pod:
Stylistic improvements to Baggy.pod
[Coke] first step - see if baggy looks ok in the previous version: if so, revert until we sort it out
... unless we're piling more on it. nevermind. I leave to y'all 20:25
leave *it
moritz the role, role thingy kinda makes me think it tries to register role Baggy twice 20:26
and the second one overrides the first, which leads to the methods all going missing
... or something like that
yanmc in $t.^name is the carret part of the (method?) name or is it some kind of operator 20:27
moritz yanmc: it's part of the method call operator, and here means "call the method on meta object" 20:28
$t.^name is short for $t.HOW.name($t) 20:29
dogbert17 moritz: I ran htmlify on my machine and it worked, the only change I had done was to add some bacon in the example 20:30
moritz dogbert17: commit it!
dogbert17 will do 20:31
moritz and I should install a newer perl6 on the server that builds the docs 20:31
moritz oh, the methods are back on doc.perl6.org/type/Baggy 20:32
moritz cosmic rays, probably 20:34
dogbert17 moritz: strange indeed
I now have a merge commit in my repo, how do I get rid of that 20:35
or shoul I leave it ... 20:36
s/shoul/should/
dalek c: 4678149 | (Jan-Olof Hendig)++ | doc/Type/Baggy.pod:
Fixed broken code example. moritz++
20:39
dogbert17 hopefully the methods will stay in place :) 20:41
dogbert17 there's something fishy with class Grammar as well 20:42
class, class Grammar Group of named regexes that form a formal grammar
moritz something's fishy in the state of 6mark 20:46
masak question: how do you parse with a grammar, but allow it to match a prefix of the string you pass in? 20:52
masak that is, I'm fine with the implicit ^ anchor it puts in, but I want it to ignore the implicit $ anchor 20:53
moritz masak: .subparse? 20:53
masak that seems to do it -- thanks, moritz++
moritz masak: as shocking as it might seem, we actually have API docs for class Grammar :-) 20:54
masak moritz: I'm still getting used to that idea
moritz (not that I mind such questions)
masak though truth be told, it was very likely quicker to ask here, thanks to you :P
perlpilot_tpc moritz: So .... I type "p6doc XXX" what's XXX? ;)
moritz perlpilot_tpc: you open doc.perl6.org/type/Grammar and the TOC already enlightens you :-) 20:55
masak .oO( .subtweet ) 21:02
masak is there a way to ask a failed match how far it managed to match before it started backtracking and failing? 21:20
dogbert17 class QuantHash does Associative { } should this be role QuantHash does Associative { } 21:21
lizmat masak: wasn't there something with a local FAILGOAL ? 21:31
masak lizmat: that does sound familiar 21:33
pmichaud sounds like "high water mark" 21:36
timotimo ohai pmichaud! 21:37
pmichaud timotimo: o/
timotimo can we talk about updating wordpress on rakudo.org some time soon-ish?
ShimmerFairy \o
timotimo mostly needs someone who can make a full backup before and perhaps a full restore after someone clicks the "install update" button 21:38
pmichaud timotimo: moritz++ already asked me about it. I'll take care of it Wednesday or Thursday, when I'm done with my YAPC::NA stuff
timotimo oh, cool!
thanks :)
heyo ShimmerFairy
i haven't actually looked into supernova since last we talked :<
arnsholt masak: That definitely sounds like the high water mark. Sadly I never could figure out quite how that works
pmichaud (I have a variety of things that have to happen for all of the domains on that server, so will also be working on that over the next few weeks.)
Zoffix pmichaud, https would be cool too :) rt.perl.org/Ticket/Display.html?id=128423 21:39
Quick, everyone! Give pmichaud more jobs! :P
ShimmerFairy timotimo: atm I'm working on a grammar for C++, so I've not thought about it much either :P . (I'm glad it's easy to pull in HLL::Grammar now though.)
pmichaud Zoffix: yes, I saw that ticket also. Fixing https may be more of a challenge. I've looked into setting up a certificate before and it didn't quite make sense to me.
yanmc m: $t=1..3; for ^3 Z $t -> $a, $b { say "$a -- $b" }
camelia rakudo-moar ee663c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$t' is not declared␤at <tmp>:1␤------> 3<BOL>7⏏5$t=1..3; for ^3 Z $t -> $a, $b { say "$a␤»
yanmc it fails anyway, but I'd expect the same output as 21:40
Zoffix pmichaud, oh :( I'd offer to help, but I'm clueless myself.
ShimmerFairy pmichaud: don't remember what it was called, but there was some kind of effort set up a while back (supported by Mozilla IIRC) to make it easy & free to HTTPS-ify a site.
Zoffix yanmc, you need 'my' before $t
yanmc m: my $t=1..3; for $t.kv -> $a, $b { say "$a -- $b" }
camelia rakudo-moar ee663c: OUTPUT«0 -- 1␤1 -- 2␤2 -- 3␤» 21:40
yanmc Zoffix: I know, I copy/pasted from the REPL and forgot to add it
pmichaud in a larger sense I have to figure out what to do with that server in general. It's running CentOS 5 which is being end-of-lifed, and IIUC I have to migrate everything to a new server (there's no in-place upgrade option) 21:40
so I'm re-evaluating the whole service proposition. :) 21:41
anyway, it's on my list, and after this week I'll even have tuits
dj_goku the SSL cert is for host.pmichaud.com and not *.rakudo.org 21:42
dalek c: a80a093 | (Jan-Olof Hendig)++ | doc/Type/ (2 files):
Iterable and QuantHash are roles
masak jnthn++'s grammar-tracer++ to the rescue in the end. shoulda used it sooner. 21:42
also, I ought to write a small script which just clones the grammar-debugger and Terminal-ANSIColor repositories straight into wherever I'm writing code, setting up the paths for me :) 21:43
and another script that cleans up afterwards
Zoffix m: my $t=1..3; for <0 1 2 1 2 3> -> $a, $b { say "$a -- $b" } 21:44
camelia rakudo-moar ee663c: OUTPUT«0 -- 1␤2 -- 1␤2 -- 3␤»
Zoffix m: my $t=1..3; for |(|^3 Z |$t) -> $a, $b { say "$a -- $b" }
camelia rakudo-moar ee663c: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤ in block <unit> at <tmp> line 1␤␤»
Zoffix Why doesn't the second one work?
m: my $t=1..3; say |(|^3 Z |$t)
camelia rakudo-moar ee663c: OUTPUT«(0 1 2 1 2 3)␤»
yanmc try it with 1..4
DrForr_ destresses.
ShimmerFairy masak: if only there was some kind of modular system to do all this for you... :P 21:45
yanmc somehow it zips in the wrong direction? hard to explain
Zoffix yanmc, zips fine to me
masak m: my $t=1..3; for |(|^3 Z |$t) -> ($a, $b) { say "$a -- $b" }
camelia rakudo-moar ee663c: OUTPUT«Too many positionals passed; expected 2 arguments but got 6 in sub-signature␤ in block <unit> at <tmp> line 1␤␤»
Zoffix Oh
masak m: my @t = 1..3; for ^3 Z @t -> ($a, $b) { say "$a -- $b" } 21:46
camelia rakudo-moar ee663c: OUTPUT«0 -- 1␤1 -- 2␤2 -- 3␤»
masak there ya go
Zoffix yanmc, good catch
yanmc masak: ah, took me a while to see the change :)
pmichaud DrForr: suggestion: for ^@a.elems -> $key { ... } might be more canonically written as for @a.keys -> $key { ... }
Zoffix masak, but how come the slips didn't work? :) And how come |(|^3 Z |$t) zips the middle two elements backwards? 21:47
m: my @t = 1..3; my $t = 1..3; say ^3 Z @t; say |(|^3 Z |$t);
camelia rakudo-moar ee663c: OUTPUT«((0 1) (1 2) (2 3))␤(0 1 2 1 2 3)␤»
yanmc I did pick bad numbers; to not go crazy, don't use the same set of numbers in the two lists ;-) 21:48
DrForr_ Thanks. I'll probably use this later on, good to know.
Zoffix m: my @t = 1..3; my $t = 6..9; say ^3 Z @t; say (|(^3) Z |($t)); 21:49
camelia rakudo-moar ee663c: OUTPUT«((0 1) (1 2) (2 3))␤((0 1 2 6 7 8 9))␤»
Zoffix Still messed up
m: my @t = 1..3; my $t = 6..9; say ^3 Z @t; say @^3 Z @$t; 21:50
camelia rakudo-moar ee663c: OUTPUT«((0 1) (1 2) (2 3))␤((one(Mu.new, 3) 6) (one(Mu.new, Mu.new) 7) (one(Mu.new, Mu.new) 8) (one(Mu.new, Mu.new) 9))␤»
Zoffix m: my @t = 1..3; my $t = 6..9; say ^3 Z @t; say @(^3) Z @$t;
camelia rakudo-moar ee663c: OUTPUT«((0 1) (1 2) (2 3))␤((0 6) (1 7) (2 8))␤»
Zoffix K, I think I get it
m: &infix:<Z>.candidates.say 21:51
camelia rakudo-moar ee663c: OUTPUT«(sub infix:<Z> (+ is raw, :$with!) { #`(Sub|39599664) ... } sub infix:<Z> (+ is raw) { #`(Sub|39599816) ... })␤»
masak ShimmerFairy: if I didn't know better, I'd think you were sarcastic or sump'n ;)
Zoffix: I have no idea, I just do it that way with the parens 21:52
Zoffix masak, in the broken version it zips up just the last element of the first list and the first element of the second list. It needs single things on LHS/RHS not lists. 21:54
masak if you say so 21:58
tonight's hard lesson: ordering between rules in a proto rule really matters 21:59
sortiz \o #perl6 22:03
Zoffix \o
sortiz Zoffix++ # #100 22:04
Zoffix \o/
lizmat socializing& 22:06
Zoffix m: grammar Foo { token TOP { <digit>+ }; token digit:sym<sign> { <[+-]> }; token digit:<num> { \d } }; say Foo.parse: '+20'; 22:16
camelia rakudo-moar ee663c: OUTPUT«Nil␤»
Zoffix What is this :sym<> stuff on tokens? What does it do?
Zoffix m: grammar Foo { token TOP { <digit>+ }; proto token digit {*}; token digit:sym<sign> { $<sign> = <[+-]> }; token digit:sym<num> { $<num> = \d+ } }; say Foo.parse: '+20'; 22:21
camelia rakudo-moar ee663c: OUTPUT«「+20」␤ digit => 「+」␤ sign => 「+」␤ digit => 「20」␤ num => 「20」␤»
Zoffix k 22:22
masak 'night, #perl6 22:23
Zoffix night 22:24
sortiz night masak
raiph m: grammar g { rule TOP { alternative1 | alternative2 } }; say g.parse("alternative2") 22:37
camelia rakudo-moar ee663c: OUTPUT«「alternative2」␤»
raiph m: grammar g { proto rule TOP { * }; rule TOP:sym<this> { alternative1 }; rule TOP:sym<that> { alternative2 } }; say g.parse("alternative2")
camelia rakudo-moar ee663c: OUTPUT«「alternative2」␤»
raiph ^^Zoffix I think these are equivalent
(well, forget the proto'ing of TOP that's irrelevant) 22:38
Zoffix raiph, is there a way to get the name inside of :sym<> tho? 22:44
Zoffix m: grammar Foo { token TOP { <digit>+ }; proto token digit {*}; token digit:sym<sign> { <[+-]> }; token digit:sym<num> { \d+ } }; say Foo.parse: '+20'; 22:44
camelia rakudo-moar ee663c: OUTPUT«「+20」␤ digit => 「+」␤ digit => 「20」␤»
Zoffix I mean for this ^ to say 'sign' => + / num => 20
raiph Zoffix: I don't understand what you're thinking with that grammar. So lemme try my own way to do what I think you mean to do. 22:50
Zoffix m: grammar Foo { token TOP { <digit>+ }; proto token digit {*}; token digit:sym<sign> { $<sign> = <[+-]> }; token digit:sym<num> { $<num> = \d+ } }; say Foo.parse: '+20';
camelia rakudo-moar ee663c: OUTPUT«「+20」␤ digit => 「+」␤ sign => 「+」␤ digit => 「20」␤ num => 「20」␤»
Zoffix like this, but without the 'digit' keys :)
raiph m: grammar Foo { token TOP { <sign> <digits> }; token sign { < + - > }; token digits { \d+ } }; g.parse: '+20' 22:53
camelia rakudo-moar ee663c: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ g used at line 1␤␤»
raiph m: grammar Foo { token TOP { <sign> <digits> }; token sign { < + - > }; token digits { \d+ } }; Foo.parse: '+20'
camelia ( no output )
raiph m: grammar Foo { token TOP { <sign> <digits> }; token sign { < + - > }; token digits { \d+ } }; say Foo.parse: '+20'
camelia rakudo-moar ee663c: OUTPUT«「+20」␤ sign => 「+」␤ digits => 「20」␤»
Zoffix Yeah, I know of that way, I was just curious of the :sym<> stuff 22:53
It's fine, I'll play with it around later and figure it out :) 22:54
raiph Fair enough :) 22:54
Zoffix: The `foo:sym<this>` does the alternate matching thing I mentioned plus I think that `<sym>` within the foo rule matches 'this' 22:56
Zoffix Thanks.
raiph m: grammar Foo { token TOP { <.digit>+ }; proto token digit {*}; token digit:sym<sign> { $<sign> = <[+-]> }; token digit:sym<num> { $<num> = \d+ } }; say Foo.parse: '+20'; 22:59
camelia rakudo-moar ee663c: OUTPUT«「+20」␤»
stevieb9 is "has Bool $!disabled = False;" valid? In one of my test files, after creating a second subtest that creates a second, separate object, I get: "P6opaque: no such attribute '$!disabled' in type Log::Simple when trying to check if it's initialized 23:00
" and can't figure out for the life of me why. I've tried using a BUILD submethod, but then I get different errors.
Zoffix stevieb9, yeah, it is
Zoffix m: say class Foo { has Bool $!disabled = False; method dis { $!disabled } }.new.dis 23:01
camelia rakudo-moar ee663c: OUTPUT«False␤»
stevieb9 m: say class Foo { has Bool $!disabled = False; method dis { defined $!disabled } }.new.dis
camelia rakudo-moar ee663c: OUTPUT«True␤»
stevieb9 hmmm
sortiz m: False.defined.say; # False and True are indeed defined 23:04
camelia rakudo-moar ee663c: OUTPUT«True␤»
timotimo when you build your own BUILD, default values won't work any more ... or something like that?
stevieb9 it barfs always in the second subtest, as I create a new object. One object per subtest. If I move the subtests around, it always fails at the second object creation, so it doesn't appear to be test related 23:05
Zoffix stevieb9, why not show the full code?
stevieb9 test: github.com/stevieb9/perl6-log-simp...-methods.t 23:06
code: github.com/stevieb9/perl6-log-simp...Simple.pm6 23:07
stevieb9 I think I lied. It looks like it always dies in the test that call the "_N" methods, which in turn calls log() (the dies-ok() tests) 23:10
ShimmerFairy there isn't a lot of documentation on how HLL::Grammar's operator precedence parser works, is there? (Trying to figure out what specific keys do is tough.)
ShimmerFairy e.g. I spot a 'uassoc' key that appears to be unused, but which I'm guessing determines the left/right associativity for unary ops (which are otherwise marked :assoc<unary>) 23:14
raiph stevieb: you're composing an object in FALLBACK?
(Well, adding methods and recomposing, but I'm still surprised and suspicious of such a power move) 23:16
stevieb9 my goal there is to auto-generate methods so that I don't have to repeat a whole bunch of code, but I'm too new to understand if that's breaking other things 23:17
the following works fine, and does what I expect: perl6 -MLog::Simple -e 'my $l=Log::Simple.new; my $l2=Log::Simple.new; $l._7("obj1"); $l2._2("obj2");' 23:20
so I don't know what's up with the test file 23:21
hmmm, this doesn't though: perl6 -MLog::Simple -e 'my $l=Log::Simple.new; $l._3("obj1 3"); my $l2=Log::Simple.new; $l._7("obj1"); $l2._2("obj2");' 23:22
so if I call log() (through the numbered methods) prior to creating the second object, it breaks.
unfortunately I've got to take off for a while, but I'll play around again later. I may just have to take a step back and write simpler code until I can start better understanding what's actually happening :) 23:26
raiph stevieb9: If I figure anything out I'll .tell you. Maybe catch you later. o/ 23:28
AlexDaniel “The following list is stolen from the Perl 5 perlunicode documentation:” :D 23:38
not sure if “stolen” is the right word, but it is funny :)
sortiz Surprised by the change in REPL output from 2016.06+, now the eval result is printed even when undefined (i.e, a simple "enter" produces Nil). Is this change documented? 23:40
ShimmerFairy Oh, that reminds me, I had an idea to "rewrite" the synopses using the tests as a base; something like literate programming, though not necessarily put the doc part in-source. The idea being that someone wanting to learn the exact specification of P6 would likely prefer English to read :) 23:44
BrokenRobot sortiz: it's likely caused by awwaiid++'s REPL rework. It went in about a week before the release: github.com/rakudo/rakudo/pull/738 23:54
As for documented: no idea. It wasn't mentioned in the release notes/change log as I figured it was just an internal change that weren't supposed to have any user-facing side effects 23:55
sortiz BrokenRobot, Well. I like it, only that just now notice it :-) 23:59