»ö« 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.
vrurg Xliff: I'm not totally sure, but EXPORTHOW would only if declared in a compunit. 00:06
*would work
Xliff vrurg: Figured as much.
vrurg: It would be nice to be able to do everything you can with compunits in a REPL 00:07
vrurg maybe something like module Foo { my module EXPORTHOW { } }; import Foo – would work? Not sure though.
Xliff Oh! I keep forgetting about import. LOL! 00:08
Anyway, this is an odd duck:
"Type check failed in binding to parameter '$o'; expected Any but got A (?)"
I thought Any accepted anything,. 00:09
vrurg Xliff: no. Remember, there is Mu which is Perl6 root of everything. 00:10
Xliff OK. So I'm trying to override Metamodel::ClassHOW.compose. 00:12
And it's not doing what I'd expect the logical thing to be.
vrurg Xliff: Why can't you do a trait and just apply a role to ClassHOW? 00:13
Xliff "class Metamodel::myClass is Metamodel::ClassHOW { method compose ($o, :$compiler_services) {" <- the error is coming from the compose signature check. It's also taking a long time to run.
vrurg Xliff: try looking at my AttrX::Mooish. I intercept compose with a mixin role. 00:15
Xliff Ah! Thanks! 00:16
vrurg But I don't think you could gain any additional performance. It's Perl6, signature check will be there. 00:17
Ah, besides, compose can only be method compose(Mu);
Xliff OH!
vrurg Basically, typical signature for ClassHOW in Perl6 is compose(Mu \type, :$compiler-services) 00:18
Xliff That's what I'm doing. 00:19
vrurg Raw parameter speeds things up a bit because it doesn't cont/decont value.
Perhaps the problem is $o which is Any but has to be Mu? Sorry if I'm not following well, but fighting a bug alongside. :) 00:20
Xliff Ah. Hope you feel better. I am getting over one, too. 00:21
I'm probably not explaining well, either.
vrurg Basically, I understand the idea. But not sure if you really need to override all classes. 00:22
Perhaps, if you want to go this way, it'd be better to declare another keywords? like my-class instead of ? 00:23
of 'class'?
Xliff Hrm... no. Want to change 'class' like Grammar::Debugger HAS to change 'grammar'
Although that might be a decent compromise for the moment. 00:24
Oooh! I like this approach! 00:25
vrurg I briefly checked through Grammar/Actions – EXPORTHOW must work for class keyword anyway. 00:26
What approach excactly? ;)
Xliff Kinda viral. Applying a Mooish trait to an Attribute will attach a role to the implementing object's HOW. 00:27
vrurg Glad I helped! :) 00:28
Xliff :>
Xliff vrurg: Are roles composed independently of classes? 00:46
vrurg yes, if I get you correctly. They have own compose method. 00:47
Basically, any typeobject of composable archetype has compose.
Xliff vrurg: OK. Tell me if I'm crazy -- gist.github.com/Xliff/103cb6c06a6f...cc6a16b00a 00:50
I'm thinking the fix for my issue is to defer alias additions until the class is composed. 00:51
vrurg Xliff: no, it's better if you add a method before compose. 00:52
Xliff I am. Immediately before. 00:53
SmokeMachine t.co/fmMwEwPCme?amp=1
vrurg But, you might not get the right method in method.package.
Xliff Yeah. Just thought of that.
But it's resolvable if I do a deep dive through ^roles and ^mro, yes?
vrurg Xliff: see what you get in there. Perhaps you'd need to use $*PACKAGE which is the being compiled package.
Xliff Ah! 00:54
Something like this? (updated) 00:55
vrurg Due to the uncertain order of things at compile time, attributes doesn't get theit package set correctly. Same could happen to methods.
vrurg hopes to get his hands on this issue at some point.
Xliff Or is $*PACKAGE the FILE name and not the CLASS name? 00:56
(assiming compunit is a unit class)
vrurg $*PACKAGE will be your class because you're applying the trait to a method. 00:57
Xliff OK
vrurg See what you have in method.package and I'm afraid it wouldn't be the class the method belongs to. This is also where you have to use $*PACKAGE.
Also, if you apply the trait to more than one method – you'll mixin your role more than once into the same HOW object. 00:58
Xliff so is $*PACKAGE =:= ::?CLASS?
vrurg Yes, at this point of time.
Remember, that after all module, class, role – they're all packages. 00:59
Xliff So then it's $*PACKAGE.^name, right?
vrurg Xliff: actually, yes. 01:01
SmokeMachine: you mean no more additional List is needed? 01:02
SmokeMachine: I mean, coercion of .^all output
Xliff vrurg: OK. Updated.
vrurg Xliff: but you still miss the point about method.package.HOW does MyHOW. method.package could be not what you expect. I don't know exactly if I'm right but I highly suspect it is. 01:04
SmokeMachine vrurg: sorry? I didn’t understand...
vrurg SmokeMachine: I always had to do Model.^all.Seq or otherwise it didn't work. 01:05
SmokeMachine vrurg: for Set and Bag it did work (if I’m not wrong) but now it run specific query for each... 01:06
vrurg Ah, that's the point! Anyway, a most certainly great thing! Congrats! 01:07
SmokeMachine vrurg: and I’ve also fixed a .classify bug after a .map... 01:08
vrurg SmokeMachine: not sure what is it about. But, anyway, I have too little time left. Need to focus on the bug. :( 01:09
Xliff vrurg: Oh! Those shouold be $*PACKAGE as well. 01:18
vrurg Xliff: and don't forget to check if $*PACKAGE.HOW ~~ MyHOW before applying MyHOW 01:19
Xliff Heh. Thanks!
vrurg welcome! :) 01:22
Xliff OK. Updated again.
Xliff vrurg: Well... $*PACKAGE didn't work 02:20
It took the name of the role, rather than the name of the class. I will have to do a deep dive.
vrurg Of course and it will be always that way. Because method belongs to the role at compile time. 02:21
Xliff Yeah. Forgot
vrurg Xliff: unfortunately, there is no yet a way to catch the moment when role is being applied to a class. 02:22
But as a first approach you can try intercept specialize method on PatametericRoleHOW. 02:23
ClassHOW compise calls it before applying concretized role to itself.
Xliff Yeah. That's what's happening. 02:29
At class compose time, it doesn't look to have any roles.
I would think the roles would be there prior to compose.
Xliff .^roles_to_compose(\obj) returns nothing... 02:37
Ah! I see what you meant by .specialize. 02:38
vrurg roles_to_compose list gets emptied by ClassHOW compose method. 02:40
Xliff Yeah, but I have role overriding ClassHOW.compose
it calls nextsame at the end.
vrurg I'm just sharing some knowledge. :) 02:41
Xliff Ah.
I'm just confused why it is empty before ClassHOW.compose
vrurg BTW, AttrX::Mooish does it all. AttrXMooishRoleHOW actually does override specialize.
Xliff Looking. 02:42
vrurg Before? Hm, it shouldn't be.
Xliff AHHH!
vrurg BTW, note that most likely you'd have to postpone actual aliasing and do it not when the trait is called but when class compose is executed. 02:44
This compilcates things because I'd have to iterate over the methods and extract those you've marked for processing.
s/I'd/You'd/
Xliff Hehe 02:45
That's what I'm doing NOW
Postponing until class compose
vrurg time for supper. cu tomorrow!
o/
Xliff o/
Xliff m: class A {}; say A.WHO.^name 03:07
camelia Stash
Xliff m: Int.gist.^is_dispatcher.say 04:17
camelia No such method 'is_dispatcher' for invocant of type 'Perl6::Metamodel::ClassHOW'
in block <unit> at <tmp> line 1
Xliff m: Int.^find_method('gist').is_dispatcher.say
camelia True
xinming_ Is it possible to make perl6 like javascript, to dynamic initialize the self? 05:35
Something like, code.apply($self-object, ['arg1', 'arg2', 'arg3']); 05:36
Xliff xinming: I don't know exactly what you mean. 05:38
Do you have a use case?
xinming_ In js, we can have the 'this' to be intialized to a different object. 05:39
let's say, function test () { console.log(this); }; test.apply("Hello"); test.apply([]); <--- In this case, the this will be initialized to a string, and a array according to the arg passed. 05:40
Xliff Ah. 05:41
xinming_ What I mean is, wether it's possible to call a method in perl6 like this, that we provide different self to the method.
Xliff m: class A { has $!value; submethod BUILD (:$!value) {}; method new($a) { self.bless( value => $a ) }; method test { $!value.say }; }: say A.new('Hello').test; say A.new([]).test 05:43
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3 $a ) }; method test { $!value.say }; }:7⏏5 say A.new('Hello').test; say A.new([]).
expecting any of:
colon pair
Xliff m: class A { has $!value; submethod BUILD (:$!value) {}; method new($a) { self.bless( value => $a ) }; method test { $!value.say }; }; say A.new('Hello').test; say A.new([]).test
camelia Hello
True
[]
True
Xliff m: class A { has $!value; submethod BUILD (:$!value) {}; method new($a) { self.bless( value => $a ) }; method test { $!value.say }; }; A.new('Hello').test; A.new([]).test
camelia Hello
[]
Xliff xinming_: ^^ Something like that? 05:44
xinming_ Nope 05:45
Xliff Still confused, then. 05:46
Why do you need $!value to be self?
xinming_ class T { method x () { self.perl.say; } }; T.x.apply("abc"); T.x.apply([]); <--- the self here will be changed to "abc" or []
it's like multi, but not truely multi 05:47
Xliff Again, you aren't sufficiently explainingh why X can't use an attribute instead of self
Javascript's 'this' is an OO mutt. 05:48
This is so that Javascript can BE OO
xinming_ Xliff: because I wish that all that class methods will be changed to another "object"
It's a bit like localize the self before callign a method 05:49
Xliff But again. why do you need that to be self?
You're basically asking for an Object without a defined type. Perl6 doesn't do that.
"self" represents either the Class object, or the Class instance.
xinming_ Yea, that's what I'm asking.
IIRC, we can use multi to achieve that. 05:50
Xliff If you need something to be mutable like this, then you should use an attribute.
xinming_ Ok.
Xliff And yes, you can use multi's.
xinming_ Will think a different way to achieve this.
Xliff OK.
m: class A { multi method x (Str $a) { sau 05:54
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3class A { multi method x (Str $a) { sau7⏏5<EOL>
expecting any of:
statement end
statement modifier
statement modifier loop
Xliff m: class A { multi method x (Str $a) { say
camelia 5===SORRY!5===
Argument to "say" seems to be malformed
at <tmp>:1
------> 3class A { multi method x (Str $a) { say7⏏5<EOL>
Missing block
at <tmp>:1
------> 3class A { multi method x (Str $a) { say7⏏5<EOL>
expecting an…
Xliff m: class A { multi method x (Str $a) { say 'Str handled here'; }; multi method x (Int $a) { say 'Int handled here' }; multi method x (%a) { say 'Hash handled here'; }; }; A.x('Hello'); A.x(42); A.x( { me => 'bleh' }); 05:56
camelia Str handled here
Int handled here
Hash handled here
Xliff xinming_: ^^ Something more like that?
It has the advantage of not needing to be instantiated.
Xliff xinming_: If you want it so that you can apply() a value before calling methods on X, like so that A.apply("abc").x says "abc", then you can do that like this: 06:08
m: class A { has $!value; method apply($a) { $!value = $a; self }; method x { $!value.perl.say }; }; A.new.apply("abc} 06:10
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in double quotes; couldn't find final '"' (corresponding starter was at line 1)
at <tmp>:1
------> 3$!value.perl.say }; }; A.new.apply("abc}7⏏5<EOL>
expecting …
Xliff m: class A { has $!value; method apply($a) { $!value = $a; self }; method x { $!value.perl.say }; }; A.new.apply("abc) 06:10
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in double quotes; couldn't find final '"' (corresponding starter was at line 1)
at <tmp>:1
------> 3$!value.perl.say }; }; A.new.apply("abc)7⏏5<EOL>
expecting …
Xliff m: class A { has $!value; method apply($a) { $!value = $a; self }; method x { $!value.perl.say }; }; A.new.apply("abc")
camelia ( no output ) 06:10
Xliff m: class A { has $!value; method apply($a) { $!value = $a; self }; method x { $!value.perl.say }; }; A.new.apply("abc").x
camelia "abc"
Xliff For that to work without instantiation....
m: class A { my $value; method apply($a) { $value = $a; self }; method x { $value.perl.say }; }; A.apply("abc").x 06:11
camelia "abc"
Xliff But then you can't hold "abc" and then have another A that is (1, 2, 3) because $value exists as a class attribute
rba currently trying to to trouble-shoot modules.perl6.org. Seems that the dists from CPAN not got unpacked. Any idea? 06:28
SmokeMachine m: my &meth = Int.^lookup(“is-prime”); say 42.&meth 06:37
camelia False
SmokeMachine xinming_: were you asking for something like this ^^? 06:38
Xliff SmokeMachine: I don't think that's it. For one thing you need &meth from a type lookup. 06:46
El_Che insights.stackoverflow.com/survey/2019 <- it may interest some people here 06:52
Xliff WOO HOO!!! 07:36
Xliff found a solution for github.com/lizmat/Method-Also/issues/1
xinming_ m: method test { self.perl.say; }; 4.&test; "Hello".&test; 07:52
camelia 5===SORRY!5===
Undeclared routine:
test used at line 1

Other potential difficulties:
Useless declaration of a has-scoped method in mainline (did you mean 'my method test'?)
at <tmp>:1
------> 3method7⏏5 test { s…
xinming_ SmokeMachine: I want something like this. :-) 07:53
m: my method test { self.perl.say; }; 4.&test; "Hello".&test;
camelia 4
"Hello"
xinming_ and I have to say, I never thought this could work.
:-)
Thanks for your example.
Xliff m: sub test ($a) { $a.say }; 4.&test; "Hello".&test 07:54
camelia 4
Hello
Xliff xinming_: ^^^ There is no "self" in that case. Just the invocant, which could be anything. 07:55
xinming_ I'm still trying something else.
m: class A { has $.a = 3 is rw; method t { $!a += 10; $!a.perl.say; }; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); my &meth = T.^lookup('t'); $x.&meth(); $y.&meth(); 07:58
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3class A { has $.a = 37⏏5 is rw; method t { $!a += 10; $!a.perl.s
expecting any of:
infix
infix stopper
postfix
xinming_ m: class A { has $.a = 3 is rw; method t { $!a += 10; $!a.perl.say; }; }; 07:59
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3class A { has $.a = 37⏏5 is rw; method t { $!a += 10; $!a.perl.s
expecting any of:
infix
infix stopper
postfix
xinming_ m: class A { has $.a is rw = 3; method t { $!a += 10; $!a.perl.say; }; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); my &meth = T.^lookup('t'); $x.&meth(); $y.&meth();
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
T used at line 1
xinming_ m: class A { has $.a is rw = 3; method t { $!a += 10; $!a.perl.say; }; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); my &meth = A.^lookup('t'); $x.&meth(); $y.&meth();
camelia 15
16
xinming_ Xliff: This is what I want. 07:59
I want the "self" to be referenced dynamically, but also able to reference their values too. 08:00
*their attributes*
m: class A { has $.a is rw = 3; method t { $!a += 10; $!a.perl.say; }; }; class B { has $.a = 4; }; my $x = B.new(:a(5)); my $y = B.new(:a(6)); my &meth = A.^lookup('t'); $x.&meth(); $y.&meth(); 08:01
camelia Type check failed in binding to parameter '<anon>'; expected A but got B (B.new(a => 5))
in method t at <tmp> line 1
in block <unit> at <tmp> line 1
xinming_ m: class A { has $.a is rw = 3; method t { $!a += 10; $!a.perl.say; }; }; class B is A { }; my $x = B.new(:a(5)); my $y = B.new(:a(6)); my &meth = A.^lookup('t'); $x.&meth(); $y.&meth();
camelia 15
16
SmokeMachine m: class A { has $.a is rw = 3; method t { $!a += 10; $!a.perl.say; }; }; class B is A { }; my $x = B.new(:a(5)); my $y = B.new(:a(6)); $x.t; $y.t # xinming_, why not call the method? 08:07
camelia 15
16
xinming_ SmokeMachine: Because I want to provide these methods as callbacks 08:08
SmokeMachine m: class A { has $.a is rw = 3; method t { $!a += 10; $!a.perl.say; }; }; class B is A { }; my $x = B.new(:a(5)); my $y = B.new(:a(6)); my $meth = "t"; $x."$meth"(); $y."$meth"() # xinming_, or do that by the name?
camelia 15
16
xinming_ I'm still trying
SmokeMachine hum... 08:09
xinming_ m: sub t { $!a += 10; $!a.perl.say; }; }; class A { has $.a is rw = 3; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); $x.&t(); $y.&t(); 08:10
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable $!a used where no 'self' is available
at <tmp>:1
------> 3sub t { $!a7⏏5 += 10; $!a.perl.say; }; }; class A { ha
xinming_ m: my method t { $!a += 10; $!a.perl.say; }; }; class A { has $.a is rw = 3; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); $x.&t(); $y.&t();
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot understand $!a in this context
at <tmp>:1
------> 3my method t { $!a7⏏5 += 10; $!a.perl.say; }; }; class A { ha
SmokeMachine m: sub bla(&what-to-do) { say 42.&what-to-do }; bla Int.^lookup: "is-prime" # xinming_: something like this?
camelia False
xinming_ Nope;
I want to privde the code like that. 08:11
SmokeMachine m: sub t { .a += 10; .a.perl.say; }; }; class A { has $.a is rw = 3; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); $x.&t(); $y.&t(); 08:12
camelia 5===SORRY!5=== Error while compiling <tmp>
Unexpected closing bracket
at <tmp>:1
------> 3sub t { .a += 10; .a.perl.say; }; 7⏏5}; class A { has $.a is rw = 3; }; my $x
SmokeMachine m: sub t($_) { .a += 10; .a.perl.say; }; class A { has $.a is rw = 3; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); $x.&t; $y.&t 08:14
camelia 15
16
SmokeMachine m: my &t = method { self.a += 10; self.a.perl.say; }; class A { has $.a is rw = 3; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); $x.&t; $y.&t 08:15
camelia 15
16
xinming_ SmokeMachine: Is it possible to convert a "sub" into a method? 08:18
I mean a code block
let's say, my &.code = -> { self.a += 10; self.a.perl.say; };
soemthing like that.
or, we'll have to use the method 08:19
my &.code = method { };
SmokeMachine why do you need to use self? isn't $_ good enough? 08:30
Xliff xinming_: See? ;> 08:31
SmokeMachine m: my &t = { .a += 10; .a.perl.say; }; class A { has $.a is rw = 3; }; my $x = A.new(:a(5)); my $y = A.new(:a(6)); $x.&t; $y.&t
camelia 15
16
xinming_ needs to be out for a while, talk to you later. :-)
Xliff o/
SmokeMachine o/ 08:32
xinming_ SmokeMachine: yea, $_ is the thing I consider. i'm still think about it though
kawaii Are there any inotify bindings for P6? Google failed me. 10:23
Need to monitor a file for changes and do something `whenever` that happens. 10:24
SmokeMachine m: start react whenever ".".watch { .say }; "./bla.test".IO.spurt: "test"; sleep 1 10:26
camelia Unhandled exception in code scheduled on thread 4
Failed to open file /home/camelia/bla.test: Permission denied
in block <unit> at <tmp> line 1
SmokeMachine m: start react whenever "/tmp".watch { .say }; "/tmp/bla.test".IO.spurt: "test"; sleep 1 10:27
camelia Unhandled exception in code scheduled on thread 4
A react block:
in code at <tmp> line 1

Died because of the exception:
No such method 'watch' for invocant of type 'Str'. Did you mean any of these?
batch
match
SmokeMachine m: start react whenever "/tmp".IO.watch { .say }; "/tmp/bla.test".IO.spurt: "test"; sleep 1
camelia /tmp/bla.test: FileChanged
<tmp>: FileChanged
SmokeMachine kawaii: ^^
kawaii Ooooo that looks like it'll work
Thank you SmokeMachine! 10:28
SmokeMachine kawaii: np
SmokeMachine Xliff: but that's the same as `%results.values.map({ <complex function> if <some condition>})`, right? 11:24
SmokeMachine m: say (^10).map({ do if .is-prime { say "here"; $_ * 2 }}).head 11:26
camelia here
4
SmokeMachine m: say (^10).map({ do if .is-prime { say "here"; $_ * 2 }}).head(3) 11:27
camelia here
here
here
(4 6 10)
pmurias lizmat: the WIP rakudo.js report is still WIP so don't put it in the weekly just yet, will finish it up once I fix some bugs I found in things I wanted to mention as working in the report ;)
Xliff SmokeMachine: That depends. Do you want to be doing large and complex programming inside of .map()? 11:33
m: say (^10).map({ Nil }).elems 11:34
camelia 10
Xliff m: say (^10).map({ do if .is-prime { say "here"; $_ * 2 }}).elems
camelia here
here
here
here
4
SmokeMachine Xliff: that’s not Nil... that’s Empty... 11:35
Xliff m: say (^10).map({ 5 if $_ == 5 }).elems
camelia 1
Xliff Yeah. I never use map like that.
Nice to know, though.
But in that situation, even though it works it may not be easy for everyone to write. 11:36
There are a lot of gotchas there.
SmokeMachine m: say (^10).map({Empty}).elems
camelia 0
Xliff So while you are correct, it does give a similar result. It's not really about the result. It's about the thinking behind the way the result was obtained.
TIMTOWTDI 11:37
lizmat weekly: rakuist.io/articles/from-the-persp...re-or-less 12:15
notable6 lizmat, Noted! (weekly)
Xliff Is there a way I could run a list of values through an object constructor for a list of objects initialized with those values? 12:22
sena_kun Xliff, can you clarify a bit what you want? 12:26
maybe I can't read today, though. :)
SmokeMachine m: say (^10).map({ Int.new: $_ }) # Xliff: like this? 12:27
camelia (0 1 2 3 4 5 6 7 8 9)
Xliff Something like... ($a, $b, $c) = (1, 2, 3, 4, 5)».&Object.new
I'd rather not have the map.
Thanks, though. 12:28
sena_kun you don't need to specify type, actually
m: say (^10).map({ $_.new: $_ })
camelia (0 1 2 3 4 5 6 7 8 9)
SmokeMachine m: say (^10).&{ Int.new: $_ } # ???
camelia 10
SmokeMachine m: say (^10)>>.&{ Int.new: $_ } # ???
camelia (0 1 2 3 4 5 6 7 8 9)
Xliff Guys. Lose the Int
Arbitrary object.
SmokeMachine sena_kun: I was meaning Int being any class... 12:29
Xliff Oh. Missed the second one.
sena_kun SmokeMachine, yes, I meant that as a side note, sorry. 12:29
SmokeMachine sena_kun: np :)
sena_kun m: class A { has $.a }; my @a = A.new(a => $_) for <1 2 3 4>; say @a; 12:30
camelia [A.new(a => IntStr.new(4, "4"))]
sena_kun m: class A { has $.a }; my @a = A.new(a => $_) for |<1 2 3 4>; say @a;
camelia [A.new(a => IntStr.new(4, "4"))]
sena_kun erm
m: class A { has $.a }; my @a := A.new(a => $_) for <1 2 3 4>; say @a;
camelia Type check failed in binding; expected Positional but got A (A.new(a => IntStr.new(...)
in block <unit> at <tmp> line 1
sena_kun m: class A { has $.a }; my $a = A.new(a => $_) for <1 2 3 4>; say $a; 12:31
camelia A.new(a => IntStr.new(4, "4"))
sena_kun ok, just ignore me
SmokeMachine m: class C { has Int $.a; has Str $.b }; say [\(:1a, :b<um>), \(:2a, :b<dois>), \(:3a, :b<tres>)]>>.&{ C.new: |$_ } 12:32
camelia [C.new(a => 1, b => "um") C.new(a => 2, b => "dois") C.new(a => 3, b => "tres")]
sena_kun m: class A { has $.a }; my @a = [A.new(a => $_) for <1 2 3 4>]; say @a; 12:33
camelia [A.new(a => IntStr.new(1, "1")) A.new(a => IntStr.new(2, "2")) A.new(a => IntStr.new(3, "3")) A.new(a => IntStr.new(4, "4"))]
SmokeMachine m: class C { has Int $.a; has Str $.b }; say do for [\(:1a, :b<um>), \(:2a, :b<dois>), \(:3a, :b<tres>)] -> Capture c { C.new: |c } 12:34
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed parameter
at <tmp>:1
------> 3 :b<dois>), \(:3a, :b<tres>)] -> Capture7⏏5 c { C.new: |c }
expecting any of:
constraint
formal parameter
daxim > Merging is blocked 12:35
– Merging can be performed automatically with 13 approving reviews.
any more objections, or what's the delay?
Xliff This seems to have worked. Thanks SmokeMachine!
my ($m, $s) = .[0,1]».&{ GIO::FileAttributeMatcher.new($_) };
SmokeMachine Xliff: np! :) 12:36
lizmat weekly: rakuist.io/articles/rakudo-perl-6-...g-fallback
notable6 lizmat, Noted! (weekly)
lizmat daxim: the voting period is not over yet
:-( 12:37
daxim ok
lizmat github.com/perl6/problem-solving/p...-536451971 # a week ago, one week to go 12:39
SmokeMachine m: class Bla { has $.a }; say Bla.^attributes; Bla.^add_attribute: Attribute.new(:package(Bla), :name<$!b>, :type(Int)); say Bla.^attributes # that's possible... 12:42
camelia (Mu $!a)
(Mu $!a Int $!b)
SmokeMachine m: class Bla { has $.a }; say Bla.^attributes; Bla.^add_attribute: Attribute.new(:package(Bla), :name<$!b>, :type(Int)); say Bla.^attributes; say Bla.new: :42a, :13b 12:44
camelia (Mu $!a)
(Mu $!a Int $!b)
Bla.new(a => 42)
SmokeMachine m: class Bla { has $.a }; say Bla.^attributes; Bla.^add_attribute: Attribute.new(:package(Bla), :name<$!b>, :type(Int)); say Bla.^attributes; Bla.^compose; say Bla.new: :42a, :13b
camelia (Mu $!a)
(Mu $!a Int $!b)
Bla.new(a => 42)
SmokeMachine hum... got it...
m: class C { has Int $.a; has Str $.b }; my &n = C.^lookup("new").assuming(C:); say [\(:1a, :b<um>), \(:2a, :b<dois>), \(:3a, :b<tres>)]>>.&n # it would be cool if it would be possible doing something like this... (I don't know with what syntax...) 12:49
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3 }; my &n = C.^lookup("new").assuming(C:7⏏5); say [\(:1a, :b<um>),…
pmurias SmokeMachine: what do we want a gist on js objects to do? 12:50
SmokeMachine pmurias: I think .toString() on that could be good enough, what do you think?
pmurias: or maybe return what console.log would print... (I don't know how) 12:51
pmurias lizmat: the way the migration will be done seems sane, I don't feel qualified to vote if the rename is a good thing tho 13:00
SmokeMachine: .toString() seems better than nothing 13:01
lizmat pmurias: that's ok
wish I was 100% sure, still think it's the best of the bad alternatives
pmurias lizmat: the proposal mentions a raku symlink is that intentional or a mistake? 13:02
lizmat not a mistake 13:03
if you realize that rakudo is an implementation of a language, you realize that the executable should be called "rakudo"
pmurias what I mean is do we want to have a raku symlink pointing to rakudo? 13:06
pmurias `raku` and `perl6` should 13:09
be symlinks
SmokeMachine pmurias: maybe a `"JSObjectWrapper:" + JSON.stringify(obj)`? 13:21
pmurias: `"JavaScriptWrappedObject|" + obj.constructor.name + "|" + JSON.stringify(obj)`? 13:28
pmurias: a WHICH as well?\
lizmat pmurias: indeed 13:32
pmurias lizmat: so raku is the replacement for perl6 and rakudo the executable name if someone want's to distinguish implementations? 13:36
lizmat the idea is that rakudo becomes the name of the executable, and that both "perl6" and "raku" become symlinks 13:37
that can be customized by users should they want to have multiple Perl 6 / Raku implementations around 13:38
this is actually not really about the renaming process at all, just correcting an error made in the past, in my view
pmurias replacing the Rakudo excecutable with anything that's not forked from it will be hard 13:46
SmokeMachine pmurias: I think the idea was use something like this: linux.die.net/man/8/alternatives 13:55
xinming_ SmokeMachine: termbin.com/6k0u2 14:15
SmokeMachine: In this case, Is it possible that we don't pass the "method", but isntead, we pass the -> { } ?
AlexDaniel rakuist.io xDDD
AlexDaniel what a wonderful domain name 14:16
gdonald++
SmokeMachine xinming_: like that? www.irccloud.com/pastebin/VJioCxoP/ 14:18
vrurg AlexDaniel: it sounds... Familiar? :D
lizmat And another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2019/10/07/...syntaxing/ 14:24
sjn yay! 14:25
Xliff lizmat++ 14:27
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my @a = %h.pairs.map( .value *= 2 ); @a.say; %h.pairs.say; 14:28
camelia No such method 'value' for invocant of type 'Any'. Did you mean 'values'?
in block <unit> at <tmp> line 1
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my @a = %h.pairs.map( *.value *= 2 ); @a.say; %h.pairs.say;
camelia [8 4 2]
(c => 8 b => 4 a => 2)
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my @a = [ %h.pairs.map( *.value *= 2 ).flat ]; @a.say; %h.pairs.say; 14:29
camelia [8 4 2]
(c => 8 b => 4 a => 2)
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my @a = ( %h.pairs.map( *.value *= 2 ).flat ); @a.say; %h.pairs.say; 14:30
camelia [2 4 8]
(a => 2 b => 4 c => 8)
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my @a = ( %h.pairs.map({ .value *= 2; .clone }).flat ); @a.say; %h.pairs.say; 14:30
camelia [b => 4 c => 8 a => 2]
(b => 4 c => 8 a => 2)
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my @a = ( %h.pairs.map({ my $o = .clone; $o.value *= 2; $o }).flat ); @a.say; %h.pairs.say; 14:31
camelia [b => 4 a => 2 c => 8]
(b => 2 a => 1 c => 4)
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my %d = %h.clone; %d.gist.say 14:32
camelia {a => 1, b => 2, c => 4}
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my %d = %h.clone; %d<b> *= 2; %d.gist.say 14:33
camelia {a => 1, b => 4, c => 4}
Xliff m: my %h = ( a => 1, b => 2, c => 4 ); my %d = %h.clone; %d<b> *= 2; %d.gist.say; %h.gist.say
camelia {a => 1, b => 4, c => 4}
{a => 1, b => 2, c => 4}
xinming_ SmokeMachine: So, by default, sub will have $_ as default invocant, right? 14:48
SmokeMachine xinming_: a block... 14:49
xinming_ What about the pointy block?
SmokeMachine m: {;}.signature.say; sub {}.signature.say
camelia (;; $_? is raw)
()
SmokeMachine m: {;}.signature.say; sub {}.signature.say; ->{}.signature.say
camelia (;; $_? is raw)
()
()
SmokeMachine xinming_: ^^ 14:50
xinming_ termbin.com/rxw2
SmokeMachine m: {;}.signature.say; sub {}.signature.say; ->{}.signature.say; sub { $^not-self }.signature.say
camelia (;; $_? is raw)
()
()
($not-self)
xinming_ How can we do this?
SmokeMachine xinming_: for that you should use $value.xx... (the -> ($value) {...} is not what you want...) 14:51
SmokeMachine m: -> $value { say $value }.(42); -> ($value) { say $value }.(42) 14:52
camelia 42
Cannot unpack or Capture `42`.
To create a Capture, add parentheses: \(...)
If unpacking in a signature, perhaps you needlessly used parentheses? -> ($x) {} vs. -> $x {}
or missed `:` in signature unpacking? -> &c:(Int) {}
in block <uni…
SmokeMachine m: -> $value { say $value }.(42); -> ($value) { say $value }.([42])
camelia 42
42
SmokeMachine xinming_: ^^
xinming_ Is it possible that I alias the $_ to another variable, But still pass the capture values correctly? 14:54
m: (-> { }).perl.say; ({}).perl.say;
camelia -> { #`(Block|56929680) ... }
{}
xinming_ m: (-> { }).perl.say; ({ ... }).perl.say;
camelia -> { #`(Block|62309488) ... }
-> ;; $_? is raw { #`(Block|63467456) ... }
14:55
SmokeMachine xinming_: why do you want an alias?
xinming_ so pointy block is the same as pointy block with signatures
SmokeMachine: I need to pass additional arg to the callback
well, will pass this with explicit arg 14:58
something like my &.method-cb = -> $self, $value { };
SmokeMachine xinming_: you mean like this? www.irccloud.com/pastebin/ozeQq0cS/ 14:59
SmokeMachine xinming_: what about something like this? www.irccloud.com/pastebin/7WtvemrS/ 15:03
moritz Hi all
I seem to remember that the ebook version of one Andrew Shitov's books is now available for free
can anybody remember which one, and maybe give me a download link? 15:04
ah, perl6.online/using-perl6/ 15:06
SmokeMachine xinming_: ok, now I'm exaggerating... www.irccloud.com/pastebin/0byn472W/ 15:07
xinming_ SmokeMachine: The first one is fine, almost the same as &.method-cb = -> $self, $value { }; 15:32
SmokeMachine: Will choose that anyway.
SmokeMachine pmurias: have you seen my second suggestion? 15:38
pmurias: `"JavaScriptWrappedObject|" + obj.constructor.name + "|" + JSON.stringify(obj)`? 15:39
pmurias any feedback on the rakudo.js report draft: blogs.perl.org/users/pawel_murias/2...ate-1.html
SmokeMachine: there seem to be ports of what console.log does in node.js to the browser 15:41
SmokeMachine: maybe it makes sense to use that?
SmokeMachine pmurias: I do think so! :)
moritz pmurias: in this paragraph: "A couple of tests don't work due to either being impossible in the browser (due to using file system IO) or rakudo itself having a fair amount of bugs that pop up when precompiling code (in usual runs tests aren't precompiled so they go undetected)" 15:42
are these bugs that are also present in rakudo-moar? If yes, adding a half-sentence to clarify this would be helpful 15:43
also, really impressive work! pmurias++ 15:44
pmurias moritz: will clarify, they are present in precompiled modules but not tests or scripts :( 15:45
xinming_ pmurias: Are you maintainer of rakudo.js? 15:47
IIRC, you are the dev, or I remember wrong.
pmurias xinming_: yes 15:48
xinming_: the main author 15:49
xinming_ pmurias: Do you have plan to export perl module to js?
pmurias xinming_: I can add support for that if you want to use that 15:50
xinming_ I think this is useful.
compile perl6 module to js, So, we can use the perl6 in nodejs.
I mean import perl6 in js 15:51
SmokeMachine pmurias: is IO impossible even using the js file api?
xinming_ SmokeMachine: I don't think so.
SmokeMachine www.javascripture.com/File 15:52
Geth_ ¦ problem-solving: Kaiepi assigned to jnthn Issue Perl 6 needs better ways to deal with network addresses github.com/perl6/problem-solving/issues/111 15:53
pmurias SmokeMachine: afair the File wasn't offering a direct access to the file system but allowing to ask the user for permission to read the contents of some files 15:54
SmokeMachine pmurias: I've never used File... and have read about that too long ago... (sorry if not helping...) 15:55
s/if not/if I'm not/
pmurias IO *is* possible to at an extent supported on node.js 15:57
pmurias xinming_: I'll look at exposing Perl 6 modules to node.js once I wrap up the grant 15:59
got to run, will backlog and bbl&
xinming_ Ok, Thanks. That way, We make js <-> perl6
rindolf3 Hi all 16:23
TimToady: hi.
AlexDaniel .seen TimToady 16:24
tellable6 AlexDaniel, I saw TimToady 2019-07-22T20:38:55Z in #perl6-dev: * TimToady had the power company swapping his electric meter, and it broke my / key
uzl[m] moritz: This one perl6.online/perl6-at-a-glance/ ? 16:47
Kaiepi m: my package Foo { constant MIN = 1; constant MAX = 100; }; subset Foo of Int:D where (Foo::MIN..Foo::MAX); say 1 ~~ Foo; 16:49
camelia True
Kaiepi m: my package Foo { constant MIN = 1; constant MAX = 100; }; subset Foo of Int:D where (Foo::MIN..Foo::MAX); say Foo::MIN;
camelia 1
Kaiepi m: my package Foo { constant MIN = 1; constant MAX = 100; }; subset Foo of Int:D where (Foo::MIN..Foo::MAX); say OUR::.kv;
camelia (Foo (Foo))
Kaiepi is it a bad idea to be messing with symbols this heavily?
uzl[m] moritz: I also have the Perl 6 Deep Dive pdf that I got from a coupon that one time 16:50
rindolf3 TimToady: here? 16:56
tony-o does ctilmes idle here? 17:03
Geth_ ecosystem: 90471b8ca3 | tony-o++ (committed using GitHub Web editor) | META.list
refactoring DB::Xoos

so that you don't need to install DBIish & DB::Pg & DB::MySQL & etc.
17:06
AlexDaniel .seen ctilmes 17:10
tellable6 AlexDaniel, I saw ctilmes 2019-07-08T15:29:01Z in #perl6: <ctilmes> rfold, see stackoverflow.com/questions/552093...-collector
AlexDaniel notable6: sorta
notable6 AlexDaniel, No notes for “sorta”
AlexDaniel oops
tony-o: sorta!
tony-o ah, maybe i'll catch him soon 17:11
SmokeMachine pmurias: look how interesting: perl6.github.io/6pad/#9789cd026063...7aaa2d489f 17:17
tellable6 SmokeMachine, I'll pass your message to pmurias
tony-o .tell ctilmes how production ready do you suppose 18:36
tellable6 tony-o, I'll pass your message to ctilmes
tony-o .tell ctilmes DB::MySQL is?
tellable6 tony-o, I'll pass your message to ctilmes
tony-o stupid fat fingers
Geth_ ¦ problem-solving: vrurg assigned to jnthn Issue Role concretization needs big improvements. github.com/perl6/problem-solving/issues/112 19:01
uzl[m] m: given 1, 2 -> $a, $b { say "$a $b" } 19:17
camelia Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
uzl[m] How do I localize several values using given? 19:18
Kaiepi m: given 1, 2 -> ($a, $b) { say "$a $b" }
camelia 1 2
Kaiepi 1, 2 is a list in that context
er, maybe an array
m: say WHAT my $ := 1, 2
camelia (List)
uzl[m] Thanks Kaiepi 19:30
Kaiepi np
bazzaar m: given (1, 2), 3 -> ($a, $b) { say "$b" } 19:31
camelia 3
bazzaar m: given (1, 2), 3 -> ($a, $b) { say $b } 19:31
camelia 3
bazzaar m: given (1, 2), 3 -> ($a, $b) { say $b.^name } 19:32
camelia Int
bazzaar m: given (1, 2), 3 -> ($a, $b) { say "$b.^name" }
camelia 3.^name
Grinnz complete non-stakeholder curiosity but, is there a reason assigning people to github issues gets announced but not the issues being opened? 19:33
hythm m: use Cro::Uri; grammar G { proto token location { * }; token location:sym<uri> { <uri> }; token location:sym<path> { <path> }; token uri { .* { try Cro::Uri.parse: $/ } }; token path { .* } }; say G.parse( 'raku.org', :rule<location> ); say G.parse( '/tmp', :rule<location> ); 19:34
camelia ===SORRY!===
Could not find Cro::Uri at line 1 in:
inst#/home/camelia/.perl6
inst#/home/camelia/rakudo-m-inst-2/share/perl6/site
inst#/home/camelia/rakudo-m-inst-2/share/perl6/vendor
inst#/home/camelia/rakudo-m-inst-2/share/p…
hythm is it possible to do something like the above? basically if Cro::Uri can parse the token then <uri> should match, if not then <path> should match. 19:36
SmokeMachine Is modules.perl6.org giving error for someone else?
bazzaar SmokeMachine: yes, same for me in firefox on linux (Host Error:The web server reported a gateway time-out error) 19:40
rba SmokeMachine: Sorry, trouble-shooting modules.perl6.org right now. Will bring back ASAP. 19:47
SmokeMachine rba: ok, thanks! 19:48
antoniogamiz o/ 19:52
bazzaar m: my $a = 42; say join(':', "$a.^name", $a.^name); # method call has less precedence than double quotes? 19:55
camelia 42.^name:Int
MasterDuke m: my $a = 42; say join(':', "$a.^name()", $a.^name); # yeah, unless you use parens
camelia Int:Int
antoniogamiz mm I have rakudo-pkg 2019.07.1-01 but the perl6 version is 2018.03 19:56
any idea how to update it?
SmokeMachine how do I set Perl 6 SDK for the project on COMMAIDE?
bazzaar MasterDuke: thanks 19:58
MasterDuke np
SmokeMachine: i see a "new" button to the right of the "project sdk" dropdown when i create a new project 20:00
SmokeMachine MasterDuke: thanks! 20:03
Geth_ ecosystem: b1c3156bab | threadless-screw++ (committed using GitHub Web editor) | META.list
Update META.list

Add String::FuzzyIndex to ecosystem See github.com/threadless-screw/String-FuzzyIndex
21:41
Geth_ modules.perl6.org: 18a9b80d6c | (Roman Baumer)++ | lib/ModulesPerl6/DbBuilder/Dist/Source/CPAN.pm
make sure tempdir is in the user home dir and change dist_dir handling to make sure the directory move is working
22:26
Geth_ modules.perl6.org: 77b8804055 | (Roman Baumer)++ | update-modules.perl6.org
fix: Can't load application from file /home/modules.perl6.org/modules.perl6.org/bin/ModulesPerl6.pl: iCCP: known incorrect sRGB profile at /home/modules.perl6.org/modules.perl6.org/bin/../lib/ModulesPerl6/SpriteMaker.pm line 30.
22:48