»ö« 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.
guifa just found out that .assuming is really costly 00:32
I tried to do a simple BF optimization consolidating ++++ into an &increment.assuming(4), and it's actually slower than calling an equivalent incrementByOne() four times over 00:33
Sierpinski triangle took 8x longer to run, even though it ran 25% less operations (and there's no extra code other than adding 2 or 3 or 4 instead of 1 several times over). Is it that $a++ is that much faster than $a += 1 ? 00:42
MasterDuke guifa: have you compared profiles? 00:45
zachk i know most processros have an increment by 1 and decrement by 1 op codes in the cpu, so it could be much faster if the perl6 vm optimizes for it
timotimo how often do you actually call the .assuming method? 00:47
guifa timotimo: it's called during a compile phase, the slow down is in the execution phase (where it just does a .() for @ops). I haven't tried profiling yet, kinda forgot about that ^_^ (just been calculating time in code) let's see what it says 00:50
(where @ops is a list of &increment, &output, etc) 00:51
guifa Egads, I may need to go grab dinner while the browsers load these profiles 01:02
MasterDuke guifa: if they're too big, you may want to try creating SQL profiles and using timotimo++'s new profiler frontend 01:04
zachk is zef kinda slow?
MasterDuke zachk: it can be, especially some of the json parsing i believe 01:05
zachk is it written in perl6 and using perl6 grammer rules for the json?
MasterDuke it is written in perl6. i think it uses JSON::Tiny (and there has been some talk of switching to JSON::Fast) 01:06
but ugexe is the person to ask 01:07
zachk yea it's just sitting there after it said it was looking for Digest 01:08
guifa MasterDuke: timotimo++'s profiler is the MoarPerf yeah? 01:14
MasterDuke yep
Xliff m: gist.github.com/Xliff/d139f0e12f69...056eb401af 02:13
camelia 「aaaaab」
Rules: TOP,a,b
(Any)
Xliff OK, why is the grammar not matching. I bet it's something simple, isn't it?
I think it might be time for me to go to bed.
lucs Xliff: What are you expecting $r.gist to show? 02:36
Xliff lucs: Those lines got blotted out by Markdown formatting. 02:48
I think I figured out most of it, though. Thanks!
I am headed to bed.
o7
lucs Ok. Just note that the whole string needs to conform to TOP, not just part of it like when using ~~. 02:49
lookatme_q m: gist.github.com/araraloren/0d567e3...78b5c2b921 02:57
camelia 「aaaaab」
Rules: TOP,a,b
(Any)
lookatme_q m: gist.githubusercontent.com/araralo...f/gisty.md
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3https:7⏏5//gist.githubusercontent.com/araraloren/
expecting any of:
colon pair
lookatme_q evalable6 gist.githubusercontent.com/araralo...f/gisty.md
AlexDaniel lookatme_q: missed : after nickname 02:59
also you can use e:
lookatme_q evalable6: gist.githubusercontent.com/araralo...f/gisty.md
evalable6 lookatme_q, Successfully fetched the code from the provided URL
「aaaaab」
Rules: TOP,a,b
(Any)
lookatme_q oh, same result :) AlexDaniel thanks 03:00
holyghost .seen Zoffix 03:23
yoleaux I saw Zoffix 6 Jan 2019 17:41Z in #perl6: <Zoffix> moritz: the project's direction and management style doesn't match my goals and I'll be happier elsewhere.
rjbs Huh! 03:30
simple why does perl6's regexp have to be just different enough in every single way =/ 04:00
lookatme_q simple, you can use Perl5 regex 04:01
simple i know, but i feel guilty doing it that way
it's like... taking your ancient video card out of the old computer, and putting it in the new one 04:02
theoretically, the new one should be better...
lookatme_q simple,I think that's fine 04:03
m: say "aa" ~~ m:P5/(\w)\1/
camelia 「aa」
0 => 「a」
simple i just want $0 to be a string, not some weird MATCH object 04:04
lookatme_q oh, noway to do that 04:05
simple, but that's Perl 6 , they are different language :)
simple yeah 04:06
i get that
lookatme_q have a break, bye :) 04:06
simple so i have $name = $1, then i do a j2p($name) which does some ~~ s/things/here/, and it errors out, saying it's a readonly variable
even when i do j2p($name.Str) it says it is readonly 04:07
lookatme_q you have to mark the argument as `is copy` or `is rw` 04:08
maybe
simple hm
holyghost simple : has x is rw; 04:11
simple this is not an object, or in a class 04:12
lucs m: sub foo ($s) { $s ~~ s/b/B/ }; print foo('abc') 04:14
camelia Cannot assign to a readonly variable or a value
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
lucs m: sub foo ($s is copy) { $s ~~ s/b/B/ }; print foo('abc')
camelia b
holyghost my $name is rw
AlexDaniel also ~$0 will give you a Str, so hardly the end of the world :)
m: sub foo($s) { say S/b/B/ given $s }; print foo(‘abc’) 04:16
camelia aBc
True
lucs Better, thanks :)
AlexDaniel m: sub foo($s) { S/b/B/ given $s }; say foo(‘abc’)
camelia aBc
AlexDaniel m: sub foo($s) { $s.subst: 'b', 'B' }; say foo(‘abc’) 04:17
camelia aBc
simple adding "is copy" worked for me
ooh, .subst
AlexDaniel S/// should also work, just not with ~~ 04:18
(big S)
simple i've never seen big S before
AlexDaniel TR is also a thing, btw :)
simple m: my $mod = '<stuff>'; say $mod.subst(/\</, '_'); 04:24
camelia _stuff>
simple m: my $mod = '<stuff>'; say $mod.subst(/\</, '_', :g);
camelia _stuff>
simple wtf doesn't that work in my sub 04:25
m: my $mod = '<stuff>'; $mod.subst(/\</, '_', :g); say $mod 04:26
camelia <stuff>
simple aha
it doesn't do it in-place like the docs say
oh, different syntax
.= not just . 04:27
that looks goofy as hell heh
m: my $mod = '<stuff>'; $mod.=subst(/\</, '_', :g); say $mod
camelia _stuff>
SmokeMachine for the first time, bernalang (that is written in perl6) can compile binary! 04:30
AlexDaniel simple: .= is just a shortcut for $foo = $foo.bar()
SmokeMachine usercontent.irccloud-cdn.com/file/...653995.jpg
AlexDaniel much like you can do $foo += $bar instead of $foo = $foo + $bar 04:31
simple thanks
SmokeMachine \o/ 04:32
simple bedtime, i'll hack at this some more tomorrow
guifa So after dinner I just ran a test and wow, assuming is excruciatingly slow. 04:38
tio.run/##lY9BC4JAEIXP7q94iIgmRV46...RMk/E8Yhhc
AlexDaniel guifa: please file a ticket, chances are there are ways to speed it up 04:41
SmokeMachine Xliff: ^^ 04:45
guifa AlexDaniel: submitted 04:59
Also, question on module naming. I would have thought it best to avoid overlapping names but on modules.perl6.org there are definitely several with the same. Is there a recommendation ATM for that? 05:04
AlexDaniel guifa: example? 05:06
most of them are just hosted in multiple places at the same time, so they show up more than once
(cpan + github)
I think avoiding name clashes is best
SmokeMachine Is there any recommend way to test nativecall methods! 05:12
guifa AlexDaniel: I've been working on a BF compiler/interpreter. The current one is Inline::Brainfuck and that seems to be the naming convention used for other languages 05:33
There were two that are Inline::Perl5 for instance
I'm just trying to think how I should best name mine as I'm getting closer to finishing off everything 05:34
guifa With JSON there's a clear distinction between JSON::Tiny and JSON::Fast, so I was thinking maybe Inline::Brainfuck::Open or ::Extensible because of the extra options, but then that would make it be more sense for the other one to be Inline::Brainfuck::Fast or similar 05:51
moritz simple: do answer your "why" question: because p5 regexes weren't extensible enough to extend them and be backwards compatible 06:14
guifa smokemachine: parabéns pelo compilador! 06:18
holyghost hi JJ, I have a cache and imaging system ripped from PaganSound2 into PaganVideo2, the client reads frames now, I am also building FFmpegx, as a perl6 package 06:39
I just need the transcoder of MP4 or MPEG and I have a video server for e.g. phone apps 06:40
It's a dumb client 06:41
I also have a simple widget kit for display based on SDL2::Raw 06:42
PaganSound2 is the wave editor I mentioned
jmerelo Sorry, don't work (or for that matter, know anything) about sound processing 06:56
holyghost right 07:04
Geth doc: 6c1ec11daa | (JJ Merelo)++ | doc/Language/variables.pod6
Adds variable (rakudo-specific). Refs #2547
07:29
doc: ea91e36849 | (JJ Merelo)++ | doc/Language/variables.pod6
Eliminates $?ENC

Str.encode does not seem to have ever used it, even going back in history 7 years:
  github.com/rakudo/rakudo/blame/845...ore/Str.pm
I haven't checked the other mentioned, but it does not seem to be either in Rakudo or roast now. Refs #2547
synopsebot Link: doc.perl6.org/language/variables
doc: 594645eb6f | (JJ Merelo)++ | doc/Language/variables.pod6
Eliminates $?GRAMMAR

Which does not seem to be either in rakudo or roast or, for that matter, work. Closes #2547
jmerelo The Perl foundation is asking for feedback on jnthn grant extension news.perlfoundation.org/2019/01/gra...l-6-3.html 07:39
holyghost I have remade it from dumb client to dumb server 07:49
moritz dumb everything! :) 08:20
masak is that... an observation, or a command? 08:30
moritz dump everything? :D 08:32
timotimo m: say Whatever.DUMP
camelia Whatever
timotimo m: say (^Inf).DUMP 08:33
camelia Range<1>(
:min(0),
:max(Inf),
:$!excludes-min(0),
:$!excludes-max(1),
:$!infinite(=Int<5>),
:$!is-int(=Int<4>)
)
masak m: say Any.DUMP
camelia Any
masak I had missed that we now have .DUMP, too
timotimo it's very old :) 08:34
moritz m: class Everything is Any { }; say Everything.DUMP 08:35
camelia Everything
jmerelo masak: since when? 08:37
not in the docs 08:38
Why nobody ever tells me these things?
masak jmerelo: maybe we need to formalize a role/responsibility of telling you these things :P 08:39
I see pmichaud added a &DUMP back in 2011
so yes, ancient
jmerelo Instead of a horse whispererer, we need a doccer-teller of stuff that should or should not be there 08:40
I just discovered today there were 2 variables documented that had disappeared circa 2012
masak spooky.
jmerelo DUMP looks rakudo specific 08:41
But still.
timotimo i.imgur.com/R5wgPDQ.png - if anybody is wondering why &foo.assuming(4)() is so slow ...
masak timotimo: I wasn't, but wow 08:42
timotimo the spike on the left is the compiler creating the primed functions 08:44
jmerelo BTW, maybe take a look at this issue: github.com/perl6/doc/issues/2542 and comment. I would be interested on your feedback.
timotimo so what's the deal with author tests here? 08:49
it seems to be running tests in parallel, and output is tripping over itself 08:50
jmerelo timotimo: here where?
timotimo travis ci of the docs repo 08:51
but i'm glad to see that's already split out 08:54
jmerelo timotimo: you mean this error: github.com/perl6/doc/issues/1951 08:55
timotimo right
jmerelo timotimo: any idea of what might be happening? 08:56
timotimo no clue :\
jmerelo timotimo: I'm not sure it's a race condition.
timotimo: it's also showing up in sequential tests. 08:57
timotimo: the thing with Rakudo issues, 3 are created every day, while 1 is solved every 3 days. 08:58
m: print "del\b\b\b"; say "del\b\b\b"; put "del\b\b\b" 09:07
camelia deldel
del
jmerelo ^^^That does not work the same in "the wild" 09:09
timotimo well, without a terminal emulator, it won't be doing the same thing
how do you suggest camelia handle cursor movement in general?
jmerelo timotimo: not the thing 09:11
timotimo: the thing is that I just discovered that between print, say and put only print actually handles some escape codes like ºb
sorry \b
timotimo when i pipe the output through xxd, i do see 0x61 0x08 for all three, and an extra 0a for say and put 09:13
echo behaves the same way fwiw 09:14
echo "a"\b gives me "nothing"
er
gives me "a"
and echo -n "a"\b gives me "nothing
"
jmerelo perl6 -e 'print "del\b\b"' will effectively delete; same with put and say
timotimo echo -n "del"\b\b gives me "d" and echo "del"\b\b gives me "del" 09:16
so yeah, if you want to fix this i guess travel back in time to 1850 and talk to the original virtual terminal inventors? 09:17
jmerelo timotimo: not my point 09:18
timotimo: (and actually, I was wrong above)
Just test that thing above in a terminal, and then change to put or say.
That script above will print "d", say and put will output "del" 09:19
timotimo yeah
i know
timotimo what is your point, then? 09:19
jmerelo timotimo: just asked in StackOverflow...
timotimo: it's not documented...
timotimo i'm not sure that's in scope for perl6 documentation
jmerelo timotimo: ? 09:20
timotimo what would you have it say?
jmerelo stackoverflow.com/questions/541253...characters
timotimo: something like "print will apply escape characters, while say and put will not"
timotimo that's not true, though
jmerelo timotimo: right. I'm checking the other escape characters. Seems to happen only to \b 09:21
timotimo the difference between say/put and print really is only that they append a \n
jmerelo so, "print will apply \b, while the others will not" 09:22
timotimo all of them turn \b into the corresponding ascii thing
the difference is only in what the terminal does with it 09:23
you want some extra fun?
put a space after the \b\b
jmerelo timotimo: OK. I see it works now for all of them _if it's not at the end of the string 09:23
timotimo you're misinterpreting your observations
jmerelo timotimo: please explain 09:24
timotimo the difference is not something perl6 does 09:25
it literally outputs exactly what the docs claim it does
jmerelo timotimo: so you are saying that whitespace cancels \b somehow
timotimo it's about cursor movement in the terminal 09:26
for some reason, closing the program clips everything to the right of the cursor maybe?
so when you put a newline before the program ends, there's nothing in that line that could be cleared, it's already an empty line
did you try "del\b\b "? 09:27
jmerelo timotimo: right. That works.
timotimo can you explain the result based on your understanding?
jmerelo timotimo: you are professoring a professor. That's a dangerous thing. 09:29
timotimo negotiable :) 09:29
jmerelo timotimo: but I would say that what it's doing it's first printing all the string to the terminal, and then going in a second step and applying whatever they mean 09:30
timotimo what does "it" mean here? 09:31
jmerelo timotimo: OK, there are two its.
El_Che but who is professoring the professoringer?
jmerelo The program is outputing everything to the terminal. Then the terminal takes the codes and say: OK, here's the thing, I have two \b\b, but I'm already in the next line, so let's drop that 09:32
timotimo it isn't in the next line yet, though, when it sees the \b
jmerelo timotimo: then what's the deal?
timotimo do we get the same output from outputting "del\b\b "? with say vs with print? 09:33
jmerelo timotimo: yep, we do.
timotimo "d l" or "d ", right?
jmerelo yep, kinda 09:34
timotimo "d l" in the case with \n, "d " in the case without \n
what does "kinda" mean? :) 09:35
jmerelo timotimo: OK, I see your point.
it's moving the cursor back two positions, _in the same line_ 09:36
not in the string
timotimo "the string" is an abstraction that no longer exists at that point
jmerelo I thought "backspace" was exactly the same as "delete". It's not. 09:37
It's, literally, back the space of a single character.
timotimo right
similar to the distinction between \n and \r
at least on windows, that is
jmerelo timotimo++ 09:38
jmerelo stands professored.
timotimo haha 09:39
you gave me a lot of wrong to work with, but it's totally understandable
i mean it's not surprising that you'd not immediately get what's going on
jmerelo timotimo: you could also answer in StackOverflow :-) 09:42
timotimo actually i might go rest a little because my sleep ended much too early today compared to when it started and i think i can't feel my brain %) 09:44
jmerelo timotimo: it's got to be there. Where was it last time you checked? 09:46
timotimo: :-) thanks again.
m: say "الخط العربي"
camelia الخط العربي
SmokeMachine .tell guifa thanks! 12:35
yoleaux SmokeMachine: I'll pass your message to guifa.
SmokeMachine Os there any good practice on writing tests to NativeCall modules? 12:42
lizmat writing tests for the functionality itself ? regardless of whether NativeCall is used underneath ? 12:43
SmokeMachine lizmat: I mean: the lib the module is using is alread tested... so, I’d like to test if the wrapper is working, and not test the lib again... 12:46
lizmat hmmm... not sure how one would do that 12:47
wouldn't that be testing if NativeCall works ?
SmokeMachine lizmat: kind of... but yes, I’d like to not retest the lib nor NativeCall... 12:49
lizmat: I men, for example here: github.com/FCO/GccJit/blob/master/...GccJit.pm6 theres a lot here that need to be tested but isn’t the lib’s functionality neither NativeCall’s 12:51
AlexDaniel .tell guifa “There were two that are Inline::Perl5 for instance” – it's the same module 12:52
yoleaux AlexDaniel: I'll pass your message to guifa.
lucasb AlexDaniel: seems like I was banned from zofbot. is it still possible to use the bots there? 12:57
AlexDaniel lucasb: go to #whateverable instead 12:58
lucasb ah, thanks. I wasn't aware
daxim class Foo {}; class Bar {}; class Quux { has Array[Foo|Bar] $.attr; }; Quux.new(attr => [Bar.new, Foo.new]); 14:02
m: class Foo {}; class Bar {}; class Quux { has Array[Foo|Bar] $.attr; }; Quux.new(attr => [Bar.new, Foo.new]);
camelia 5===SORRY!5=== Error while compiling <tmp>
An exception occurred while parameterizing Array
at <tmp>:1
Exception details:
5===SORRY!5=== Error while compiling <tmp>
Can not parameterize Array with any(Foo, Bar)
at <tmp>:1
lizmat daxim: you cannot currently parameterize with a Junction 14:06
daxim what's the workaround?
jnthn If you have the possibility, create a role and make both types do the role. Otherwise, probably a subset type is the best bet 14:07
lizmat m: my subset A where $_ ~~ Int || $_ ~~ Str; my A $a = 0e0
camelia Type check failed in assignment to $a; expected A but got Num (0e0)
in block <unit> at <tmp> line 1
lizmat m: my subset A where $_ ~~ Int || $_ ~~ Str; my A $a = 42
camelia ( no output )
lizmat m: my subset A where $_ ~~ Int || $_ ~~ Str; my A $a = "foo"
camelia ( no output )
jnthn m: my subset A where Int | Str; my A $a = "foo"; 14:08
camelia ( no output )
jnthn m: my subset A where Int | Str; my A $a = 0e0;
camelia Type check failed in assignment to $a; expected A but got Num (0e0)
in block <unit> at <tmp> line 1
jnthn Can even write it like that :)
lizmat ah, cool
jnthn Though if you own all the types involved, I'd still suggest a role is better design.
daxim like this? 14:11
m: role Foobar {}; class Foo does Foobar {}; class Bar does Foobar {}; class Quux { has Array[Foobar] $.attr; }; Quux.new(attr => [Bar.new, Foo.new]);
camelia Type check failed in assignment to $!attr; expected Array[Foobar] but got Array ($[Bar.new, Foo.new])
in block <unit> at <tmp> line 1
jnthn More like `has Foobar @.attr` 14:12
That way you get it to assign (copy from) the input array rather than binding it. With a Scalar you'd need to make sure the incoming array is correctly typed already since that will really be stored there directly. 14:13
daxim I didn't know it's binding!
jnthn Well, "binding" is not quite true 14:14
What's really happening is that you're assigning the array into the Scalar typed Array[Foobar]
So it asks the array "are you an Array[Foobar]?" and if it wasn't declared as such, it fails
m: my @a = 1,2,3; my $b = @a; my @c = @a; @a[1] = 5; dd $b; dd @c; 14:15
camelia Array $b = $[1, 5, 3]
Array @c = [1, 2, 3]
simple moritz: ok
jnthn m: my @a = 1,2,3; my Array[Int] $b = @a;
camelia Type check failed in assignment to $b; expected Array[Int] but got Array ($[1, 2, 3])
in block <unit> at <tmp> line 1
jnthn m: my @a = 1,2,3; my Int @b = @a;
camelia ( no output )
jnthn Second one works because array assignment means "iterate the thing we're assigning and store each value" 14:16
daxim I think I understand it, and I do want the @ sigil attributes, then 14:18
I feel a bit overwhelmed, I hope this distinction becomes easier to make for me with practice 14:19
lizmat daxim++ 14:21
simple can someone help me translate perl5 to per6 regex? my @params = ($line =~ /[a-z](\d+)/g); # gives an array of 0,1,2,3 for string 'a0 b1 c3 z3' 14:38
there will be other text in the line as well, not just [a-z]\d pairs
simple m:g/[a-z\(\d+)/ sure doesn't work like that 14:39
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/sPoixm85SX
Missing…
simple, Full output: gist.github.com/1b1a28152e3f18baba...4da7fdb4b0
AlexDaniel hah
stupid bot :)
simple yeah
sena_kun m: say 'a0 b1 c3 z3' ~~ m:g/<[a..z]>(\d+)/
camelia (「a0」
0 => 「0」 「b1」
0 => 「1」 「c3」
0 => 「3」 「z3」
0 => 「3」)
simple typo: m:g/[a-z](\d+)/ sure doesn't work like that
sena_kun m: .Str.say for ('a0 b1 c3 z3' ~~ m:g/<[a..z]>(\d+)/); 14:42
camelia a0
b1
c3
z3
sena_kun m: .Str.say for ('ehehe a0 b1 ehehe c3 z3 ehehe' ~~ m:g/<[a..z]>(\d+)/);
camelia a0
b1
c3
z3
simple m: .Str.say 'ehehe a0 b1 ehehe c3 z3 ehehe'.match(/<[a-z]>(\d+)/) 14:44
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3.Str.say7⏏5 'ehehe a0 b1 ehehe c3 z3 ehehe'.match(/
expecting any of:
infix
infix stopper
statement end
sta…
simple m: .Str.say "ehehe a0 b1 ehehe c3 z3 ehehe".match(/<[a-z]>(\d+)/) 14:45
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3.Str.say7⏏5 "ehehe a0 b1 ehehe c3 z3 ehehe".match(/
expecting any of:
infix
infix stopper
statement end
sta…
tobs m: .Str.say for ('ehehe a0 b1 ehehe c3 z3 ehehe' ~~ m:g/ <[a..z]> <(\d+)> /)
camelia 0
1
3
3
sena_kun m: .Str.say for 'ehehe a0 b1 ehehe c3 z3 ehehe'.match(/<[a..z]>(\d+)/, :g)
camelia a0
b1
c3
z3
tobs you can use <( ... )> to enclose which part of the match you want to be in $0 14:46
simple m: .Str.say "ehehe a0 b1 ehehe c3 z3 ehehe".match(/<[a-z]><(\d+)>/, :global)
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3.Str.say7⏏5 "ehehe a0 b1 ehehe c3 z3 ehehe".match(/
expecting any of:
infix
infix stopper
statement end
sta…
simple m: .Str.say ("ehehe a0 b1 ehehe c3 z3 ehehe".match(/<[a-z]><(\d+)>/, :global))
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3.Str.say7⏏5 ("ehehe a0 b1 ehehe c3 z3 ehehe".match(
expecting any of:
infix
infix stopper
statement end
sta…
simple so alien, heh
m: .Str.say for ('ehehe a0 b1 ehehe c3 z3 ehehe' ~~ m:g/ <[a..z]> <(\d+)> /) 14:47
camelia 0
1
3
3
simple that's what i want though
the way it handles whitespace really messes me up
Kaiepi i have a websocket connection and i want to write some code where i alternate between sending a message upon receiving a certain type of message, which is the response to the message sent 14:48
simple thank you tobs
Kaiepi how do i do it?
simple tobs++ 14:49
Kaiepi i feel like there's some way to do it with supplies but i'm not sure how
Kaiepi what i want to do is 15:02
- send a message
- wait for a response
- send another message
sena_kun 1)whenever $responses -> { send-message() }; 2)send-message(); 15:05
no?
jnthn Yes, and you can probably even put them in the other order for clarity 15:06
Kaiepi i can't write it like that the way i have it written 15:09
masak then the way you have it written isn't that good, is it? :P 15:10
Kaiepi wait yes i can
i store a list of messages to send and in the react block i send a message upon receiving the right kind of message 15:11
b2gills simple: 'a0 b1 c2 z3'.comb(/ <[a..z]> <( \d+ /) # use comb, and no need to use both `<(` and `)>` 15:39
m: say 'a0 b1 c2 z3'.comb(/ <[a..z]> <( \d+ /).perl
camelia ("0", "1", "2", "3").Seq
simple another routine i've never seen 15:40
b2gills comb can take a regex, a number or nothing
m: 'abcd'.comb(2).perl.say
camelia ("ab", "cd").Seq
b2gills m: 'abcd'.comb(/ b | c /).perl.say
camelia ("b", "c").Seq
b2gills m: 'abcd'.comb().perl.say 15:41
camelia ("a", "b", "c", "d").Seq
daxim m: subset Foo of Str where .chars > 0; subset Foo-SetHash of SetHash where $_ ~~ Foo; my Foo-SetHash $f; $f.elems.say; # expect 0 15:42
camelia Invocant of method 'elems' must be an object instance of type 'Setty', not a type object of type 'Foo-SetHash'. Did you forget a '.new'?
in block <unit> at <tmp> line 1
daxim m: subset Foo of Str where .chars > 0; subset Foo-SetHash of SetHash where $_ ~~ Foo; my $f = Foo-SetHash.new; $f.elems.say;
camelia You cannot create an instance of this type (Foo-SetHash)
in block <unit> at <tmp> line 1
lizmat daxim: what are you trying to achieve ? 15:43
daxim I can show the moose code, hold on 15:44
daxim paste.scsys.co.uk/582727 15:51
that editing took much longer than I expected 15:52
vrurg daxim: I don't have much time to get into, but in Foo-SetHash your $_ matches against a SetHash object, not its keys or values. 15:56
vrurg I think, to achieve what you want you'd need to inherit from SetHash and validate storing values. 15:58
lizmat daxim: so if I understand correctly, you want a Set but limit its keys to a certain type ? 16:17
daxim yes 16:18
lizmat you cannot currrently do that easily, looking into if it could be added easily 16:19
MasterDuke yes, is there some reason why SetHash can't be paramterized? 16:20
lizmat well, or Set for that matter :-)
MasterDuke m: subset Foo of Str where .chars > 0; my SetHash of Foo %f; %f.elems.say;
camelia 5===SORRY!5=== Error while compiling <tmp>
SetHash cannot be parameterized
at <tmp>:1
------> 3 Str where .chars > 0; my SetHash of Foo7⏏5 %f; %f.elems.say;
lizmat I think the reason for it is really that at the time I worked on that, either paramerization wasn't done that easily and/or not understood by me 16:21
lizmat daxim: looks like it's going to need quite a significant overhaul to prevent normal operation from suffering 16:35
could you please make a ticket for it, though?
daxim I don't know what to write :-S
lizmat "Quanthashes should be parameterizable" and link to this discussion in the chat log 16:39
Geth doc: f9481e1248 | cfa++ | doc/Language/variables.pod6
Remove index entries for $?GRAMMAR and $?ENC.

  (See ea91e368 and 594645eb for content removal.)
16:59
synopsebot Link: doc.perl6.org/language/variables
Xliff \o/ 18:25
Xliff can now style individual areas of text in a GtkTextView.
sena_kun Xliff++ 18:32
Xliff sena_kun: :) 18:34
For the curious, that's now pushed to p6-GtkPlus
No example, yet. I'm currently working on it. :/ 18:35
Geth doc: 2424e6273d | cfa++ | 2 files
Document &*ARGS-TO-CAPTURE, &*GENERATE-USAGE on the variables page.

Move documentation from Language/create-cli.pod6; cross reference. This also fixes broken links to:
  - /language/&*ARGS-TO-CAPTURE
  - /language/&*GENERATE-USAGE
18:41
cfa 👋🏽 19:21
TreyHarris Can I create a control-flow construct with syntactic sugar? Like, if I wanted `wenn $x == 1 { ... } sonst { ... }` to be my own if/else? I see how to do it with extraneous commas and brackets 19:44
jmerelo TreyHarris: combining term and grammars, you probably can.
TreyHarris: Or just grammars. 19:45
TreyHarris jmerelo: those aren't fully supported yet in Rakudo, though, are they?
sena_kun TreyHarris, technically, you can create a slang.
Xliff Is there a reason Arrays don't have an avg or mean method?
jmerelo TreyHarris: Grammars? As supported as it gets... 19:46
Xliff m: use MONKEY-SEE-NO-AUGMENT; augment List { method avg { self.sum / self.elems } }; (^6).avg.say
camelia ===SORRY!===
Could not find MONKEY-SEE-NO-AUGMENT at line 1 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakudo-m-inst-2/share/perl6
TreyHarris jmerelo: I was thinking slangs
jmerelo Xliff: Arrays can hold somethign else than numbers...
sena_kun Xliff, isn't it takes elements to be Numeric?
jmerelo TreyHarris: but the way to define a slang is to create Grammar + actions... 19:47
sena_kun or be coerce-able to something that can be.
Xliff sena_kun: If it's an array of Cools, that's easy enough to check for, but I get the point.
m: sub avg($a) { $a.sum / $a.elems }; my @a = (^6); @a."&sum".say 19:48
camelia 5===SORRY!5=== Error while compiling <tmp>
Quoted method name requires parenthesized arguments. If you meant to concatenate two strings, use '~'.
at <tmp>:1
------> 3um / $a.elems }; my @a = (^6); @a."&sum"7⏏5.say
Xliff m: sub avg($a) { $a.sum / $a.elems }; my @a = (^6); @a."&sum"().say
camelia No such method '&sum' for invocant of type 'Array'. Did you mean any of these?
Num
sum

in block <unit> at <tmp> line 1
Xliff m: sub avg($a) { $a.sum / $a.elems }; my @a = (^6); @a."&avg"().say 19:49
camelia No such method '&avg' for invocant of type 'Array'. Did you mean 'Bag'?
in block <unit> at <tmp> line 1
Xliff m: method avg($a) { $a.sum / $a.elems }; my @a = (^6); @a."&avg"().say
camelia Potential difficulties:
Useless declaration of a has-scoped method in mainline (did you mean 'my method avg'?)
at <tmp>:1
------> 3method7⏏5 avg($a) { $a.sum / $a.elems }; my @a =
No such method '&avg' for invocant of type '…
Xliff m: my method avg($a) { $a.sum / $a.elems }; my @a = (^6); @a."&avg"().say
camelia No such method '&avg' for invocant of type 'Array'. Did you mean 'Bag'?
in block <unit> at <tmp> line 1
TreyHarris Or term macros? Hrm, I haven't asked this question in several years (though it was post-rakudo, pre-Christmas), but then the answer was "not yet". If it's doable now, that's cool; know of any examples I could learn from? The slang tutorial in advent I see seems to be for the equivalent of Inline....
sena_kun m: say (.sum / .elems given <1 2 3>);
camelia 2
jmerelo TreyHarris: depending on what you're looking for, term might be more than enough. If Perl 6 syntax is OK, probably terms are all you need. 19:50
Xliff sena_kun: I want shorter! :)(
s/\(//
jmerelo TreyHarris: macros, well, they're not there yet. You might want to take a look at masak's 007, meanwhile.
sena_kun TreyHarris, unfortunately, there are no really much docs about making a slang. You can take a look at github.com/mryan/perl6-Slang-AltTernary <- it "redefined" ternary operator, if all you want is to replace some syntax using existing one, that may be a reference. 19:52
TreyHarris jmerelo: I'm just thinking about the best way to port Commands-Guarded to Perl 6 without just being a slavish reimplementation of the Perl 5 syntax where I could get close, but I had to use commas and end with a semicolon *and* I needed wantarray to tell me when I was in sink context 19:53
The way I would like to do it is: "guard $x.ready { $x.setup } # no semicolon needed here" and "guard $x.ready { $x.setup } rollback { $db.remove($x) } # no semicolon here either" 19:55
jmerelo TreyHarris: If there's a change in syntax, like no semicolons, well, you'll have to do it in your own Grammar.
TreyHarris Where, if you're not familiar with guarded commands, they're a way to impose idempotency on actions with side effects, so `$x.ready` is a boolean evaluated at runtime; if it evaluates true, the block is skipped and evaluation continues; if it evaluates false, the block is run and the guard boolean is checked again; if it's still false, it runs the rollback block if it exists, then throws an exception unless 19:57
suppressed by something (in the Perl 5 implementation it was setting a sentinal in the rollback block, but it could just as easily be an adverb or something)
tbrowder o/ #perl6 19:58
TreyHarris jmerelo: if I can do it with the only penalty being a semicolon at the end of "guard ...;" and "guard ... { ... } rollback { ... };", I can live with that
jmerelo tbrowder: hi!
tbrowder: happy new year!
TreyHarris: give it a try... 19:59
tbrowder :jmerelo happy new year to you and all!
TreyHarris jmerelo: will do, thanks. I just hate it when I go down the road of something that unknowingly depends on a NYI thing, which has stalled some prior efforts to port some P5 modules 20:00
tbrowder is there any way to use multiple traits on a sub? i want to use "cached" on an exported sub
sena_kun `is cached is export`
jmerelo goes AFK for dinner and couch-surfing. See you tomorrow! 20:01
sena_kun m: use experimental :cached; sub a() is cached is export {}
camelia ( no output )
sena_kun tbrowder, ^
tbrowder :sena_kun i've tried that, but maybe i typoed...i'll check 20:01
TreyHarris jmerelo: on another note, since you've been on top of tickets related to this, I did a docs fork where I fixed all the urlencoded relative links since they were broken, but that made the links in the pop-up search for things like $*OUT break. Has anybody got a solution for the search box? Because if so, I can quickly rebase my fork and fix the rest of the broken internal links. 20:03
I didn't have time to figure out the search box issue, so I've sat on that fork for a couple weeks now 20:04
tbrowder looks like my sub is not clean or decoupled enough; the "is cached is export" appears to work but i get an error pointing inside the sub--thanks! 20:05
Xliff Can you bind to a Proxy object? 20:21
moritz you can bind to containers, not to objects 20:25
Xliff Why YES, Houston! You CAN bind to a Proxy!
m: class A { has $!a; method a is rw { Proxy.new: FETCH => -> {$!a}, STORE => -> $, \v { say v; $!a = v; } }; }; my $b := A.new.a; $b = 1; $b = 0
camelia 1
0
Xliff m: class A { has $!a; method a is rw { Proxy.new: FETCH => -> {$!a}, STORE => -> $, \v { say "A: {v}"; $!a = v; } }; }; my $b := A.new.a; $b = 1; $b = 0
camelia A: 1
A: 0
Xliff :-O
I. Muzt. Uze. Dat! 20:26
moritz you are binding an object whose method returns a container to a variable
erm
you are binding an object whose method returns a Proxy to a variable
you aren't binding to a Proxy 20:27
Xliff No, but when I change $b, I run the Proxy's store method. 20:28
That's what I was curious about.
Kaiepi why does running this throw this error? hastebin.com/ewerixufuq.pl 20:30
===SORRY!===
This type cannot unbox to a native string: P6opaque, Failure
Kaiepi OH 20:31
i forgot use lib 'lib'
Kaiepi where should config files go on windows? 20:35
for psbot i have it in ~/.config/psbot.json but i have no clue where it'd go on windows 20:36
TreyHarris Kaiepi: %localappdata%\PSbot\psbot.json would be standard 20:55
Kaiepi ok
TreyHarris I'm not sure how to expand path vars on Windows in Perl 6, I've never used it on Windows
Kaiepi where's %localappdata%?
TreyHarris Kaiepi: it varies, it's a variable kinda like ~ on Unix 20:56
Kaiepi shit
TreyHarris Each user on the system gets one
moritz are they in %*ENV? 20:57
TreyHarris checking
moritz or do you have to look up those values in the Registry?
Kaiepi $*HOME/AppData/Local/PSBot/psbot.json?
TreyHarris moritz: no, definitely not.
Kaiepi: that would be the default default place for it, but it isn't safe to assume. Since I have a small SSD as my boot drive, mine is elsewhere
Kaiepi: my rakudo on Windows is broken. installing a new one, hang on 20:58
tbrowder i'm trying to use two named args to a sub that have the same name but different sigils and am getting an error--surprising!! 21:10
TreyHarris Kaiepi: it's not in %*ENV. Give me a moment to check a couple other places
Kaiepi ok
tbrowder error: Name stats used for more than one named parameter
:%stats and :$stats 21:11
m: sub foo(:$s, :%s) {}
camelia 5===SORRY!5=== Error while compiling <tmp>
Name s used for more than one named parameter
at <tmp>:1
------> 3sub foo(:$s, :%s)7⏏5 {}
TreyHarris Kaiepi: yes it is! I typod 21:12
Kaiepi: %*ENV<LOCALAPPDATA> 21:13
Kaiepi perfect!
thanks
tbrowder is that a bug?
m: my ($s, %s); 21:14
camelia ( no output )
tbrowder m: my ($s, %s); $s = 1; %s<a> = 1;
camelia ( no output )
tbrowder m: sub foo($s, %s) {} 21:15
camelia ( no output )
moritz tbrowder: in a parameter list, :$stats desugars to stats => $stats, and :%stats to stats => :%stats 21:16
argument list, sorry
so both filll the same named argument
and hence it doesn't make sense to declare both in the same signature
cfa perhaps worth documenting as a trap if this is confusing? 21:17
tbrowder ok, makes sense, thanks!
TreyHarris Kaiepi: oh, btw, I didn't ask, but if you care, you can check the difference between LOCALAPPDATA and APPDATA; the latter gets synced into one's Windows cloud account if one exists 21:20
I always just use LOCALAPPDATA
tbrowder m: loop(my $n = 0; $n < 2; ++$n) {} 21:58
camelia 5===SORRY!5===
Word 'loop' interpreted as 'loop()' function call; please use whitespace around the parens
at <tmp>:1
------> 3loop7⏏5(my $n = 0; $n < 2; ++$n) {}
Unexpected block in infix position (two terms in a row)
at <tmp>:1
tbrowder m: loop (my $n = 0; $n < 2; ++$n) {}
camelia ( no output )
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { .say} 21:59
camelia (Any)
(Any)
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { say $n}
camelia 0
1
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { say $n}; loop (my $n=0;$n<2;++$n){say $n} 22:00
camelia 5===SORRY!5===
Whitespace required before < operator
at <tmp>:1
------> 3ay $n}; loop (my $n=0;$n<2;++$n){say $n}7⏏5<EOL>
expecting any of:
postfix
Other potential difficulties:
Redeclaration of symbol '$n'
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { say $n}; loop (my $n=0;$n<2;++$n){ say $n} 22:01
camelia 5===SORRY!5===
Whitespace required before < operator
at <tmp>:1
------> 3y $n}; loop (my $n=0;$n<2;++$n){ say $n}7⏏5<EOL>
expecting any of:
postfix
Other potential difficulties:
Redeclaration of symbol '$n'
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { say $n }; loop (my $n=0;$n<2;++$n){ say $n }
camelia 5===SORRY!5===
Whitespace required before < operator
at <tmp>:1
------> 3$n }; loop (my $n=0;$n<2;++$n){ say $n }7⏏5<EOL>
expecting any of:
postfix
Other potential difficulties:
Redeclaration of symbol '$n'
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { say $n } loop (my $n=0; $n < 2; ++$n) { say $n } 22:02
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3oop (my $n = 0; $n < 2; ++$n) { say $n }7⏏5 loop (my $n=0; $n < 2; ++$n) { say $n }
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { say $n }; loop (my $n = 0; $n < 2; ++$n) { say $n }
camelia Potential difficulties:
Redeclaration of symbol '$n'
at <tmp>:1
------> 030; $n < 2; ++$n) { say $n }; loop (my $n7⏏5 = 0; $n < 2; ++$n) { say $n }
0
1
0
1
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { say $n }; 22:03
camelia 0
1
tbrowder m: loop ($n = 0; $n < 2; ++$n) { say $n };
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$n' is not declared
at <tmp>:1
------> 3loop (7⏏5$n = 0; $n < 2; ++$n) { say $n };
tbrowder m: loop (my $n = 0; $n < 2; ++$n) { say $n };
camelia 0
1
tbrowder m: my $n; loop ($n = 0; $n < 2; ++$n) { say $n }; loop ($n = 0; $n < 2; ++$n) { say $n } 22:07
camelia 0
1
0
1
tbrowder ah, the $n decl spillage spoils the second loop 22:08
tbrowder m: my $n; loop ($n = 0; $n < 2; ++$n) { say $n } loop ($n = 0; $n < 2; ++$n) { say $n } 22:08
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3; loop ($n = 0; $n < 2; ++$n) { say $n }7⏏5 loop ($n = 0; $n < 2; ++$n) { say $n }
tbrowder m: my $n; loop ($n = 0; $n < 2; ++$n) { say $n }; loop ($n = 0; $n < 2; ++$n) { say $n }
camelia 0
1
0
1
melezhik hi! how do I run system command and check it fails , without catching exception? 22:53
sena_kun m: my $a = run 'l', '-l'; say $a.exitcode == 0; 22:54
camelia False
sena_kun m: my $a = run 'ls', '-l'; say $a.exitcode == 0;
camelia total 132
drwxr-xr-x 1 camelia users 274 Jul 20 2017 Inline-Perl5
drwxrwxr-x 1 camelia users 494 Dec 28 16:05 Perlito
drwxr-xr-x 1 camelia users 30 Jul 16 2016 bin
-rw-r--r-- 1 camelia users 810 Dec 31 2015 dalek-queue
drwxrwxr-x…
sena_kun m: my $a = run 'ls', '-l', :!out; say $a.exitcode == 0; 22:55
camelia True
sena_kun melezhik, something like ^? Or you want a Proc::Async to do it in async way.
timotimo m: my $a = run 'false'; say $a.exitcode == 0 22:56
camelia False
melezhik thank you! 22:57
sena_kun m: my $a = Metamodel::ClassHOW.new_type(name => 'A'); $a.^compose; say $a; say $a.new; say $a.new ~~ $a; 23:09
camelia (A)
A.new
False
sena_kun this is... totally not something I would expect. 23:09
hmmm... with `constant` it works. 23:11
m: constant A := Metamodel::ClassHOW.new_type(name => 'A'); A.^compose; say A.new ~~ A;
camelia True
vrurg m: my $a := Metamodel::ClassHOW.new_type(name => "A"); $a.^compose; say $a; say $a.new; say $a.new ~~ $a 23:13
camelia (A)
A.new
True
vrurg It's not because of constant. You store a type in a Scalar container. Binding is the key here.
I don't know what happens when a run-time composed type gets stored in a scalar, but strange side-effects are taking place then. 23:14
sena_kun hmm... that is very much appreciated, though I, to be honest, don't really understand the meaning... Ah, ok.
vrurg was fighting with similar case a couple of days ago
sena_kun vrurg++
vrurg sena_kun: basically, whenever you go to metamodel consider using more binding because this is what is natural to NQP. 23:15
sena_kun thanks for the advice! 23:16
vrurg welcome!
vrurg Though I still wonder what makes this difference: 23:26
m my $a = Metamodel::ClassHOW.new_type(name => "A"); $a.^compose; say $a.new.WHICH; say $a.WHICH
m: my $a = Metamodel::ClassHOW.new_type(name => "A"); $a.^compose; say $a.new.WHICH; say $a.WHICH
camelia A|60460592
A|U42829192
sena_kun in my case(I hope), as long as it passes type checks, I am safe... 23:27
timotimo one is an instance, the other is the type object, at least in that last example 23:32
vrurg timotimo: thanks! And I knew this at some point! ;) 23:36
Ok, then it's definitely looks like a smartmatch bug 23:38
m: my $a = Metamodel::ClassHOW.new_type(name => "A"); $a.^compose; say $a.new.WHAT === $a
camelia True
vrurg sena_kun: what's your OS and perl6 version? I'm filing a report on the bug. 23:46
sena_kun vrurg, void linux, 2018.12. 23:47
This is Rakudo version 2018.12 built on MoarVM version 2018.12
vrurg same rakudo as mine. Ok, thanks!
sena_kun Linux miskatonic 4.19.13_1 <- though I am sure such guts will be helpful. :) 23:48
vrurg++
s/will/won't/
vrurg Most likely not. Mine is macOS, I also tried this on 2017.10 – same everywhere. 23:50
github.com/rakudo/rakudo/issues/2602
Hm, my 20th report... 23:51