»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
SmokeMachine hi! 01:40
is there a way to do it with set_build? 01:41
m: multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { class :: does Positional[Int] {}.new } }; say class :: { has Int @.a is bla }.new
camelia Type check failed in assignment to @!a; expected Int but got <anon|1> (<anon|1>.new)
in block <unit> at <tmp> line 1
SmokeMachine without the type it works... 01:49
m: class Bla does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Bla.new } }; say class :: { has @.a is bla }.new
camelia <anon|1>.new(a => [Bla.new])
lookatme_q m: multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Array.new } }; say class :: { has Int @.a is bla }.new 01:56
camelia <anon|1>.new(a => Array[Int].new())
lookatme_q SmokeMachine, seems like it's a type mismatch error 01:57
SmokeMachine m: say class Bla does Positional[Int] {} ~~ Positional[Int] 01:58
camelia True
lookatme_q m: my @a; say @a ~~ Positional[Int] 01:59
camelia False
lookatme_q m: my @a; say @a.isa: Positional[Int]
camelia False
SmokeMachine m: say Array[Int] ~~ Positional[Int]
camelia True
SmokeMachine so looks its not using smartwatch...
lookatme_q m: my @a; say @a.does: Positional[Int]
camelia False
lookatme_q m: my Int @a; say @a.does: Positional[Int] 02:00
camelia True
SmokeMachine m: my Int @a; say @a.does: Positional[Int]
camelia True
lookatme_q m: my Int @a; say @a.does(role :: does Positional[Int] {})
camelia False
lookatme_q m: say Positional[Int].does(my @a) 02:01
camelia False
lookatme_q m: say Positional[Int].does(my Int @a)
camelia False
lookatme_q m: say Array[Int].does(my Int @a) 02:02
camelia True
lookatme_q m: say Array[Int].does(my @a)
camelia True
SmokeMachine hum!
I still don't get it... 02:04
lookatme_q yeah 02:05
but I think it is said `class Bla does Positional[Int]` is not a `@a, Int @a`
say (my @a).WHAT 02:06
evalable6 (Array)
lookatme_q m: say (my @a).WHAT
camelia (Array)
lookatme_q SmokeMachine, in default it is Array
That's the point, I think
SmokeMachine m: (my Int @a).^name 02:07
camelia ( no output )
SmokeMachine m: say (my Int @a).^name
camelia Array[Int]
SmokeMachine m: say (my Int @a) ~~ class Bla does Positional[Int] 02:08
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse class definition
at <tmp>:1
------> 3nt @a) ~~ class Bla does Positional[Int]7⏏5<EOL>
SmokeMachine m: say (my Int @a) ~~ class Bla does Positional[Int] {}
camelia False
SmokeMachine m: say (my Int @a) ~~ class Bla is Array[Int] {} 02:08
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot resolve caller trait_mod:<is>(Bla, Array, Array); none of these signatures match:
(Mu:U $child, Mu:U $parent)
(Mu:U $child, :$DEPRECATED!)
(Mu:U $type, :$rw!)
(Mu:U $type,…
lookatme_q m: say (my Int @a) ~~ (class Bla is Array[Int] {}) 02:09
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot resolve caller trait_mod:<is>(Bla, Array, Array); none of these signatures match:
(Mu:U $child, Mu:U $parent)
(Mu:U $child, :$DEPRECATED!)
(Mu:U $type, :$rw!)
(Mu:U $type,…
lookatme_q m: say (my Int @a) ~~ (class Bla is Array {}) 02:09
camelia False
lookatme_q m: say (class Bla is Array {}) ~~ (my Int @a)
camelia True
SmokeMachine m: say (my Int @a) ~~ (class Bla is Array { method of { Int }}) 02:10
camelia False
lookatme_q I think you reverse them
SmokeMachine m: say (class Bla is Array { method of { Int }}) ~~ (my Int @a)
camelia True
lookatme_q If you want assign something to @a, that thing should be a @a
m: say (class Bla is Array {}).isa: (my Int @a) 02:11
camelia False
lookatme_q m: say (class Bla is Array {}).does: (my Int @a)
camelia False
SmokeMachine m: class Bla does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Bla.new } }; say class :: { has @.a is bla }.new
camelia <anon|1>.new(a => [Bla.new])
SmokeMachine m: class Bla does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Bla.new } }; say class :: { has Int @.a is bla }.new
camelia Type check failed in assignment to @!a; expected Int but got Bla (Bla.new)
in block <unit> at <tmp> line 1
SmokeMachine m: class Bla does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { my Int @a } }; say class :: { has Bla $.a is bla }.new 02:12
camelia Type check failed in assignment to $!a; expected Bla but got Array[Int] (Array[Int].new())
in block <unit> at <tmp> line 1
lookatme_q m: class Bla does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Bla.new } }; say class :: { has Array[Int] $.a is bla }.new
camelia Type check failed in assignment to $!a; expected Array[Int] but got Bla (Bla.new)
in block <unit> at <tmp> line 1
SmokeMachine not working either...
lookatme_q m: class Bla does Positional[Int] {}; my Bla $.a = (my Int @x); 02:15
camelia Potential difficulties:
Useless generation of accessor method in mainline
at <tmp>:1
------> 3ass Bla does Positional[Int] {}; my Bla 7⏏5$.a = (my Int @x);
Type check failed in assignment to $.a; expected Bla but got Array[In…
lookatme_q m: class Bla does Positional[Int] {}; my Bla $a = (my Int @x);
camelia Type check failed in assignment to $a; expected Bla but got Array[Int] (Array[Int].new())
in block <unit> at <tmp> line 1
SmokeMachine m: class Bla does Positional[Int] {}; my Bla $a := (my Int @x);
camelia Type check failed in binding; expected Bla but got Array[Int] (Array[Int].new())
in block <unit> at <tmp> line 1
lookatme_q m: class Bla does Positional[Int] {}; my Bla $a := (my Int @x);
camelia Type check failed in binding; expected Bla but got Array[Int] (Array[Int].new())
in block <unit> at <tmp> line 1
SmokeMachine m: class Bla does Positional[Int] {}; my Int @a := Bla.new; 02:16
camelia ( no output )
SmokeMachine that looks a bug for me... 02:17
m: class Bla does Positional[Int] {}; say class :: { has Int @.a = Bla.new }.new 02:18
camelia Type check failed in assignment to @!a; expected Int but got Bla (Bla.new)
in block <unit> at <tmp> line 1
SmokeMachine m: class Bla does Positional[Int] {}; say class :: { has Int @.a := Bla.new }.new
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use := to initialize an attribute
at <tmp>:1
------> 3; say class :: { has Int @.a := Bla.new 7⏏5}.new
SmokeMachine m: class Bla is Array does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { my Int @a } }; say class :: { has Bla $.a is bla }.new 03:48
camelia Type check failed in assignment to $!a; expected Bla but got Array[Int] (Array[Int].new())
in block <unit> at <tmp> line 1
SmokeMachine m: class Bla is Array does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Bla.new } }; say class :: { has Int @.a is bla }.new 03:50
camelia <anon|1>.new(a => Array[Int].new())
SmokeMachine \o/
SmokeMachine m: class Bla is Array does Positional[Int] {has $.b = 42}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Bla.new } }; say class :: { has Int @.a is bla }.new.a.b 03:52
camelia No such method 'b' for invocant of type 'Array[Int]'
in block <unit> at <tmp> line 1
SmokeMachine :(
it converts to Array... :(
buggable New CPAN upload: Template-Anti-0.5.0.tar.gz by HANENKAMP modules.perl6.org/dist/Template::An...:HANENKAMP
New CPAN upload: Template-Anti-0.5.1.tar.gz by HANENKAMP modules.perl6.org/dist/Template::An...:HANENKAMP 04:02
xinming m: subset X of Str where { /^My/ }; ("My" ~~ X).perl.say; 06:26
camelia Bool::False
xinming m: subset X of Str where { $_ ~~ /^My/ }; ("My" ~~ X).perl.say;
camelia Bool::True
xinming understand now, need the m/^My/; 06:27
buggable New CPAN upload: Term-Choose-1.4.4.tar.gz by KUERBIS cpan.metacpan.org/authors/id/K/KU/...4.4.tar.gz 06:52
buggable New CPAN upload: Term-Choose-Util-1.1.2.tar.gz by KUERBIS cpan.metacpan.org/authors/id/K/KU/...1.2.tar.gz 07:02
tobs m: subset X of Str where /^My/; ("My" ~~ X).perl.say; 07:10
camelia Bool::True
buggable New CPAN upload: Term-TablePrint-1.3.1.tar.gz by KUERBIS cpan.metacpan.org/authors/id/K/KU/...3.1.tar.gz 07:22
tobs there is no operator category for something of this form, right? circumfix-with-separator [*|*] 09:13
jnthn tobs: No, you'd do it as a circumfix and an infix 09:20
tobs jnthn: thanks. I should probably choose some unicode other than | for the separator anyway 09:22
scimon So I need a simple backend that can server static pages and do some basic JWT decoding... I'm sure I can think of something. 09:38
timotimo cro all the things
jnthn `get -> 'base', *@path { static 'static-files', @path } 09:40
Well, that was easy :P
AlexDaniel cro++ 09:43
jnthn That reminds me, I need to write my Cro talk for SPW... 09:44
lizmat waves from Cairnryan 10:14
yoleaux 23 Aug 2018 23:33Z <TimToady> lizmat: I didn't see any fix. The .. operator is currently specced to translate to ... when iterated, and ... is operating as designed. We could make .. behave differently, but then we might break any current code that relies on '000000' .. '177777' to generate all the octals.
23 Aug 2018 23:34Z <TimToady> lizmat: so any such change would have to be for 6.d
lizmat .tell TimToady fwiw, I was surprised by the behaviour. And I haven't been able to see any documentation or tests for it :-( 10:19
yoleaux lizmat: I'll pass your message to TimToady.
lizmat .tell changing the "AAS" .. "ABS" (Range) behaviour, did not set off any spectests
yoleaux lizmat: I'll pass your message to changing.
lizmat .tell TimToady changing the "AAS" .. "ABS" (Range) behaviour, did not set off any spectests 10:21
yoleaux lizmat: I'll pass your message to TimToady.
stmuk_ damm I'm missing SPW due to a new job :/ 10:32
hopefully there will be video 10:33
a3r0 cpan is under spam attack ?? 10:58
scimon My word. Cro all the things? Funny you should mention that ;) 11:57
scimon Simon deploy Cro app into QA environment. Wonders if people will notice. 12:54
uzl m: class A { has $.name; submethod TWEAK() { $!name = 'class A' } }; class B is A { }; say B.new().name(); 14:25
camelia class A
uzl I'm quite confused here. I thought submethods couldn't be inherited by child classes. 14:28
TimToady it isn't, but attribute accessors are
yoleaux 10:19Z <lizmat> TimToady: fwiw, I was surprised by the behaviour. And I haven't been able to see any documentation or tests for it :-(
10:21Z <lizmat> TimToady: changing the "AAS" .. "ABS" (Range) behaviour, did not set off any spectests
TimToady building B entails building A, which sets the attribute, which the .name accessor can get to 14:29
m: class A { has $!name; submethod TWEAK() { $!name = 'class A' } }; class B is A { }; say B.new().name();
camelia No such method 'name' for invocant of type 'B'. Did you mean any of these?
none
note
take

in block <unit> at <tmp> line 1
jnthn Or if the surprise is that the submethod is called, it's because BUILDALL calls the BUILD and TWEAK submethods all the way down the class hierarchy 14:30
That's why to write initialization logic there: it'll still be run reliably even if there's a subclass 14:31
TimToady and the submethod is used there instead of a method because submethods only apply infrastructural changes at the one level the submethod knows about, and not at any other level, which would happen if you accidentally used 'method' instead 14:34
TimToady m: class A { has $!name; method TWEAK() { $!name = 'class A' } }; class B is A { }; say B.new().name(); 14:34
camelia No such method 'name' for invocant of type 'B'. Did you mean any of these?
none
note
take

in block <unit> at <tmp> line 1
TimToady m: class A { has $.name; method TWEAK() { $!name = 'class A' } }; class B is A { }; say B.new().name(); 14:35
camelia class A
TimToady hmm, that should probably fail better
TimToady it looks like the initializer is assuming TWEAK is a submethod, when it isn't 14:36
jnthn The fail there was just because you declared $!name, not $.name, no? 14:37
TimToady no, the last one should fail, methinks
jnthn It just does a lookup and calls what it finds at that level, whether or not it's inherited. 14:38
TimToady it's acting like a submethod because of its name, seemingly, not because of a 'submethod' decl
why didn't it fail when called from B then?
since the attr is private?
jnthn Why would it fail? There's a method TWEAK visible from B
TimToady B shouldn't be able to set $!name 14:39
jnthn It can't
TimToady then why didn't it blow up?
jnthn It just does B.^lookup('TWEAK') and since the TWEAK in A is visible from there it finds it
TimToady I guess cause it's defined in the same class... 14:40
jnthn Right
It's just normal inheritance semantics
TimToady but we're calling it twice instead of once, which is suboptimal, I guess
jnthn S12, iirc, even says that you *can* write a normal method, you just better know what you're doing. I'm not actually sure how you would write one that is sensible, mind :)
TimToady well, it'd have to smart about 6model and stuff 14:41
jnthn Yeah, but it's not clear that it knows what "level" it's being called on
Or can find that out
Since `self` is of the type of the object we're constructing
TimToady maybe we should just have a (suppressible) warning if you define a BUILD/TWEAK as a method
jnthn That'd work for me. I've only ever done it by accident :) 14:42
TimToady method TWEAK is intentional-darn-it (...) {...}
uzl "TimToady: building B entails building A, which sets the attribute, which the .name accessor can get to". Oh, that makes sense. I didn't even think about that. 14:45
I'm just getting the rope of it so my bad if my question is kind of basic/naive. :) 14:46
Thanks for being so helpful!
TimToady no problem, took us years to detangle all this at the start :)
and we didn't even quite get BUILD right, which is why there's now a TWEAK :) 14:47
diakopter TWEAKers 14:52
pmurias what should VM.osname return in the browser? 'browser'? 15:03
gfldex pmurias: either the real OS name or "unknown" 15:04
or Any :)
gfldex what leaves the question what VM.osname would be correct for a Ubuntu container in a Debian VM on a Windows host 15:06
pmurias gfldex: would the osname be taken from the innermost os? 15:08
TimToady probably from the nearest thing that thinks of itself as an OS 15:09
gfldex pmurias: That could be wrong. If runtime behaviour depends on the container, the container would be correct. If you could market-share/install-base or other such nonsense, any single answer would be wrong. 15:10
TimToady a browser might be more like a DISTRO if you squint 15:11
gfldex s/could/count/
TimToady it's getting to be we need a full pedigree of wrappers... 15:12
gfldex Luckily we got a .wrap method. :) 15:13
TimToady confusing the matter is two entirely different levels calling themselves VMs
TimToady there's the M, then the VM, then the VVM, then the VVVM... 15:14
benjikun lol
benjikun A crazy convoluted world we're living in 15:21
TimToady I should probably point out that P6's $*VM is intended only to reflect reality at the JVM/MoarVM level, not the emulated-hardware level 15:31
TimToady one could imagine trying to reflect the whole stack recursively, but to the extent these emulations are successful, you shouldn't really be able to see outside of them anyway 15:33
araraloren m: class A { has $.name; submethod TWEAK() { $!name = 'class A' } }; class B is A { submethod TWEAK() { "in B".say; }; }; say B.new().name(); 16:13
camelia in B
class A
araraloren m: role A { has $.name; submethod TWEAK() { $!name = 'role A' } }; class B does A { submethod TWEAK() { "in B".say; }; }; say B.new().name(); 16:14
camelia in B
(Any)
araraloren m: role A { has $.name; submethod TWEAK() { $!name = 'role A' } }; class B does A { }; say B.new().name();
camelia role A
Geth ecosystem: samcv++ created pull request #407:
Add Git::Log module
16:29
sarna hey, how can I match only the first letters of words using a regex? I've been trying for quite some time now but I can't get it right :^( 16:32
timotimo so you want to express something like "the letters xyz and then any amount of any word letters"? 16:33
sarna no, something like "an example sentence" -> matches 'a', 'e' and 's' 16:34
benjikun m: say 'asdf apple american' ~~ /[(\w)\w+' ']+/; 16:35
camelia 「asdf apple 」
0 => 「a」
0 => 「a」
benjikun whoops, only matches with the space
timotimo how about using the % operator here?
seems like a perfect situation
alternatively, use comb 16:36
especially if you're only interested in the string anyway
m: say "asdf beetle cellophane diogenes".comb(/«(\w)\w+»/)
camelia (asdf beetle cellophane diogenes)
benjikun true, `%` seems good
timotimo oops wrong one
benjikun if you want regex, that is
timotimo m: say "asdf beetle cellophane diogenes".comb(/« <( \w )> \w+ »/)
camelia (a b c d)
sarna very nice, thanks :^) 16:37
avuserow m: say "foo bar qux".comb: /<|w>(\w)/;
camelia (f b q)
timotimo <( and )> let you get only a part of the matched stuff even in a comb, without having to use <?after> and <?before>
that's also good
ah, especially since my regex up there won't match any words with only a single letter
would have to be a * rather than a +
avuserow <|w> is a word boundary, like \b in p5 and some other engines 16:38
sarna that explains many things
jnthn m: say 'a nice sentence ~~ m:g/<< \w/
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1)
at <tmp>:1
------> 3say 'a nice sentence ~~ m:g/<< \w/7⏏5<EOL>
expecting any of…
jnthn m: say 'a nice sentence' ~~ m:g/<< \w/
camelia (「a」 「n」 「s」)
tbrowder_ is anyone working on a module to ease writing native call apps from api headers?
samcv my first new module in a long time! github.com/samcv/perl6-Git-Log 16:40
benjikun sarna: I doubt you need any more ideas, but you could also use split lol 16:42
m: say $_.substr(^1) for 'hello there'.split(' ')
camelia h
t
benjikun or `.words` 16:45
Geth doc: 2859389709 | (JJ Merelo)++ | doc/Language/terms.pod6
Fixes anchors and reflows
17:24
synopsebot_ Link: doc.perl6.org/language/terms
tyil weekly: www.tyil.nl/post/2018/08/23/the-pe...n-glasgow/ 17:27
no notable? :o
Ulti tbrowder_: have you seen github.com/Skarsnik/gptrixie 17:53
not exactly a great name for discoverability... 17:54
SmokeMachine m: class Bla is Array does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Bla.new } }; say class :: { has Int @.a is bla }.new.^name # should Bla be converted to Array[Int]? 18:12
camelia <anon|1>
SmokeMachine m: class Bla is Array does Positional[Int] {}; multi trait_mod:<is>(Attribute $attr, Bool :$bla!) { $attr.set_build: -> | { Bla.new } }; say class :: { has Int @.a is bla }.new.a.^name # should Bla be converted to Array[Int]? 18:13
camelia Array[Int]
SmokeMachine shouldn't it be Black?
shouldn't it be Bla?
tbrowder_ Ulti: thnx! i have seen it but forgot about it. you’re right—name is forgettable, unfortunately 19:04
Ulti tbrowder_: I have to search for it each and every time :( 19:11
tbrowder_ it needs to be forked, given a new name, and made into a module and app 19:25
for cpan6 19:26
with good tags
Geth ecosystem: dabaf12ff6 | (Samantha McVey)++ | META.list
Add Git::Log module
19:41
ecosystem: cf3e682a56 | (Samantha McVey)++ (committed using GitHub Web editor) | META.list
Merge pull request #407 from samcv/Git-Log

Add Git::Log module
stmuk releasable6: status 20:07
releasable6 stmuk, Next release will happen when it's ready. 0 blockers. 480 out of 480 commits logged
samcv uploaded my first module to cpan 20:49
timotimo today i walked past someone in a YAPC Europe shirt and didn't think quickly enough to say "i see perl people" to him 20:50
buggable New CPAN upload: Git-Log-0.1.1.tar.gz by SAMCV modules.perl6.org/dist/Git::Log:cpan:SAMCV 20:52
tbrowder_ Ulti: has the gptrixie app worked pretty well for you? 21:11
tbrowder_ i would like to see a p6 version of pango, like p5, but that’s a lot of xs/api funcs to work with by hand. 21:13
timotimo in theory you could generate bindings from the gobject introspection thingie 21:14
i've looked into it briefly and ... i think it was very hard to find any documentation for someone who wants to build something with it?
i don't remember clearly; it's been a couple of years
tbrowder_ read too fast, it’s already a module in ecosystem 21:18
timotimo oh, OK! 21:21
maybe it needs a little input, still