»ö« 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.
timotimo bryan cantrill just wat-ed at Inline::Go 00:55
on twitter 01:00
El_Che url me? 01:08
rjbs my %substitutions = (
'flag-au' => flag('au'),
'flag-us' => flag('us').
'sparkles' => "\N{SPARKLES}",
haha, oops
github.com/azawawi/perl6-inline-go
omg, I can't use computers anymore, friends
twitter.com/bcantrill/status/10907...2702123008
El_Che rjbs: you're a suit, now :) 01:09
rjbs meanwhile, I'm 100% fighting with base Moose in another window
timotimo twitter.com/bcantrill/status/10907...2702123008 01:14
El_Che The dtrace thingie was fun until Oracle closed the kernel 01:18
guifa Okay, major brainfart moment. Why isn't nesting working here? tio.run/##K0gtyjH7/z@9KDE3N7FIwV2h...NZU13z/38A 01:21
leont guifa: because that misc will also match an opening parenthesis? 01:42
guifa leont: right, but by both rules of alternation, shouldn't it be checking that [ ~ ] matches first? 01:43
err by the rules of double bar
leont True, I guess it doesn't match that 01:44
leont I haven't used the regex debugger in ages, but it does exist 01:45
Changing the dot to \w does seem to fix it though 01:46
guifa Right, if I restrict <misc> in any way, matching works, which tells me the <group> is well formed. But for some reason the alternation priority is off 01:48
leont Ah, it's because the dot will match the closing parenthesis! 01:50
token doesn't backtrack
Replacing it with <-[)]> fixes everything :-) 01:52
guifa Indeed. But then you have to hard code out the parentheses. Okay, I think I got it fixed now. I was an idiot last night and was playing around with a grammar that I could only get to work by changing a token to regex 01:53
But somehow did something and it stopped working
You actually have to put both <op> and <group> as regex, but TOP and <misc> can stay as token for it to work. 01:54
guifa I guess the JSON standard is just restrictive enough to allow things to work without backtracking 01:54
leont Yeah 01:55
JSON is very restricted, I don't think any character has a double meaning.
The thing doesn't even allow for raw newlines in strings 01:56
guifa The only reason I'm not hard coding is I want it to be possible to augment/extend the grammar in a modular way, but... there's no easy way to add in characters into a negative character class, so I had to use . 01:57
leont You can make that a rule too, but I see your point 01:58
tokens fail much faster than regexes though, in some cases that is relevant as well. 01:59
guifa Indeed. The parse time is going astronomically for longer strings, even without added complexity 02:04
guifa Althoguh i'm not sure why. I can't reproduce it on that simple TIO page, but it's definitely happening in my (not much more) advanced code. Parsing ~60 chars was 11s, but ~61 was 30 (!) 02:08
guifa ~ 62 is 69 whoa 02:10
leont The grammar engine needs some speed optimization :-( 02:35
guifa I dunno, maybe it's just my machine? I can't reproduce on the TIO 02:36
MasterDuke guifa: what version are you using? 02:38
guifa weird, I'm still on 2018.01 ? 02:39
tf
And actually just got it to reproduce on TIO when I put copied my grammar in explicitly. 02:41
guifa tio.run/##rZFBT4MwFMfP8CleskNVLMk0...Jy397ZrvsB 02:49
There we go, so weird that only adding a single element can destroy the regex execution time so badly
MasterDuke backtracking can go exponential. changing those `regex` to `token` makes it go much faster 02:52
guifa Masterduke: true, but then the parse fails to go as expected 02:56
MasterDuke ah, i didn't notice 02:57
guifa The nested operator seems to really need the regex if the <comment> is just .
guifa Although since it's using double-bar I would think it should just match the brackets and move on, but I'm also not a regex guru so maybe there's a situation where after a successful nesting match it should keep trying 02:59
b2gills guifa: Make `term` non-greedy with ? `token group { '(' ~ ')' <term>*? }` tio.run/##K0gtyjH7/z@9KDE3N7FIwV2h...msqa75/z8A 03:11
guifa b2gills++++++ 03:12
ugh I figured it would be something so simple
guifa is humbled 03:13
b2gills I wrote a BF parser that did things like combine ++++++ into a single add(6) op
guifa Yeah. I have that has an optimizer after the parsing, but because it uses .assuming it actually is slower (!) 03:14
hahainternet I don't think performance is something easily predicted in complex programs yet in 6, although that may be slander from me 03:15
guifa The copy operations should actually be worth it. And apparently I was told that assuming hasn't been remotely optimized yet
hahainternet i'd only worry about signs of complexity, like the exponential growth above
reducing copies and the complexity of your grammars/algorithms are general wins
guifa I think that's where some of the big wins (and pitfalls) are going to be with P6 are in the grammars 03:21
OT1H, you can toss together some mostly functional grammars really really fast. OTOH, it's easy to have something off by a character or two in said grammar and spend hours tracking it down :-) 03:22
b2gills My first pass at a BF to Perl6 translator: gist.github.com/b2gills/f5969e2f44...6786a6be0c 03:25
b2gills I wrote that back in July 2016. 03:29
b2gills I started on a more robust version that same month which had a much simpler grammar, and did the combining as an optimization stage. 03:33
guifa b2gills: that's kind of what I'm doing 03:39
Trying to keep the grammar as simple as possible and everything very modular
guifa b2gills: my current way-to-many-options signature: pasteboard.co/HYW4MfY.png 03:48
b2gills I think you overdid on the modular thing 03:52
I would just bake []+-,.<> into the grammar, and let someone inherit from that grammar to change them. 03:53
guifa That's fair. I'm going to change it to just :%opcodes adverb, the idea being that someone who inherits can then use that hash in their grammar and then someone else can use the new commands but attach different characters to them easily 03:56
But it's easy to do default values and type checks with :$left, but :%opcodes you really can only type check and not ensure default values, unless you want to force all 8 codes to be present. Not a huge deal though 03:57
(within the signature, I mean) 03:58
b2gills How many languages have all of the same operations as BF, but use different characters for them? What if a language doesn't have one of the ops and wants to set it to an empty str? 04:01
guifa There's a few for the first one (I mean, mostly all joke languages). In the case of a language without one of the ops, they'd need to override the token for the command to effectively delete it 04:05
I haven't seen one that removes one of the commands, I've only seen switching characters and adding ops so far though 04:06
jmerelo releasable6: status 06:58
releasable6 jmerelo, Next release will happen when it's ready. 6 blockers. 162 out of 272 commits logged
jmerelo, Details: gist.github.com/acca4defa63333ab25...3adacc1cb7
AlexDaniel releasable6: status 07:17
releasable6 AlexDaniel, Next release will happen when it's ready. 4 blockers. 162 out of 272 commits logged
AlexDaniel, Details: gist.github.com/fe92a6275a2c6264d5...3a752d1187
AlexDaniel jmerelo: hey look it's not too bad :)
in fact I'm hoping to get the release out around this weekend 07:19
jmerelo AlexDaniel: great! 07:22
AlexDaniel: you see I'm delayed the squashathon, after a request by lizmat 07:23
AlexDaniel eahy
yeah*
lookatme_q Is the 2019.01 release available ? 07:24
AlexDaniel lookatme_q: no, not yet, still some blockers to go
lookatme_q okay, thanks :) 07:25
Geth doc: 45d8c16b52 | (JJ Merelo)++ | doc/Type/Sub.pod6
Add operator declarations to Sub.

Actually, they were pretty well covered elsewhere, so it's basically a set of pointers. Closes #1573
07:38
synopsebot Link: doc.perl6.org/type/Sub
cpan-p6_ New module released to CPAN! IO-Path-Mode (0.0.7) by 03JSTOWE 10:06
woolfy Last month's winner of the Squashaton got his Camelia from lizmat and me and seems to be happy with her: www.facebook.com/groups/perl6/perm...822787464/ 11:26
yoleaux 12 Nov 2018 12:24Z <holyghost> woolfy: we need to talk about music, new wave and metal
woolfy Remember: if you win the Squashaton, and you want the Camelia that you won, let lizmat or me know your address and we will send a package to you. 11:27
lizmat also: if you did in the past, and we forgot to send you one
pmurias woolfy++ & lizmat++ # awesome prize for the Squashaton 11:31
AlexDaniel oh wow, lizmat++ woolfy++ 12:14
weekly: squashathon next weekend! Previous winner: www.facebook.com/groups/perl6/perm...822787464/ 12:16
notable6 AlexDaniel, Noted!
tyil next weekend is fosdem ;~; 12:37
jmerelo Next to next... 12:43
Or Fosdem is this weekend, squashathon next weekend
woolfy Tomorrow evening, FOSDEM starts with the "Beer Event". Basically, people can choose from 4000+ different beers in Delirium Cafe. fosdem.org/2019/beerevent/ 12:51
Saturday, our booth starts (booth #16 on level 2 in K-building): fosdem.org/2019/stands/
jmerelo woolfy: have fun :-) 12:52
ravenousmoose_ Oh no, I can't make it to fosdem on saturday :(
woolfy In the evening, people can join us for dinner in La Porteuse d'Eau ( wendyga.wordpress.com/2019/01/29/m...ay-dinner/ ) but I like you to tell me (contact me personally) if you want one of the 50 seats I have reserved.
woolfy raveousmouse : The booth starts on Saturday morning and ends on the end of Sunday afternoon. Plenty of time to visit FODEM! :-) 12:53
... oh oh... sausage fingers misspelling name... 12:54
ravenousmoose_ ^
ravenousmoose_ Hahah, great! I'll make sure to stop by on sunday then
woolfy Yay! Come get some free stickers and buttons and tuits! 12:55
woolfy People who want to join for dinner: really, tell me! Soon-ish. Tomorrow afternoon I will be busy loading our van, driving to Brussels, unloading, setting up our booth, and maybe the beer event, to check IRC, mail, or Facebook. 12:59
tomato_ Hi, please have a look on this question about INIT: when a module which contains an INIT phaser is used in different files, how many times the INIT pharser will run ? 13:43
tomato_ I thought it would run at most once, but I found I was wrong 13:44
tomato_ The page at docs.perl6.org/syntax/%20INIT says: "since the phasers are only installed the first time they're noticed" 13:47
lizmat tomato_: could you gist the problem and tell what you're expecting? 13:56
ufobat_ assume you have A.pm6 with class A { INIT { say "hi" }}; you have B.pm6 and C.pm6 with use A; class B {}; (or C) 14:01
ufobat_ and when you do perl6 -Ilib -e 'use B; use C;' for me the init phaser gets executed 3 times 14:02
but only the first time. 14:03
phasters get executed during precompilation, maybe?
tomato_ I used the INIT for global initialization. It could not run more than once, or my program would crash. 14:06
But it did crash. :( 14:07
tyil tomato_: docs.perl6.org/syntax/%20once 14:10
would this be of interest?
ufobat_ github.com/ufobat/phasers/blob/master/lib/A.pm6
i added a state $a = 0; $a++ to it, but it always says that $a is 1 14:11
soo ints executed a couple of times, but my assumption is that the 2 times are from precompilation and the last one from execution of the programm
ufobat_ the first 2 rounds should be virtually not there for your programm execution 14:12
you're probably doing something in filesystem or so?
lizmat, there is your gist.. well repo :p
tomato_ ??? 14:15
evalable6 Stub code executed
in block <unit> at /tmp/b8cm2QNNvY line 1
ufobat_ tomato_, add "no procompilation" on top of the class where the INIT phaser is 14:19
and try it again, pls?
tomato_ ok
ufobat_ precompilation 14:21
typo, sorry
tomato_ Yeah, now it works well, but starts slow... 14:22
ufobat_ yeah :( 14:23
if you remove the line it only fails for the first time
it might be a bug, i dont know :(
you might want to open an issue
tomato_ tyil: 'once' gives the same result. 14:27
tyil :( 14:37
lizmat ufobat_: R#2664 15:05
synopsebot R#2664 [open]: github.com/rakudo/rakudo/issues/2664 Precompilation should *not* run the INIT phaser / mainline when -use-d?
ufobat_ lizmat++ 15:12
melezhik Hi! how to check that object/container is Nil? 15:51
melezhik probably .defined 15:56
m: my @a=(1,Nil,1); say @a[1].defined
camelia False
AlexDaniel melezhik: see also `with` 16:01
m: my @a=(1,Nil,1); with @a[1] { .say }
camelia ( no output )
AlexDaniel m: my @a=(1,Nil,1); with @a[0] { .say } 16:02
camelia 1
melezhik AlexDaniel: thanks 16:04
ufobat_ or grep? 16:09
m: say (1, Nil, 1).grep: *.so 16:10
camelia (1 1)
ufobat_ can someone explain to me why this works? 16:35
ufobat_ m: perl6 -e 'sub a(:$test = 1) { say $test }; sub b(:$test) { a(|:$test) }; b()' 16:35
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3perl6 -e7⏏5 'sub a(:$test = 1) { say $test }; sub b
expecting any of:
infix
infix stopper
postfix
statement…
ufobat_ m: sub a(:$test = 1) { say $test }; sub b(:$test) { a(|:$test) }; b() 16:35
camelia (Any)
ufobat_ ah well no forget it, it doesnt work 16:36
my question is how could i make the default test on sub a to work
jmerelo ufobat_: default test, as in the proto of a multi? 16:37
ufobat_ m: sub a(:$test = 1) { say $test }; sub b(:$test) { my %param; %param<test> = $test if $test.defined; a(|%param) }; b()
camelia 1
ufobat_ i want that the :$test that might be passed sub b only passed something to the call of sub a() if test is defined 16:38
my last example worked, but is clumsy :(
jmerelo ufobat_: if it works... 16:39
ufobat_ yeah :(
ufobat_ jmerelo, query :) 16:43
jmerelo ufobat_: on my way 16:54
Geth doc: 1a5cb9f82f | (JJ Merelo)++ | doc/Language/operators.pod6
Format corrections and reflow
17:01
synopsebot Link: doc.perl6.org/language/operators
b2gills m: sub a(:$test = 1) { say $test }; sub b(:$test) { a(|(:$test with $test)) }; b() 19:16
camelia 1
jmerelo b2gills: cool
b2gills m: sub a(:$test = 1) { say $test }; sub b(:$test) { a(|(:$test with $test)) }; b(:test(4))
camelia 4
holyghost I've programmed more on my Xcode DAW and made a start of a hero's quest computer game, I donated the code to the pm. 19:22
ufobat_ b2gills, awesome! thank you! 20:39
b2gills, my other golf was my $test; sub b(:$test = 1) { say $test}; b( |(:$test).grep(*.value.so).Hash)' 20:40
b2gills m: sub a(:$test = 1) { say $test }; sub b( *%_ ) { a( |%_ ) }; b(); b( :test(4) ) 20:46
camelia 1
4
pmurias do we have a way to warn when named arguments to methods end up mistyped? 21:00
El_Che will it match the signature? 21:04
pmurias methods get signatures that ignore unrecognized named arguments 21:06
El_Che ah, like strict new method modules,I see 21:07
timotimo i could imagine overriding find_method of ClassHOW to return a modified method for everything that checks if named arguments that got passed are not recognized by any candidate, but are similarly spelled 21:10
so you can basically have a "named arg sanitizer" run of your program
Geth doc/master: 6 commits pushed by Coke++ 21:41
MasterDuke pmurias: isn't there a module that does that? 21:47
timotimo MasterDuke: i only know one for method new 21:48
MasterDuke ah, could be. i haven't actually used anything like that, it just sounded familiar 21:52
pmurias timotimo: I could imagine highlighting unrecognized named arguments would be a cool feature in an editor 21:54
timotimo pmurias: do you have an idea if SDL2 could be made available to rakudo.js? 21:56
SDL2 has an emscripten port that can build for wasm or asm.js 21:58
pmurias timotimo: checking... 22:04
timotimo You don’t actually need to compile SDL2 yourself if you don’t want to. By defining USE_SDL=2 on the emscripten commandline it will automatically download SDL2 and compile it instead of using the javascript implementation of SDL 1.2 22:04
kripken.github.io/emscripten-site/...pten-ports 45
^- pretty neat
pmurias timotimo: by SDL2 you mean the raw C library or a Perl 6 binding? 22:05
timotimo if SDL2::Raw could work as-is, that'd be amazing, otherwise it could just as well be a tailor-made SDL2::Raw::JS or whatever 22:08
pmurias timotimo: did people get wasm SDL2 to work in the browser (with a demo that can draw something rather than say load a .png for processing)? 22:10
timotimo i mean there's a port of UT99's intro scene where it flies through a bunch of geometry 22:11
that's more than loading a .png, right?
pmurias timotimo: that should be enough to demonstrate that SDL2 can draw something in the browser ;) 22:12
timotimo well, it uses WebGL rather than the regular canvas API
pmurias main.lv/writeup/web_assembly_sdl_example.md - simple example I found 22:13
timotimo but the SDL2 renderer API also goes via OpenGL - which is only one of multiple backends it can choose from at run-time i guess
timotimo github.com/timhutton/sdl-canvas-wasm 22:14
this may also be interesting
pmurias timotimo: does OpenGL work in the browser? 22:15
timotimo github.com/timhutton/opengl-canvas-wasm 22:15
does that answer it?
pmurias google answered it ;), it seems that it is emulated by webgl 22:17
timotimo yeah 22:18
TreyHarris Hm, I asked this on #perl but I just realized I might be thinking of a Perl 6 module. I'd like to expose some information to the shell in a way that can be sourced by the shell in the rc file (a la eval'ing ssh-agent), but I'd like it to be shell-independent for the common POSIX shells, so "export VAR=val;alias new=old", etc. for bash but "setenv VAR val; alias new old" on tcsh, etc. In Perl 5, local::lib
offers some functionality like that, but I thought I saw a CPAN module that was specifically for this purpose
pmurias timotimo: when I'm fresh in the morning I'll think how the part exposing the C functions to Perl 6 should work 22:19
timotimo cool! it isn't pressing or anything, just a thought i had 22:20
pmurias timotimo: calling things that are accessible to js should be a matter of fleshing the js interop layer
getting to C has a level of indirection 22:21
pmurias timotimo: I feel like the point of the sdl ports is to call them for C so we would either have to write our own C to js binding or generate it from native call definitions somehow 22:43
timotimo i don't know, maybe someone has already built an SDL2 implementation in pure javascript 22:44
El_Che in pure javascript? 22:45
(∩`-´)⊃━☆゚.*・。゚
timotimo well, javascript with browser stuff 22:46
i guess you call that vanilla rather than pure
TreyHarris I can't fetch or clone moritz/perl6-all-modules -- getting a "fatal: pack has bad object at offset 4049732: inflate returned -3" "fatal: index-pack failed" ... is this just me? 23:12
timotimo you don't happen to have a full hard drive? 23:13
TreyHarris No, 230G free 23:16
timotimo not sure what that could be about 23:19
TreyHarris Huh; it's a problem with hub-clone; if I do straight "git github.com/moritz/perl6-all-modules.git" it works. very weird
timotimo oh? yeah that is weird
TreyHarris Looks to be that HTTPS works, but git:// does not 23:20
timotimo i tend to clone stuff from github via ssh
TreyHarris yep, me too 23:22
git:// is SSH. That's what isn't working
just moritz/perl6-all-modules though; other repos are fine 23:23
timotimo oh? i thought for that you need git+ssh:// or is that git+https:// that does that?
TreyHarris You're right. I have no idea why hub is creating "git:..." remotes 23:28
hythm hello, I want to create Array::Matrix role, which should convert an array to 2d array. 23:44
p6: role Array::Matrix { has @.array; has $.col-count; method gist { say @!array.rotor($!col-count) } }; Array::Matrix.new(array => <a b c d>, col-count => 2).gist; 23:45
camelia ((a b) (c d))
hythm I want to transfor this code instead of creating an object, I want to be able to do: my @a does Array::Matrix(:$col-count) 23:47
I know drom the docs : my @a does SomeRole; workds, but how to pass an attribute to the role if possible 23:49
sena_kun you can make it parametrized 23:50
like...
m: role A[:$a] { method get-a { $a } }; my $a does A[a => 5]; $a.get-a.say;
camelia 5
sena_kun ^
the code is quite golfed, but the main idea is that you can take a named parameter for a role. 23:51
and use it later.
the bad thing is that you likely cannot just `my @a does Array::Matrix[col => 3] = 1, 2, 3`. 23:52
hythm thanks sena_kun, I saw that in the docs but I thought I can parametrize with Types only. thats defiantly will help
sena_kun as you need `1, 2, 3` to be filled for `$.value` attribute of your role.