»ö« 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.
Xliff I am actually surprised at the WSL. It's near perfect compatibility. 00:35
That compatibility drops severely when dealing with GUI apps, though it is usable in most cases.
Windows doesn't want GTK "competing" with them on their own desktop. *snark*
Kaiepi must be better than it was when i tried it a few years ago 01:07
Xliff Ubuntu installs clean, rakudobrew works right out of the box.
Getting zef and modules working is a matter of the right packages. 01:08
Kaiepi ran into a really bizarre bug while writing ipc and thought it was an issue with node.js but nope, it was with wsl 01:09
never write ipc in node.js btw it'll make you want to tear your hair out
especially if it's between programs written in other languages 01:10
timotimo any way to use something like messagepack to make it less terrible? 01:21
Kaiepi timotimo, i think the problem is languages that use libuv vs those that don't 02:01
i was writing ipc between a node program and a go program and the go program would receive messages in full but the node program wouldn't, so i had to buffer it manually in node 02:02
different internal buffer sizes
ugexe was the go program using async like the node program? 02:08
Kaiepi i'm not entirely sure, go's a bit weird 02:14
Kaiepi well 02:15
it was async but the connection itself might not have been
i haven't looked through go's source code very much
guifa2 p6: sub bar($a,$b) { say $b }; sub foo ($a) { &bar.assuming($a) }; foo(1) 2 04:58
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3b foo ($a) { &bar.assuming($a) }; foo(1)7⏏5 2
expecting any of:
infix
infix stopper
statement end
statemen…
Geth doc: antoniogamiz self-assigned Indexing rules github.com/perl6/doc/issues/2575
a8e92ae333 | (JJ Merelo)++ | 10 files
07:24
woolfy The Ballad of Perl - by Stephen Scaffidi : www.facebook.com/groups/perl6/perm...813241464/ 08:05
El_Che hey woolfy 08:22
lizmat weekly: www.facebook.com/groups/perl6/perm...813241464/ 09:55
notable6 lizmat, Noted!
lizmat clickbaits p6weekly.wordpress.com/2019/06/24/...-toolsets/
candr What is the right way to stop an async thread in an infinite loop. The thread was started with `start foo()`. 13:38
jnthn Create a Promise like `my $cancel = Promise.new`, rewrite the infinite loop to `until $cancel { ... }`, and then .keep (or .break if you want an error) the Promise to stop it 13:39
Probably changing it to `start foo($cancel)` to pass the Promise in to the code with the loop 13:40
candr Ah ok. Thanks jnthn! 13:41
antoniogamiz why zef is not found if I'm root? 13:43
timotimo it's probably installed to your user's home 13:44
if not, it's probably only put in your user's $PATH shell environment variable 13:45
tadzik or both :) 13:46
timotimo ohai tadzik 13:48
tadzik hai o/ 13:48
angular compilation times take soo long that I switched windows to check IRC and now I forgot what bug I was trying to fix :| 13:50
timotimo angular, eh? you're working on angular itself? 13:51
tadzik no, just an angular app 13:52
timotimo was it typescript that angular uses? or livescript? or something like that?
candr jnthn: will the $cancel promise .keep when it goes out of scope by any chance? Or do i have to be explicit with the .keep to clean up the thread with the loop?
tadzik it's typescript, yes
timotimo candr: it won't do such a thing by itself, but you can use "will LEAVE" for that purpose 13:53
tadzik it's lovely for what it is, but it's also infuriating how many things it doesn't catch, or how many things obviously can't work because javascript so what did you expect, you fool
candr ok.. I ill look that up
thanks again
kawaii If I have a class with a couple of multi methods, do they both need `is export`'ing to use them in other places? 13:58
Or do classes not need their methods exporting at all?
moritz "is export" doesn't make too much sense on methods 14:00
antoniogamiz use unit class and with that is enough :D 14:01
moritz I think the idea was that it creates a sub as well, but usually you want more control over the signature when you offer sub variants
discord6 <Vendethiel> ohai 14:20
kawaii having some issues when calling my multis www.irccloud.com/pastebin/giLLltSC/ 14:21
`$perspective.submit($message.content);` is how I call the multi
www.irccloud.com/pastebin/SNLchdAF/
but no signatures ever match
discord6 <Vendethiel> Seems like $perspective is a type object? 14:24
kawaii Vendethiel: `my $perspective = Rose::ContentAnalysis::Perspective;` 14:25
discord6 <Vendethiel> .new?
kawaii oh ouch maybe
hmm I think .new might be implied? since I get the same error 14:26
discord6 <Vendethiel> It’s not
<Vendethiel> Does the caller still say :U:?
kawaii `Cannot resolve caller AUTOGEN(Rose::ContentAnalysis::Perspective:D: :message(Str)); ` 14:26
discord6 <Vendethiel> Message need to be pssed by name 14:27
<Vendethiel> Since your signature has Str :$message
kawaii `$perspective.submit(:message($message.content));`
this too, does not work :(
discord6 <Vendethiel> Oh you changed it
<Vendethiel> Add a ! in both signatures for :$message and the other one 14:28
<Vendethiel> Otherwise they’re optional in both
kawaii oh like `:$message!`?
discord6 <Vendethiel> Yeah 14:29
kawaii www.irccloud.com/pastebin/S56D7tFW/
hm, seems the same :(
timotimo what's the reason for AUTOGEN to be mentioned again? 14:30
i forgot when it shows up
maybe it'll help if there's an explicit proto method declaration in that class 14:31
kawaii timotimo: would you be able to elaborate on that please? :) have not used multis before today 14:34
lizmat kawaii: docs.perl6.org/language/functions#...i-dispatch 14:36
kawaii So, I'm passing a variable called $message, so I'm not sure why it's not matching that method immediately
since the @models has a default anyway, and is not mandatory 14:37
kawaii wait maybe $message is not a string, I'd better check 🤔 14:37
timotimo for a start, you can try "proto method blahblah(|) {*}"
kawaii I did a `dd $message.content;` and got back `"hello"` so yeah it's a Str 14:38
timotimo: so the only commonalities between my `submit` multies is the @models param, so `proto submit(MODEL :@models, |) {*}` ? 14:40
timotimo i'd recommend just putting | for now 14:42
kawaii www.irccloud.com/pastebin/RLm7cDE1/ 14:43
hm, no notable difference
kawaii so it doesn't look like I can used named arguments as distinguishing characteristics timotimo? 14:51
it looks like I should be able to from the documentation, but seemingly not working here
timotimo you can, but especially if they are optional, they won't change a match that already works without it 15:02
and all methods have an "accept any named arguments" thing set up by default
kawaii timotimo: so I'm right in thinking `$perspective.submit(:message($message.content));` WILL create a named argument == `:$message`? 15:03
antoniogamiz I think so 15:07
mmm though maybe that creates an alias, I'm not sure 15:08
timotimo it's supposed to
kawaii I tried `$perspective.submit($message => $message.content);` too but nothing 15:10
antoniogamiz it should be without $
message => $message.content
kawaii same issue :( 15:11
it never matches any of the signatures
antoniogamiz mmm send the code pls 15:12
kawaii one moment!
antoniogamiz (sorry if have already sent it, I did not see it=
kawaii antoniogamiz: gist.github.com/kawaii/107493f0328...8f814f91e0 15:13
antoniogamiz mmm what is the purpose of a * in a signature? for instance: sub a(*@blocks){ 15:14
kawaii Ah that was the proto method stuff that timotimo suggested
antoniogamiz kawaii: that is a dude of mine, not related to your code
kawaii: I'm going to take a look at it, one moment 15:15
kawaii ah right :)
antoniogamiz have you checked if $message.content is actually a Str? 15:16
put say $message.content.^mro; before $perspective.submit
kawaii antoniogamiz: `((Str) (Cool) (Any) (Mu))` 15:17
Looks fine
antoniogamiz mmm it should match then, it's weird 15:18
kawaii I even removed the `Str` requirement from the method, still nothing 15:24
antoniogamiz uoh if you change $name to $message it works 15:25
but I suppose that you dont want that solution
kawaii not really, they are different methods because they are going to analyse different data and perform different actions :)
I just thought a multi would be cool 15:26
antoniogamiz it looks like it gets confused if you use them like that :/
kawaii I was under the impression the way I was using them was the exact intended purpose :P 15:28
antoniogamiz maybe it's a bug, try asking in stackoverflow
I have tried to fix it but I dont know what else to do :( 15:29
kawaii maybe one of the wizards like jnthn might know :) 15:36
patx64 Hi everyone, I volunteered to take on porting Unicode::UCD. I realized that uniprop is already built into P6 strings. Is there any point to this module? What value could I add? Should they rather be a built-in instead of a separate module? here's my pastebin: pastebin.com/sXVPiLGp 15:36
lizmat patx64: afaik, the JVM and Javascript backends do not have that functionality... 15:40
so for those backends, it makes sense I think
timotimo i think there's still stuff for other languages that uniprop doesn't cover 15:42
patx64 lizmat: thank you for pointing that out, I am testing on rakudo star and didn't realize the other backends would not have those features. Is it fair to say Str.uni* (uniname, uniprop, and friends) are Rakudo specific?
lizmat the other backends are also Rakudo, you could say they are MoarVM specific atm 15:43
jnthn They're part of the Perl 6 language spec, though
So other backends really should provide them eventually
patx64 timotimo: do you have an example or perhaps github issue # for that? 15:44
jnthn The question is more if there's parts of the UCD we know we *don't* want to have built-in. We've not touched unihan for example, and maybe that's out of scope for the core and thus should be in a module?
timotimo not really, i think it's mostly stuff like "uppercase i must turn into uppercase I with a dot on top if the locale is turkish" stuff? 15:44
patx64 jnthn: that's what I thought too. lizmat: I see, thanks for clarifying 15:45
kawaii antoniogamiz: I phrased it badly but I posted here: stackoverflow.com/questions/567577...-signature 15:46
antoniogamiz kawaii: good! let's see if someone knows what's going on 15:47
kawaii I spent the last hour debugging this so I hope so :( 15:48
antoniogamiz you should add the other definition of submit+
kawaii antoniogamiz: done :) 15:51
kawaii jnthn: I have replied to your comment :) 15:56
jnthn kawaii: I answered :) 16:03
kawaii jnthn: you solved it! I'll mark as correct when SO allows me to 16:04
thank you so much
jnthn Welcome :) 16:05
Geth ¦ problem-solving: AlexDaniel assigned to jnthn Issue Ambiguity in slicing with Ranges / WhateverCodes github.com/perl6/problem-solving/issues/50
kawaii jnthn: I have a follow-up question if you have a few moments please? :) 16:40
jnthn kawaii: Sort of :) 16:41
kawaii It occurs to me that I should probably be passing the entire `$message` object into the `Perspective` class so that if the code determines the message is bad, the extra data contained within the object (such as message ID, and user ID) can be passed over to an `::Actions` class - which would then contain methods to ban, kick a user.
kawaii If I call the submit routine from my script like `$perspective.submit($message);` so that the entire object is passed in, where can I then tell my `submit` method _which part_ of the object is the 'message'? 16:43
(as opposed to only passing in `$message.content` and assigning the value of it to `$message` in the class
Sorry for the poor wording of this, I am still getting used to OOP ways of doing things :) 16:44
Can I do `$perspective.submit($message);` and then `multi method submit(Str :$message.content!,` directly?
is the compiler clever enough to figure this out? 16:45
jnthn No
Doesn't even get past the parser. But!
You can use signatures recursivley to destructure an object
multi method submit((Str :$content, *%)) { }
Note the extra level of parens 16:46
If all your messages inherit a base class or (preferably perhaps) do a role in common, you can do
jnthn multi method submit(Message (Str :$content, *%)) { } 16:46
Where Message is that base type
If you want the whole message as well as the pieces, then you'd do
multi method submit(Message $m (Str :$content, *%)) { }
kawaii ahhhh okay that sounds like it might work, something like `multi method submit(Message (Str :$content!, *%),MODEL :@models = Array[MODEL](SEVERE_TOXICITY))` ? 16:47
jnthn Effectively, the inner signature is bound against object attributes. In fact, it calls .Capture on your object, which by default will produce a Capture with named arguments for every public attribute.
Yes, something like that
Note that you can also override method Capture on any object to control how it will destructure in a signature. I've not seen people use this feature much. :) 16:48
(Maybe 'cus the default is usually good enough)
kawaii There is much testing to be done! Thank you for your help once again! :)
jnthn Welcome, have fun :) 16:49
kawaii jnthn: so this turned out to work really well `multi method submit((Str :$content, *%)`, so here we've passed in `$message`, the entire object and bisected the content out of it, but what did we do with the rest? What if I want to access `$message.author.id` for example? Or did we simply discard the rest upon entry into the method? 16:55
jnthn The *% means "and throw away the rest2 16:56
The *% means "and throw away the rest"
So you could put more things there
kawaii i.e. `$author.id`? I assume I just chop off the `$message.` part
jnthn Well, .author is one level and .id is another 16:57
So you'd need another level of signature to unpack that :)
kawaii Gotcha :)
jnthn (You can nest signatures as deeply as you'd want) 16:58
jmerelo Wow, all this web interface has changed. Not so sure I like it better 17:18
releasable6: status
releasable6 jmerelo, Next release will happen when it's ready. 6 blockers. 262 out of 660 commits logged (⚠ 1 warnings)
jmerelo, Details: gist.github.com/4ac1d8bfdc3f254240...5a64ec67da
doc: 30516acd3c | (JJ Merelo)++ | doc/Type/X/Control.pod6
Clarifies X::Control, refs #2871
synopsebot_ Link: doc.perl6.org/type/X::Control
TreyHarris In POD6 (and more importantly, on docs.perl6.org), does X<> create an invisible anchor I can link to? I want to link to a particular code example in a different section of the same doc. (It's in control.pod6, so I don't think I need to worry about the link getting separated from the target like you might with routines.) I could try it, but building the docs on my tiny machine takes (literally) hours. 18:02
(Or is this for #perl6-dev?)
antoniogamiz an invisible anchor?
TreyHarris antoniogamiz: Yes, as in pre-HTML5 `<a name=foo/>...<a href="#foo">linkback</a>` or HTML5 `<ELEMENT id="#foo">...<a href="#foo">linkback</a>` 18:05
antoniogamiz github.com/perl6/Pod-To-HTML/blob/...ML.pm#L562 18:07
TreyHarris antoniogamiz: thanks! 18:10
Geth ecosystem/PodUtilities: a9d5665612 | Antonio++ (committed using GitHub Web editor) | META.list
Update META.list
18:33
kawaii sena_kun: hm, I seem unable to post the emoji '🙂' in Comma, yet it works fine in my shell, and in Perl 6, any idea why? 20:00
other emojis seem to work fine
lizmat m: say "🙂".uninames 20:01
camelia (SLIGHTLY SMILING FACE)
ugexe m: BEGIN my $self = $*REPO.resolve(CompUnit::DependencySpecification.new(:short-name<Test>)); say $self.distribution; class Test:ver($self.distribution.meta<ver>):auth($self.distribution.meta<auth>) { }; say Test.^ver; 20:03
camelia CompUnit::Repository::Installation::LazyDistribution.new(dist-id => "E14CAA5C7DE5B1A1BAC1ED1155377A9AF4962C18", read-dist => -> $_ { #`(Block|83508328) ... }, meta => ${:api(v0), :auth("perl"), :checksum("A9237DAD0B4486CFFDE585129745545FCEE0D02C"), :s…
ugexe m: BEGIN my $self = $*REPO.resolve(CompUnit::DependencySpecification.new(:short-name<Test>)); class Test:ver($self.distribution.meta<ver>):auth($self.distribution.meta<auth>) { }; say Test.^ver;
camelia v6.d
ugexe someone should automate this
sena_kun kawaii, what do you mean by "unable to post"? I can copy-paste it and it looks like a rectangle(well, the font issue). 20:04
kawaii sena_kun: I mean paste, yes, it doesn't show up at all in my comma, not even a box
weird, oh well I can just use vim to edit this file
sena_kun OS?
not Mac, I hope?
kawaii Ubuntu 20:05
sena_kun hmmm....
m: '🙂'.uninames.say
camelia (SLIGHTLY SMILING FACE)
sena_kun sorry, cannot reproduce
sena_kun I can paste it using both X and normal clipboard 20:07
ugexe what about stand-alone editor vs intellij plugin 20:08
sena_kun I tried it in idea too to check if it might be a platform issue, but the result is the same. 20:09
kawaii weird, oh well! 20:12
sena_kun you can try to avoid emoji: if ascii smiles are too little, use a reaction macro image, if a reaction macro image is too much for the case, use ascii smiles. :p 20:14
kawaii hey this is perl 6 don't try and stop me using emojis in my method names :P 20:15
timotimo 20:16
sena_kun m: sub slightly-smiled-face {}; slightly-smiled-face; 20:17
camelia ( no output )
sena_kun see, it's almost the same!
kawaii I assume DBIish is still the defacto way to do 'database stuff' in P6? How mature is Red now? 20:31
ugexe there is the DB modules as well 20:32
sena_kun DB::Pg is nice, DBIish for sqlite, I'd say. 20:33
kawaii Using PostgreSQL 20:35
sena_kun going with DB::Pg is hard to overestimate if you want it to be certain. if you want to experiment... 20:38
kawaii think I might give DB:Pg a whirl for this project 20:55
Curt's modules are always good :)
xinming Is it possible to make a "Capture" to check a passed hashref is desired? 21:25
xinming hmm, I just realized we may be able to create a nested capture. 21:28
Hmm, I mean signature, What I mean is, I created a function, where it receives config from hash, I need a way to validate the hash, I'm thinking wether use signature is good for this purpose. 21:33
jnthn xinming: Well, using JSON::Schema (which really just takes any hash/array-like data structure) is also a possible way 21:34
But it could be possible with sigs too 21:35
xinming I'm playing with signature stuff
BTW, is it possible to replace the signature for the sub? 21:36
What I mean is, how can signature be programmly used instead of just validating params for subs. 21:37
jnthn It can't.
You can have signature literals separate from subs
And use them for destructuring 21:38
In principle you can have a signature literal stashed in a variable and use that in a `where` clause, which I guess would let you "change the signature"
But you can't change the "real" signature, since it's actually compiled into bytecode of the sub in most cases 21:39
xinming Thanks for the explanation. 21:45
how do we validate the "nested" hash with signautre. :-) 21:46
jnthn m: my %h = a => { b => 42 }; say %h ~~ :(:a((:$b where 42))) 21:53
camelia True
jnthn m: my %h = a => { b => 42 }; say %h ~~ :(:a((:$b where 41)))
camelia False
jnthn xinming: ^^
xinming Thanks, I thought about nested signatured, But I never succeed 21:56
kawaii I don't suppose any perl 6 regex wizards are online at this time? :) 23:01
jnthn kawaii: I wrote chunks of the regex compiler, though I'm not sure if that makes me a wizard or just crazy :P 23:06
kawaii jnthn: little bit of both maybe? :) I have an array of @badwords, and then a $content variable which is submitted to a not-so-clever AI, it does not always detect use of profanity if the words are joined. So if I have `my @badwords = 'fizz', 'buzz';` and `my $message = "this is a fizzbuzz";` how I can use `split()` to add a space between around each detected `badword` if it doesn't alreay have one? 23:09
hope that made sense :)
kawaii i.e. we mutate the $content variable into "this is a fizz buzz" so it can be resubmitted to the AI for anaysis 23:09
jnthn I think subst is maybe more suitable than split... 23:10
Maybe something like $message.subst(/(@badwords)(@badwords)/, { "$0 $1" }, :g) 23:11
kawaii oooo okay so the badwords array is my matcher
that makes sense
I'll give that a shot
kawaii hm, no dice 23:14
jnthn m: my @bad = 'water', 'melon'; say "I eated a watermelon".subst(/(@bad)(@bad)/, { "$0 $1" }, :g) 23:17
camelia I eated a water melon
jnthn Hm, it works in that small case
I should add this may not be fast at all...
jnthn m: my @bad = 'water', 'melon'; say "I eated a melonwater".subst(/(@bad)(@bad)/, { "$0 $1" }, :g) 23:18
camelia I eated a melon water
kawaii jnthn: ah right I see, in your case two bad words exist next to one another, but the word `tastymelon` would not be bisected 23:20
sorry if I was not clear enough in my example 23:21
jnthn Oh! 23:22
jnthn This is totally heading for a buttbuttin listening to clbuttic music, isn't it... :P 23:23
kawaii :P 23:25
jnthn m: my @bad = 'water', 'melon'; say "I eated a tastymelon waterbeer".subst(/$<a>=\w$<b>=@bad | $<a>=@bad$<b>=\w /, { "$<a> $<b>" }, :g) # maybe this
camelia I eated a tasty melon water beer
kawaii jnthn: hey that works perfectly, thank you :) 23:30
jnthn Nice :) 23:35
Meanwhile, I've almost got most of the missing bits of Cro::WebApp::Template implemented, so can release that properly soon :)
discord6 <Vendethiel> \o/ 23:37