»ö« 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.
zachk can I just leave a block empty {} for a no op? 00:34
El_Che for a sub of method? yes 00:35
you can document it as "not implemented" by using {...} 00:36
Xliff Can roles compose submethods?
El_Che good question
what's the point of defining submethods in a role, 00:38
?
submethods is an inheritance thing
Xliff I want all role subscribers to call a single method when destroyed. 00:39
This method can then be overriden or inherited on a per class basis.
Ideally, I think I may just do something with arrays and have DESTROY call that as cleanup. 00:40
El_Che the idea of submethod is that it's not inherited, not that it can (or not) be overriden
Xliff That was an idea that was percolating....
Right, but there is common cleanup, uncommon cleanup and specific cleanup that can stop both common and uncommon cleanup.
I've tried doing that with regular methods, but it is getting convoluted. 00:41
I think I will circle back to my array method and have DESTROY just call @!cleanup.
El_Che you're going into the rabbit hole, aren't you Dorothy? :)
Xliff Was this bottle that said DRINK ME a glaringly obvious clue? 00:42
(It actually says "Miller High Life", but allow me my foibles)
El_Che :)
zachk made a simple chat server using cro, under 50 lines of code 00:55
El_Che impressive
zachk whats a good perl6 pastebin? 00:56
El_Che I don't know if there are
sena_kun uses gist.github
El_Che sadly github killed anonymous gists
zachk pastebin.com/jRVNaaBr 00:57
color scheme is iffy but eh, there is my chat server 00:58
took me a bit to wrap my head around supplies, supply blocks and whenever
smallest I had a chatserver before was like under 100 lines in Oz/Mozart
El_Che pretty cool 00:59
zachk thank you :) 00:59
timotimo glot.io and tio.run let you not only paste, but also immediately execute 01:29
Xliff timotimo: o/ 01:32
Can you glance at github.com/rakudo/rakudo/issues/2589 and comment? 01:34
timotimo oh, huh 01:41
that is probably part of the compiled buildplan?
Xliff I am just starting with nqp, so I am not sure about that. 01:44
But it's not just strings. CStructs also suffer from the same thing.
timotimo at gen/moar/BOOTSTRAP.nqp:4149 (/home/timo/perl6/install/share/nqp/lib/Perl6/BOOTSTRAP.moarvm:assign-fallback)
from -e:1 (<ephemeral file>:BUILDALL)
oh, with the same solution, even? 01:45
Xliff Unless it's a numeric "primative" you have to drop to nqp::bindattr to fix it.
Yes.
Except with bindattr_o, of course. 01:46
Scratch that....
timotimo i thought it'd be a bindattr_* that is compiled into that ...
Xliff unbox_o as opposed to unbox_s
Fingers typing faster than brain 01:47
timotimo i don't think unbox_o is a thing
Xliff No. It was just an nqp::decont 01:50
Sorry.
timotimo: So it sounds like this is not something that is easy to fix? 01:53
timotimo well, check out generate_buildplan_executor 02:01
timotimo i'd assume it's just using assign instead of bindattr 02:02
so it could be we want special-casing for CStructs
Xliff And Strs 02:09
timotimo well, i mean when the class itself is a CStruct 02:10
and then for both str and cstruct parts
Xliff Do you mean generate_accessor or generate_buildplan_executor? 02:14
So: 1) test if class is CStruct, 2) test attribute is Str or CStruct, 3) if rw then build bindattr-based accessor? 02:15
Xliff AlexDaniel? 02:15
o/
timotimo i'm not sure if it should be decided in generate_buildplan_executor or when we generate_buildplan or what it's called 02:18
Xliff timotimo: Well, thanks for looking! 02:27
AlexDaniel Xliff: yes? 02:27
Xliff No, was just curious as to whether that was really you.
Was discussing github.com/rakudo/rakudo/issues/2589 with timotimo 02:28
AlexDaniel not me unless you see my signature :) 02:30
Kaiepi how can i keep state in a grammar that persists between parses?
timotimo should be enough to just have an attribute and then use the Grammar.new object for multiple .parse runs 02:31
alternatively, have the state in the actions class and use an instance for that
Kaiepi m: grammar Foo { has Int $.a = 0; token TOP { <.b> a }; method b { $!a++; self } }; my Foo $foo .= new; $foo = $foo.parse('a'); $foo = $foo.parse('a'); say $foo.a 02:37
camelia 1
Kaiepi m: grammar Foo { has Int $.a = 0; token TOP { <.b> a }; method b { $!a++; self } }; my Foo $foo .= new; $foo = $foo.parse('a'); $foo = $foo.parse('a').parse('a'); say $foo.a 02:38
camelia 1
Kaiepi ok here's what i'm trying to do 02:40
Kaiepi i have this grammar hastebin.com/ebexeceduz.xml 02:40
Kaiepi but when it tries to parse "{IAC}{DO}{TRANSMIT_BINARY}" it locks up 02:40
Kaiepi i want the grammar to know when it's parsing binary data 02:41
tyilanmenyn stupid netsplit >:( 02:48
Kaiepi did everyone see the messages i sent? 02:54
timotimo about keeping state in grammars? 02:54
i had sent an answer to that:
should be enough to just have an attribute and then use the Grammar.new object for multiple .parse runs
alternatively, have the state in the actions class and use an instance for that
Kaiepi no the ones afterwards
<Kaiepi> ok here's what i'm trying to do 02:55
timotimo you had your connection reset, and right after that i got disconnected as well
Kaiepi <Kaiepi> i have this grammar hastebin.com/ebexeceduz.xml
<Kaiepi> but when it tries to parse "{IAC}{DO}{TRANSMIT_BINARY}" it locks up
<Kaiepi> i want the grammar to know when it's parsing binary data
timotimo you've got to be careful with setting values inside tokens like that; if a token is being matched partially (i.e. there can be backtracking at a higher level), the value could be wrong on the way back after reversing 02:56
could be better to use the call stack along with dynamic variables 02:57
timotimo since they get popped off at the same time the backtracking happens 02:57
Xliff Kaiepi: hastebin.com/ovudoyijal.pl 03:01
But timotimo's point is well taken. Better to use dynamics.
Kaiepi how would i keep the state of dynamics between multiple parses? 03:07
timotimo have a dynamic variable on the outside, too ... but you'd have to manually carry the latest ("innermost") value to the outside at the end
Kaiepi i don't get what you mean 03:11
timotimo well, you want the value of the dynamic variable at the end of parsing, right? 03:11
Kaiepi yeah 03:11
timotimo the trick with using dynamics is that every part of the call stack gets its own value (by looking upwards for the nearest one) 03:12
but when parsing finishes, all these frames will return
and the innermost value, which was the interesting one, will be gone
Kaiepi can you show me an example of what you mean? 03:14
timotimo well, it depends on your grammar being structured to recurse after every change to the dynamic variable
i mean if you're just careful with backtracking, maybe you can ignore all i've said 03:15
Kaiepi i don't understand <timotimo> the trick with using dynamics is that every part of the call stack gets its own value (by looking upwards for the nearest one) 03:19
timotimo can't come up with a good example off the top of my head :(
i'll go to bed very soon 03:20
timotimo o/ 03:28
Xliff Kaiepi: This might help -- docs.perl6.org/language/grammars#D...n_grammars
Night, timotimo!
Kaiepi ...i wrote that 03:29
Xliff :-O
LOL!
OK. My bad.
timotimo the joys of being a small community ;) 03:29
Xliff I know, rite! 03:30
timotimo well, and having a big part of the community helping out in all kinds of places
Xliff You want to keep that between invocations. I forgot.
timotimo okbye
Xliff Kaiepi: glot.io/snippets/f8m1uygwes 03:38
_isomorphismes is there a want / need for (1) something like a data.frame (panda) (2) matrix factorisation ? 04:04
looks like new perl has literate programming (it says à la haskell but could also à la .Rmd or à la jupyter). Anyone in here used it Perl6::Literate?
MasterDuke _isomorphismes: i can recall people mentioning something like panda being a good thing. don't know anything about the other stuff you mentioned 04:14
Kaiepi finally got it to work! 04:15
thanks Xliff
Xliff :) 04:17
_isomorphismes MasterDuke: the best 3-4-5 parts of #R are (1) plotting (2) vectorised multiplication (dot-product or convolved) (3) Rmd's (literate code) (4) matrix factorisation & linear model built in 04:20
_isomorphismes MasterDuke: panda / data.frames are 2-D arrays with one data type per column and a header/label for each column. (Also optionally labels for rows, and a few other things). It's a useful data structure, and less wrong than time series (which was implemented several times and none really stuck) 04:21
MasterDuke: github.com/wch/r-source/tree/trunk...y/graphics + stats have copyable ideas 04:26
Geth doc: 683b7f178b | (JJ Merelo)++ | doc/Type/Any.pod6
Inverts sentence to correct

  *All* methods in Any are in list, because List subclasses Any. The
   inverse is not true.
06:34
doc: eb1d5d2377 | (JJ Merelo)++ | doc/Type/Any.pod6
Removes experimentality from toggle, refs #2550
doc: 0df69d11a6 | (JJ Merelo)++ | doc/Type/Routine.pod6
is cached, still experimental. Closes #2550
jmerelo squashable6: status 06:58
squashable6 jmerelo, Next SQUASHathon in 15 days and ≈3 hours (2019-02-02 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
ufobat good morning :D 08:39
lookatme_q ufobat, o/
lookatme_q m: my $str = Buf.new([137, 80, 78, 71, 13, 10, 26, 10, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say $str ~~ /. ** 8/; say $str ~~ m:P5/.{8}/;/ 08:41
camelia 5===SORRY!5===
Regex not terminated.
at <tmp>:1
------> 3tr ~~ /. ** 8/; say $str ~~ m:P5/.{8}/;/7⏏5<EOL>
Regex not terminated.
at <tmp>:1
------> 3tr ~~ /. ** 8/; say $str ~~ m:P5/.{8}/;/7⏏5<EOL>
Unable to parse regex; c…
lookatme_q m: my $str = Buf.new([137, 80, 78, 71, 13, 10, 26, 10, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say $str ~~ /. ** 8/; say $str ~~ m:P5/.{8}/; 08:42
camelia 8 9
「PN
lookatme_q m: my $str = Buf.new([137, 80, 78, 71, 13, 10, 26, 10, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say so $str ~~ /. ** 8/; say so $str ~~ m:P5/.{8}/;
camelia 8 9
True
False
lookatme_q what's the difference of Perl 5 and Perl 6 regex ?
The dot
ufobat in perl5 the . does not match on the newline 08:50
ufobat my $str = Buf.new([137, 80, 78, 71, 13, 10+40, 26, 10+40, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say so $str ~~ /. ** 8/; say so $str ~~ m:P5/.{8}/; 08:51
evalable6 9 9
True
False
ufobat any maybe not on the CR
ufobat my $str = Buf.new([137, 80, 78, 71, 13+40, 10+40, 26, 10+40, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say so $str ~~ /. ** 8/; say so $str ~~ m:P5/.{8}/; 08:51
evalable6 9 9
True
True
ufobat yeah
lookatme_q ufobat, that's right 08:52
thanks :)
ufobat my $str = Buf.new([137, 80, 78, 71, 13, 10, 26, 10, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say so $str ~~ /. ** 8/; say so $str ~~ m:P5m/.{8}/;
lookatme_q Actually I read this article blogs.perl.org/users/sylvain_coline...3-gfx.html 08:52
ufobat m: my $str = Buf.new([137, 80, 78, 71, 13, 10, 26, 10, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say so $str ~~ /. ** 8/; say so $str ~~ m:P5m/.{8}/;
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of {N,M} as general quantifier; in Perl 6 please use ** N..M (or ** N..*)
at <tmp>:1
------> 3r ~~ /. ** 8/; say so $str ~~ m:P5m/.{8}7⏏5/;
lookatme_q from the weekly report
ufobat m: my $str = Buf.new([137, 80, 78, 71, 13, 10, 26, 10, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say so $str ~~ /. ** 8/; say so $str ~~ m:P5/.{8}/m;
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of /m; in Perl 6 please use ^^ and $$ anchors
at <tmp>:1
------> 3 ~~ /. ** 8/; say so $str ~~ m:P5/.{8}/m7⏏5;
ufobat m: my $str = Buf.new([137, 80, 78, 71, 13, 10, 26, 10, 0]).decode("latin1"); say $str.chars, " ", $str.codes; say so $str ~~ /. ** 8/; say so $str ~~ m:P5/.{8}/s; 08:53
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of /s; in Perl 6 please use . or \N
at <tmp>:1
------> 3 ~~ /. ** 8/; say so $str ~~ m:P5/.{8}/s7⏏5;
ufobat *shrug*
lookatme_q Interesting how using the grammar to parsing binary data
ufobat in perl5 there was a /m or /s modifier for regex to do so. but i cant remember which one
yeah i loved this article as well
lookatme_q But you see
We have 9 uint8 data, the chars is said only 8 08:54
ufobat i dont know it, but i assume that you have 8 chars (which you really have) the \0 terminates the string, it is not a character but it is a byte thats used for it 08:55
lookatme_q gist.github.com/araraloren/f4164cd...163438f072 08:56
ufobat, I write a simple script try to parse the header of PNG file
I faced this problem in the beginning :)
lookatme_q Don't know how to continue :/ 08:58
ufobat for me it feels that there is to less native support for binary stuff in grammars :( 08:59
lookatme_q yeah, I think it is
ufobat lookatme_q, what do you want to achive?
woudn't it be cool if you could state bit patterns in binary or hex in regular expressions? 09:01
lookatme_q hmm, I think if I can get correct number data from the file , the script will be fine
ufobat what do you mean? 09:02
lookatme_q I mean you write . ** 8 in the header 09:03
but they give you 9 uint8
this is what I wanted: Buf.new([137, 80, 78, 71, 13, 10, 26, 10])
the string matched in $/: Buf.new([137, 80, 78, 71, 13, 10, 26, 10, 0]) 09:04
Is that clear ? sorry my I am not native English user 09:05
ufobat let me find a png image :D 09:07
lookatme_q ufobat, okay :)
ufobat, I am off work, I'll back when I am at home :) thanks 09:12
ufobat is it a bug? 09:18
moritz, you know everything about regexes, is it a bug?
moritz I never tried parsing binary with p6 regexes :/ 09:21
but it feels a bit buggy, yes
ufobat i am wondering what makes the 9th byte with 0 to appear 09:27
HA!° 09:31
i know why
moritz graphemes? 09:32
token header { . ** 8 <?{ say $/.Str.chars }> } 09:33
ufobat exactly
moritz says 8
ufobat github.com/croservices/cro-http/pull/65
there jnthn explained to me that in regexes \r\n is a single grapheme 09:34
and the 0d 0a is \r\n
moritz not just in regexes, in strings in general
ufobat yeah
moritz m: say "\r\n".chars
camelia 1
ufobat this means that . ** 8 is just by accident 8 bytes
you shoudn't parse binary with regexes :-( 09:35
jkramer ^H^H 09:41
ups 09:42
moritz there's a point to be made for a codepoint-mode for grammars 09:50
when parsing json, I had to special-case parsing quoted strings, because '"' <string_contents> '"' wouldn't match if the first thing inside the quote was a combining character 09:52
moritz github.com/moritz/json/blob/master...mar.pm#L25 09:52
moritz and github.com/moritz/json/blob/master...ons.pm#L37 09:53
ufobat what was NFC again? 09:56
lizmat Normalization Form Composite
moritz I guess NFD (decomposite) would've been more appropriate, but since there are no pre-composed chars based on ", it doesn't make a difference really 09:57
kensanata NFC: ä; NFD: ̈ + a
Too slow. 09:58
Hah
moritz kensanata: nearly, the base char comes first
so a + + a
eeks
kensanata moritz: indeed, and now it displays correctly within Emacs, too. 09:59
moritz a + \c[COMBINING DIAERESIS] 10:00
ufobat but NFD does not help for parsing binary, does it? 10:02
moritz not really
m: say 'ä'.NFD.perl
camelia Uni.new(0x0061, 0x0308).NFD
moritz it would, if grammars worked on NFD, but grammars *only* work on Str 10:02
ufobat :-( 10:04
andrzejku have anyone report already Perl6 company? 11:20
moritz andrzejku: I can't parse your question 11:23
araraloren hi
ufobat, thanks for trying, so that article is just special case, I think 11:28
ufobat i am afraid, yeah :( 11:29
pmurias do we have a way to grep *just* Perl 6 modules? 11:48
lizmat I mentioned one a few weeklies ago :-) 11:49
timotimo we have greppable6 :) 11:49
pmurias lizmat: I just looked up the link in the weekly, it seems to be searching for both Perl 5 and Perl 6 modules
lizmat there's a radio button 11:50
timotimo greppable: blurb
greppable6 timotimo, 12 lines, 2 modules: gist.github.com/bb7039ec5510b52dfa...06980588f6
pmurias greppable: lib
lizmat ah, that only includes Perl 6, not exclude Perl 5 :-( 11:51
lizmat github.com/charsbar/CPAN-Groonga/issues/1 11:52
greppable6 pmurias, 25032 lines, 1035 modules: gist.github.com/c25f28c312eee40124...c9439ebe5c
lizmat jjmerelo++ # twitter.com/jjmerelo/status/1085858117164781570 11:53
pmurias greppable: use lib
greppable6 pmurias, 2437 lines, 475 modules: gist.github.com/31fb368f88d66f05ff...bd4c914876
pmurias I have been thinking about 'use lib' recently as it's causing problems in running stuff in precompiled mode (roast tests in particular) 11:54
lizmat use lib has more issues, e.g. when specifying a dir that has a lot of files in it :-) 11:55
araraloren yeah, I faced that problem long time ago 11:56
too slow
jnthn I thought `use lib` was simply not allowed in precompilation mode, because it's too late to have any effect at that point?
pmurias jnthn: yes, by causing problems I mean not running at all ;) 11:57
but the whole concept of the pragma itself seems to suck, it takes a patch that's resolved relative to the current directory the program is run from 12:00
when people actually use it as if it was relative to the directory the file that contains it is in 12:01
pmurias maybe we could allow 'use lib' in precompilation mode when the topmost repositiory in the chain is the same as the one 'use lib' wants to add? 12:06
so that 'use lib "foo"' would work in precompilation mode with perl6 -Ifoo
? 12:07
jmerelo jnthn: If I remember correctly, it fails in precompilation mode.
jmerelo tries to remember if he asked it in SO or raised an issue in rakudo 12:08
jnthn pmurias: You'll have to ask somebody like nine++ who knows the details of that
Though certainly as I understand it, it's not really possible in general to make it work, but there might just be some wiggle room if we allow precompiling scripts 12:09
pmurias jnthn: I'm not sure how to test roast tests that use 'use lib' in precomp mode 12:12
jmerelo jnthn: do we allow precompilation of scripts? I didn't think we could. 12:13
jmerelo pmurias: you can try and call the precomp methods explicitly. 12:13
pmurias jmerelo: I'm precompiling stuff manually 12:14
jnthn pmurias: I don't think it's possible.
pmurias to run script
cpan-p6 03cpan-p6 reporting for duty! [Perl 6] 02git.tyil.nl/perl6/app-cpan-uploadnotifierbot 12:15
New module released to CPAN! JSON-Name (0.0.3) by 03JSTOWE
New module released to CPAN! JSON-Marshal (0.0.16) by 03JSTOWE
pmurias jnthn: I could textually mangled them (they way we fudge stuff), but that feels wrong 12:16
jmerelo pmurias: I mean that whatever you do using statements like "use lib" and so so you should be able to do it using CompUnits explicitly. Tat "use lib" should be moved to the precomp unit.
jmerelo understands it's difficult to make this understandable and is not sure he actually understands it.
pmurias or we could remove 'use lib' from roast scripts and run the roast scripts with a perl6 -I... 12:17
lizmat pmurias: what's the functional difference between -Ilib and 'use lib "lib"' ? 12:18
pmurias -Ilib can work with precompilation
pmurias lizmat: but they do the same thing just at different points in time 12:33
lizmat I guess I hadn't realized that "use lib" prevents precompilation 12:34
SmokeMachine Os it possible to populate a CStruct class with a Buf? 13:14
s/Os/Is/
moritz possibly with a nativecast, dunno 13:22
SmokeMachine Wouldn’t that be a good way to “parse” binary data? 13:29
SmokeMachine m: use NativeCall; class C is repr<CStruct> { has int8 $.a }; my $c = C.new: Buf.new: 42; say $c; say $c.a 13:30
camelia Default constructor for 'C' only takes named arguments
in block <unit> at <tmp> line 1
jnthn Only if you know it's endainness matches the machine you're on... :) 13:31
SmokeMachine jnthn: yes... 13:32
pmurias jnthn: could the endiannes of the place the CStruct is taken from be supplied? 13:33
SmokeMachine m: use NativeCall; class C is repr<CStruct> { has int8 $.a }; my $c = nativecast(C, Buf.new: 42); say $c; say $c.a # moritz you were right 14:08
camelia C.new(a => 42)
42
SmokeMachine m: use NativeCall; class C is repr<CStruct> { has int8 $.a; has int16 $.b }; my $c = nativecast(C, Buf.new: 42, 0, 13); say $c; say $c.a, $c.b 14:10
camelia C.new(a => 42, b => 13)
4213
breinbaas mutt 14:41
El_Che butt 14:42
breinbaas sorry, wrong screen 14:42
eno is there anyone here who is familiar with the nqp repl? 14:52
I'm trying to test out regular expressions with nqp but I keep getting the same error "Too many positionals passed; expected 1 argument but got 2" 14:54
when I do something like this: "hi" ~~ / "hi" / 14:55
sena_kun nqp: my $a := "hi" ~~ /"hi"/; say($a); 14:57
camelia hi
sena_kun eno, I am not a nqp user though, but ^ may help. 14:58
eno im getting the same error 14:59
sena_kun and just in case, nqp is not intended for end user to write code in, unless you want to help with Rakudo or some other compiler development. :)
eno I know, I'm writing a parser for the vm 15:00
sena_kun eno, what is your moarvm/nqp/rakudo version?
the code above runs ok on 2018.12. 15:01
eno nqp --version : This is nqp version 2018.03 built on MoarVM version 2018.03
default on ubuntu
sena_kun hmm, this is a bit old side, but I still don't think it shouldn't work because of that. 15:02
have you seen examples at nqp repo?
eno yeah, it's not very robust 15:03
moritz so, what code did you run, exactly? 15:04
Perl 6 is more programmer-friendly than NQP :)
araraloren Is NQP has grammar ? 15:05
moritz sure
Rakudo's Perl 6 grammar is written in NQP
eno 1 ~~ /1/ for example
throws Too many positionals passed; expected 1 argument but got 2
araraloren oh, well, maybe it is cause by the token name, if you are using grammar
moritz github.com/rakudo/rakudo/blob/mast...rammar.nqp
eno also how do you make a token or rule outside a grammar? 15:06
pmurias eno: 'the vm' - what are you creating?
araraloren nap: say(123); 15:07
eno pmurias: just a custom language
araraloren nqp: say(123);
camelia 123
moritz nqp: 1 15:08
camelia ( no output )
moritz nqp: 1 ~~ /1/
camelia ( no output )
moritz works here
araraloren nqp: say(1 ~~ /1/);
camelia 1
eno "Too many positionals passed; expected 1 argument but got 2" does anyone know what this error is referring to? 15:09
moritz no 15:10
moritz do you get a backtrace as well? 15:10
araraloren m: sub f($a) { }; f(1, 2);
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling f(Int, Int) will never work with declared signature ($a)
at <tmp>:1
------> 3sub f($a) { }; 7⏏5f(1, 2);
moritz nqp: sub f($a) { }; f(1, 2); 15:10
camelia Too many positionals passed; expected 1 argument but got 2
at <tmp>:1 (<ephemeral file>:f)
from <tmp>:1 (<ephemeral file>:<mainline>)
from gen/moar/stage2/NQPHLL.nqp:1685 (/home/camelia/rakudo-m-inst-1/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/…
araraloren hmm, nice 15:10
so it maybe cause by many problem like this 15:11
eno the weird thing is the error doesn't occur the first time > "hi" ~~ /"hi"/> 1 ~~ /1/Too many positionals passed; expected 1 argument but got 2> "hi" ~~ /"hi"/Too many positionals passed; expected 1 argument but got 2 15:12
moritz oh, so it's a REPL weirdness
eno i should probably upgrade and see if it works 15:13
araraloren I got same problem in REPL 15:14
I think 2018.12 is last release 15:15
eno this is a totally different problem but I can't get nqp (or perl6 to compile) Configuring native build environment ................... trying to compile a simple C program ............... ERROR Can't link simple C program. Failing command: gcc -o try try.o 2>&1 Error: /usr/bin/ld: cannot find crt1.o: No such file or directory/usr/bin/ 15:16
ld: cannot find crti.o: No such file or directorycollect2: error: ld returned 1 exit status
I definately have gcc and ld installed
araraloren night o/ 15:16
moritz eno: crt1.o comes from libc6-dev on my Ubuntu box 15:17
eno libc6-dev is installed 15:18
moritz do you have a /usr/lib/x86_64-linux-gnu/crt1.o ?
eno yep 15:19
I even linked it to /usr/lib 15:20
is moarvm 32bit? 15:22
ah, export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH seemed to do the trick 15:25
daxim is the parser that is called by the rx quotelike user accessible? for example, can I call some code that takes Str('a+') as input and returns a parse-tree [Token => 'a', Kleene-Plus => True] or similar? 15:48
timotimo you can ask EVAL to give you the results of stage "ast" or "optimize", which will be a QAST tree containing, among other things, the regex you've defined there 15:49
daxim do you have a runnable example? 15:50
timotimo m: use MONKEY; say EVAL('rx/a+/', :stage<optimize>).^name 15:51
camelia Regex
timotimo m: use MONKEY; say EVAL('rx/a+/', :target<optimize>).^name
camelia Regex
timotimo hm, which is it
ah, EVAL doesn't take it 15:52
m: use Perl6::Compiler:from<NQP>
camelia ( no output )
timotimo m: use Perl6::Compiler:from<NQP>; Perl6::Compiler.eval('rx/a+/', :target<optimize>).^name.say 15:53
camelia ===SORRY!===
Cannot look up attributes in a Perl6::Compiler type object
timotimo m: use Perl6::Compiler:from<NQP>; Perl6::Compiler.new.eval('rx/a+/', :target<optimize>).^name.say
camelia ===SORRY!===
Unknown compilation target 'optimize'
timotimo m: use Perl6::Compiler:from<NQP>; Perl6::Compiler.new.eval('rx/a+/', :target<ast>).^name.say
camelia ===SORRY!===
Cannot find method 'parse' on object of type NQPMu
timotimo m: use Perl6::Compiler:from<NQP>; Perl6::Compiler.new.stages.say 15:55
camelia (start parse ast mast mbc moar)
cfa m: my $x = rx/a/; my $y = /$x/; say $y; 15:58
camelia /$x/
cfa hmm, in the repl this is fine as a one liner, but if i input `my $y = /$x/;` on its own i get: "Regex object coerced to string (please use .gist or .perl to do that)" 15:59
(even though $y is set to /$x/, not /a/)
cfa is this intended? 16:01
timotimo m: use Perl6::Compiler:from<NQP>; use Perl6::Grammar:from<NQP>; use Perl6::Actions:from<NQP>; my Mu $comp := Perl6::Compiler.new; $comp.parsegrammar(Perl6::Grammar.new); $comp.parseactions(Perl6::Actions.new); $comp.eval("rx/a+/", :target<ast>).^name.say
camelia QAST::CompUnit
timotimo cfa: probably the difference between how "say $a-regex" does it and what the repl printer does 16:02
yes, indeed 16:03
interactive_result is implemented as nqp::say(~$value)
daxim: it's rather wordy, but this is how you would do what i meant
m: use Perl6::Compiler:from<NQP>; use Perl6::Grammar:from<NQP>; use Perl6::Actions:from<NQP>; my Mu $comp := Perl6::Compiler.new; $comp.parsegrammar(Perl6::Grammar.new); $comp.parseactions(Perl6::Actions.new); $comp.eval("rx/a+/", :target<ast>).dump.say 16:04
camelia - QAST::CompUnit :W<?> :UNIT<?> :CAN_LOWER_TOPIC<?>
[pre_deserialize]
- QAST::Stmt
- QAST::Stmt
- QAST::Op(loadbytecode)
- QAST::VM
[moar]
- QAST::SVal(ModuleLoader.moarvm)
cfa timotimo: hmm 16:07
to be clear, here's what i'm seeing: 16:08
> my $x = rx/a/; my $y = /$x/;␤/$x/␤> my $z = /$x/;␤Regex object coerced to string (please use .gist or .perl to do that)␤
i'm not sure i understand why the $y and $z cases there are output differently
timotimo i almost never use the repl, because it has lots of strange behaviour all over the place 16:11
oh
i'm sorry, i didn't look closely enough
cfa np 16:12
timotimo yeah, it is weird that it doesn't complain in the first case
cfa timotimo: but it's not being coerced, is it? 16:14
the warning strikes me as incorrect
i.e., 16:15
m: my $x = rx/abc/; my $y = /$x/; say 'abc' ~~ $y
camelia 「abc」
timotimo ah, i didn't realize we implement that
cfa and from above, 16:15
m: my $x = rx/abc/; my $y = /$x/; say $y;
camelia /$x/
cfa maybe the warning assumes i want $y to be /abc/
the context here is really: 16:16
m: my $x = /abc/; { if /$x/ { say 'yes' } } given 'def'
camelia ( no output )
cfa m: my $x = /abc/; { if /$x/ { say 'yes' } } given 'abc'
camelia yes
daxim these undocumented structures do not look user serviceable, thanks in any case, timotimo++ 16:23
Geth URI-Encode: cfa++ created pull request #11:
use v6.c, bump version number.
16:35
Xliff When I require a module perl6 is reporting "WARNING: unhandled Failure detected in DESTROY.", but when I use that same module, I get no errors. Has this been reported? 19:56
This is currently NOT golfable, at this time./ 19:57
So I am not sure if this is something related to my code or rakudo.
moritz DESTROY behavior depends on GC, and is thus not deterministic
mst right, you can run into similar problems with perl5 during global destruction 19:58
so basically that indicates that the destructor throws an error ... sometimes 19:59
timotimo daxim: as part of the macro work that masak is prototyping in 007, i'd expect QTrees to be a user-facing version that should be much easier to work with, and surely also language-specified rather than implementation-specific 20:07
daxim ok, good to know 20:08
timotimo do you have anything in particular in mind? just curious 20:09
daxim info embargoed until march 20:11
timotimo sounds like a conference :) 20:12
daxim in any case a parser for regex would be useful to have, in p5 land it powers a linter, an optimiser and an explanation tool/translator into english prose
timotimo "parser for regex" in perl6 unfortunately includes "parser for the entire perl6 language braid" :) 20:13
daxim if I need it urgently, I'll make an 80% solution from scratch, can't be too difficult
timotimo you can steal rigurously from the perl6 grammar itself of course :) 20:14
jnthn I did github.com/edumentab/p6-ecma262regex fwiw 20:21
Which has a grammar in it
melezhik going to rewrite Sparrow to 100% Perl6 he-he , last year I tried but was not ready, but now I am ... I'd like to bring all the Sparrow* ecosystem to pure Perl6 ... challenging goal ... but the more I write on Perl6 the more I like it (( 20:32
El_Che melezhik: great news 20:33
what other languages does it use? 20:34
melezhik current Sparrow written on Perl5 ( I mean Sparrow/Outthentic/Outtentic::DSL CPAN modules ) 20:35
El_Che I see, it's been a while since I have used it
(mostly working with containers) 20:36
melezhik I am going to get rid of useless features and rewrite these parts to Perl6 ... because other parts of eco system (Sparky, Tomtit, Sparrowodo) are already in Perl6
El_Che A good sign of the maturity of Perl 6 if you succeed 20:37
be sure to keep a list of problems
and also the good stuff :)
melezhik sure ... will probably start blogs about that or something ... indeed the idea's been keeping bugging me for the last 2 years , finally I decided to start the journey ... ((: 20:39
cpan-p6 New module released to CPAN! META6 (0.0.21) by 03JSTOWE 21:03
Xliff melezhik: Outtentic::DSL? :) 21:56
cpan-p6 New module released to CPAN! JSON-Class (0.0.11) by 03JSTOWE 22:07
zachk are hashes thread-safe in perl6?
melezhik Xliff: Outthentic::DSL I meant 22:13
El_Che zachk: no
melezhik but I am not going to keep it in Perl6 port
only Outthentic itself, which is gonna be a part of Sparrow6 22:14
zachk so i would need to use a lock to safely access one from multiple threads?
El_Che I suspect reading is ok
writing is mostly problematic in most languages I know
zachk: docs.perl6.org/language/concurrenc...y_concerns 22:17
zachk oh ty
El_Che Concurrency safe collections I have seen in other languages bring the programs to a halt almost and hence not that useful 22:18
El_Che better lock what you need or rethink your datastructures 22:18
e.g. Channels may be handy in some cases 22:19
Kaypie bit of a dumb question, but if you use Supply.act do you still need to make sure state is threadsafe with locks or semaphores? 23:53
Kaiepi bit of a dumb question, but if i use Supply.act do i still need to make sure my code is threadsafe? 23:57
since it's only running on one thread at a time
i ran into a deadlock in my telnet library i can't do anything about 23:58
jnthn Kaiepi: Actually supplies are always one message at a time these days, so unless you somehow create a non-serial Supply (which you really have to go out of your way to do) then .act is just like .tap. But yeah, it's one message at a time
Kaiepi oh ok 23:59
thanks