»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, std:, or /msg camelia p6: ... | irclog: irc.perl6.org | UTF-8 is our friend!
Set by moritz on 25 December 2014.
raydiak s/supported/less-committal-sounding-word/ :) 00:00
00:04 jack_rabbit joined 00:10 raiph joined 00:13 kjs_ left 00:15 hekmek joined 00:19 spider-mario left 00:28 jack_rabbit left
FROGGS_ .tell moritz I updated rakudo.org/ 00:28
+yoleaux FROGGS_: I'll pass your message to moritz.
FROGGS_ gnight
00:39 jack_rabbit joined 00:53 Tideflat joined 01:04 bjz left 01:06 bjz joined 01:09 pmurias left 01:11 bjz left
vendethiel "perl6 is like all the cool shit I ever wanted, but felt too dirty to ask, all packaged in one language" 01:12
01:14 raiph left 01:16 bjz joined 01:17 jack_rabbit left 01:20 kjs_ joined 01:22 Tideflat left 01:23 kjs_ left, kjs_ joined, hekmek left 01:26 bjz left, kjs_ left 01:28 risou is now known as risou_awy 01:42 jack_rabbit joined 01:51 bjz joined 02:01 jack_rabbit left 02:20 rmgk_ joined, rmgk left, rmgk_ is now known as rmgk 02:27 bjz left 02:31 Mso150_m left, bjz joined, Mso150_m joined 02:50 Tideflat joined 03:01 isBEKaml left 03:28 aborazmeh joined 03:43 kaare_ joined 03:46 Akagi201_ joined 03:47 Akagi201 left 03:48 noganex_ joined 03:52 noganex left 04:01 bjz left 04:05 Tideflat left
+dalek kudo/nom: 7ea485c | TimToady++ | src/core/array_slice.pm:
allow @a[0,2...*] to work again
04:13
ast: fe6352e | TimToady++ | S09-subscript/slice.t:
add tests for infinite sequence subscripts
04:15
04:19 gfldex left
TimToady .tell grondilu @a[0,2...*] works again in the latest rakudo 04:24
+yoleaux TimToady: I'll pass your message to grondilu.
04:37 vendethiel left 04:39 vendethiel joined
moritz found out why Digest::MD5 is broken on r-j 04:41
+yoleaux 00:28Z <FROGGS_> moritz: I updated rakudo.org/
moritz perl6-j -e 'my \T = ($_ for ^2); say T' # produces Nil, should not 04:42
04:55 Mso150_m left
ugexe_ m: my $anonfactorial = -> Int $n { $n < 2 ?? 1 !! $n * &?BLOCK($n-1) }; # roast / S02-magicals / block.t 04:55
+camelia rakudo-moar 32c6e4: OUTPUT«===SORRY!=== Error while compiling /tmp/HQydlH12HO␤Undeclared routine:␤ &?BLOCK used at line 1␤␤»
ugexe_ did that used to work? 04:56
04:56 Mso150_m joined 04:57 isBEKaml joined
TimToady not that I know of 05:02
05:02 adu joined
moritz $ git grep '&?BLOCK' 05:03
src/core/Label.pm: # XXX Register in &?BLOCK.labels when we have &?BLOCK.
off to sleepa again&
05:07 bjz joined, Mso150_m_e joined, Mso150_m left 05:15 mr-foobar left 05:21 vendethiel left 05:22 vendethiel joined 05:41 aborazmeh left
hoelzro hey Perl 6 folk; just wanted to spread the word that I've updated the Docker image I've been maintaining for Rakudo * to 2014.12: registry.hub.docker.com/u/hoelzro/rakudo-star/ 05:45
05:46 isBEKaml left
adu hoelzro: nice 05:52
I don't understand docket 05:53
docker
05:56 Mso150_m_e left 06:00 Mso150 joined
JimmyZ adu: github.com/dokku-alt/dokku-alt 06:06
it's very easy
Timbus before i set out on my quest in the completely wrong direction I should ask here: should I try implementing sockets via NativeCall, or should I just extend nqp's already existing socket ops? 06:07
JimmyZ I'd + 1 to the later 06:08
06:09 bjz left 06:10 BenGoldberg left
Timbus so, extend the nqp ops? alright 06:11
06:15 vendethiel left 06:17 vendethiel joined
adu JimmyZ: what's paas? 06:22
is it a VM? 06:23
JimmyZ consider it's a vm 06:24
Timbus: yeah, esp async sockect 06:25
adu but I don't understand why Docker has to be linux on linux, why can't I do freebsd on linux, or linux on macosx
Timbus JimmyZ, isnt that just regular sockets still? i was thinking I could just rewrite Socket::INET to return a standrd looking IO handle, and then we could work on an async wrapper for all handles 06:27
JimmyZ async has a eventloop 06:28
raydiak adu: b/c as I understand it, it's more like a bsd jail than a vm
Timbus unless we for some reason need epoll support or something?
raydiak adu: wikipedia says: Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting virtual machines. 06:29
geekosaur so indeed, it's just bsd jails for linux 06:30
raydiak also says something about "additional layer of abstraction and automation" 06:32
adu raydiak: ok, so what are "containers" used for aside from Docker?
it just sounds like docker is the reason for containers, and containers are the reason for docker... but what advantage is there over, say, using apt-get 06:34
geekosaur "container" is kinda a generic term, referring to a general isolation mechanism present in various forms on various OSes
the key word there being "isolation"
raydiak I think they are mainly used for ease of deployment and isolation purposes, I'd guess
basically you would use this where you might otherwise use a vm, but want something which is a much lighter and more performant 06:35
geekosaur if I run something in a container which becomes infected with malware, it is at least more difficult for it to leak out and affect the host or other containers (how much more difficult depends on the level of isolation, which in turn may depend on what bugs are in the isolation mechanism)
06:38 vendethiel left
raydiak oh yeah security...might be cool if someone made something like qubes os but based on Docker instead of Xen 06:39
geekosaur another use on linux is that even with tools like alien you can't reliably install an rpm on debian or a deb on fedora... but you can run the appropriate distribution in a docker container with little performance penalty and install it there 06:41
geekosaur admits that he mostly considers docker to be a lot of hype, considering that it's what IBM has been doing since the 70s, BSD since the 90s, and Solaris for a decade or so... 06:45
06:48 mephinet left 07:15 mephinet joined 07:17 telex left 07:18 telex joined 07:22 szabgab joined, virtualsue joined
szabgab hi, I was just wondering where should I file bugs I encounter with Rakudo Star? Is sending them to rakudobug@perl.org the best way or shall I put them in GitHub Issues? 07:23
07:24 [TuxCM] left, vendethiel joined
JimmyZ szabgab: depends on whether it's a module or not 07:26
07:26 lue left
szabgab 1) p6doc not working 07:26
2) Some installation error
JimmyZ szabgab: if it's core rakudo bug, that's the former, other put it in related github repo issues 07:27
szabgab 3) -v giving slightly incorrect
ok
07:30 lue joined, gfldex joined 07:33 denis_boyun joined, szabgab left, pyrimidine left 07:34 denis_boyun left, pyrimidine joined 07:36 denis_boyun joined, [TuxCM] joined, denis_boyun left 07:39 denis_boyun_ joined 07:48 vendethiel left 07:52 denis_boyun_ left 07:55 darutoko joined 07:58 szabgab joined, szabgab left
mathw m: sub foo(Str | Int $x) { 'hi'; } foo(4); 08:03
+camelia rakudo-moar 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/MnT0VZW7oV␤Missing block␤at /tmp/MnT0VZW7oV:1␤------> sub foo(Str | ⏏Int $x) { 'hi'; } foo(4);␤»
mathw Does that not work anymore? 08:04
JimmyZ Did it work? 08:08
08:08 sergot_ joined
mathw I'm sure it was supposed to work 08:08
once
maybe it never has
JimmyZ look like we don't have a test?
mathw not sure if it's still meant to at some point
08:09 sergot left
JimmyZ m: sub foo($x where Str | Int) { 'hi'; }; foo(4); 08:09
+camelia ( no output )
JimmyZ m: sub(Str | Int $x) { 'hi'; }; foo(4); 08:10
+camelia rakudo-moar 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/EobF_5qJew␤Unable to parse expression in argument list; couldn't find final ')' ␤at /tmp/EobF_5qJew:1␤------> sub(Str | Int ⏏$x) { 'hi'; }; foo(4);␤ expecting any of:…»
mathw ooh
JimmyZ m: sub foo(Str | Int $x) { 'hi'; }; foo(4);
+camelia rakudo-moar 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/3mkeWTpkWO␤Missing block␤at /tmp/3mkeWTpkWO:1␤------> sub foo(Str | ⏏Int $x) { 'hi'; }; foo(4);␤»
JimmyZ std: sub foo(Str | Int $x) { 'hi'; }; foo(4);
+camelia std 76ccee1: OUTPUT«===SORRY!===␤Unable to parse signature at /tmp/jU41eJMQNy line 1:␤------> sub foo⏏(Str | Int $x) { 'hi'; }; foo(4);␤Couldn't find final ')'; gave up at /tmp/jU41eJMQNy line 1:␤------> sub foo(Str | ⏏…»
08:11 mickcy_ca joined
mathw perhaps telling that the only refrence I can find to that kind of functionality is on the Wikipedia page 08:11
mickcy_ca Is there anyone online right now who has any experience with NativeCall? 08:12
Timbus if there was, what would you ask
mickcy_ca I have been investigating the possibility of writing a socket driver for Perl 6 and am wondering if I need to handle the library includes or are they magically detected. 08:14
Timbus what a coincidence
i was just looking into doing that 08:15
mickcy_ca Two heads are better than one ... what have you found?
Timbus well, I was actually looking into implementing the core sockets routines in the VM instead and providing nqp function calls to access them 08:16
since we already have a few of those
mickcy_ca That would definitely be a better solution than going the module route.
08:17 virtualsue left
mickcy_ca Unfortunately, I have no experience with MoarVM or NQP ... but I could be a fervent tester. 08:18
Timbus well nativecall wouldnt be too bad, probably easier to maintain. but yeah might as well build on what we have 08:20
08:20 virtualsue joined
Timbus also: im not an expert at all, but I'm going to try anyway :o) 08:20
mathw a NativeCall-based module wouldn't work too well for people running on the JVM probably
the long-term better solution is to have the VM do the work 08:21
08:21 adu left
Timbus yea 08:21
mathw that doesn't mean you couldn't write a NativeCall module for what you need right now of course
mickcy_ca Of course ...
Back to my original question ... do I have to handle the include somelibrary.h or does the VM, Perl 6, or NativeCall do some magical thing to detect which library needs to be included? 08:23
Timbus there is no header
uh. that is to say, you don't have to use the header, and more correctly cannot use the header 08:24
mickcy_ca And while the perl6 advent is quite informative, it is quite thin on that issue.
08:24 virtualsue left
Timbus you simply choose the library and declare the function signatures in it. any constants/macros etc you will need to also manually add in 08:25
mickcy_ca If I understand that correctly, I take the header, parse out the function calls, then implement all of the accessors in Perl 6. 08:26
Timbus yes 08:27
mickcy_ca Or at least the function calls that I choose to implement.
Timbus or write a header2six script and be a hero for everyone :^)
mickcy_ca That would certainly stretch my abilities. 08:28
Timbus i think that was attempted in the past, but maybe for parrot
08:28 vendethiel joined
JimmyZ any C expert? how can I pre-define a array? like static int array[]; ..... ; static int array[] = { .... }; 08:33
Timbus int[] array = { } 08:34
wait no
you had it
08:38 virtualsue joined
Timbus JimmyZ, ` const int a[] = {5,6,7}; ` works for me and compiles with c89 in pedantic mode. is there something I missed? 08:42
08:42 rurban joined
JimmyZ Timbus: I want to prefine it , without init 08:43
static int array[]; void func() { use array; }; static int array[] = { ... } 08:44
mickcy_ca on the header side of things ... anyone know where get socket.h 08:45
Timbus oooh you mean like predeclare
/usr/include/sys/socket.h
on linux
mickcy_ca Not there.
08:45 adu joined
mickcy_ca As in tried that as did not find it. 08:45
Timbus er, hm. which distro 08:46
mickcy_ca Ubuntu 14.10 Gnome.
Timbus im in 14.04. have you installed the compiler libs 08:47
build-essential i believe? 08:48
mickcy_ca As far as a header parser ... do you mean walking all dependancies as well?
I have build-essential already installed ... looking into other build* 08:49
Timbus wow. if you really want to try it, just start as simple as you can imo.
whats in /usr/include/x86_64-linux-gnu/sys/ 08:50
mickcy_ca That is where it is. 08:51
Timbus /usr/include/sys/socket.h: symbolic link to `../x86_64-linux-gnu/sys/socket.h' 08:52
odd you dont have that =/
mickcy_ca Checking ...
I have /usr/include/sys but only asoundlib.h lives there right now. 08:53
08:55 vendethiel left
Timbus ¯\(°_o)/¯ 08:56
mickcy_ca As simple as possible ... use a grammar to parse the file ...
That is the obvious route with Perl 6 ... but what form should the output take for the greatest usability? 08:58
09:01 vendethiel joined
Timbus JimmyZ, i managed to make it not complain if you use extern 09:01
C99 also seems to allow it how you wrote it, but it complains (but still works). 09:02
JimmyZ But I want to use static ...
Timbus will extern make it static? :/ 09:03
JimmyZ no, extern will make it global
:(
Timbus ive tried like every combination haha. can't do it. it needs a size or extern 09:07
or c99 with pedantic off
:[
mickcy_ca Timbus: do you have any suggestions for *.h processing output, or perhaps the final target should be a Perl 6 class. 09:11
09:11 kjs_ joined
mickcy_ca That is a fully functional wrapper. 09:11
Maybe not as a class, but as as role.
Can you do role Header dose Other_header { .. }+ 09:13
dose .... does.
Timbus a fully functional wrapper would be a very large task. id start with a simple translator that can just try pulling out #define'd consts and function defs 09:14
and see what you can add on from there. maybe structs and such
mickcy_ca I am aware ... I just like to have my end goal formulated prior to starting, so that I tend to make better choices early on and mitigate the effect on some new data that I become aware of. 09:15
That is how I would start ... definitely. 09:16
Timbus hmm. i think just a module filled with functions and consts is the best result you could ask for. adding roles and classes seems like something youd do manually 09:19
the d language had a htod binary that would do that, and also turn macros into functions 09:20
mickcy_ca To make it the most useful, would not the final target best be a fully functional wrapper implemented as a role? 09:21
That is, especially if dependencies need to be observed.
09:22 ptc_p6 joined
Timbus ive never thought of a collection of c functions as roles... roles are reused code, sure, but are generally attached to an object? 09:22
09:23 araujo left
mickcy_ca I was more of thinking of exposing a header file to an application programmer without the requirements if inheritance, but thinking a little further on, perhaps a wrapper class would be better. Use the inheritance model to handle dependencies. 09:25
09:25 araujo joined
mickcy_ca Of course, in the far future. 09:25
Timbus dont forget you dont need the dependencies of a library resolved.. the library is going to do all that. if the header is supposed to import a whole load of other function defs from other headers though, you can certainly just have the module 'use' the other modules 09:27
mickcy_ca And just because a C programmer does not view the C functions as an OO concept, that doesn't mean that a Perl 6 programmer could not use an encapsulated version in an OO fasion. 09:28
Timbus well, yeah. namespaces are important 09:30
im surprised youre taking my offhand suggestion so seriously
mickcy_ca Why so surprised ... a good idea is as good idea no matter what the source.
09:41 kjs_ left 09:42 kjs_ joined 09:43 makapa joined 09:46 hekmek joined 09:47 [TuxCM] left 09:51 rurban left 09:52 xfix joined 09:53 [TuxCM] joined 09:56 adu left
mickcy_ca Does anybody have an idea why: 09:59
token function { extern \s+ ( \w+ ) \s+ ( \w+ ) \s* ('('.+?')') [\s* (.*?)]?';' } 10:00
Doesn't match
extern int socket (int __domain, int __type, int __protocol) __THROW;
When I don't include the ';' in the match, it works mostly as I want it to. 10:01
Timbus spaces are significant in token
or.. i thought so
mickcy_ca This matches 10:02
token function { extern \s+ ( \w+ ) \s+ ( \w+ ) \s* ('('.+?')') [\s* (.*?)]? }
Timbus okay, thats rule with sigspace then
my bad. 10:03
mickcy_ca Yup.
Timbus i shoulda read your whole question :p
mickcy_ca I am just confused why attempting to match the trailing semicolon to exclude it causes the whole expression to fail. 10:04
Timbus ah 10:05
its not matching __THROW at all
mickcy_ca my bad ... this is what matches 10:06
10:06 vendethiel left
Timbus but its optional so it doesnt care. but then it wont match the required ; 10:06
mickcy_ca token function { extern \s+ ( \w+ ) \s+ ( \w+ ) \s* ('('.+?')') [\s* (.*)]? }
Timbus in that case, the last match is eating the ; 10:07
10:08 vendethiel joined
mickcy_ca I am aware ... but putting (.*?) or (.+?) in the last position causes it to fail. 10:08
Timbus use.. uhh however you do 'not ;' 10:09
<-[;]> or something D;
mickcy_ca ';' is doing 'not ;' ?
10:10 kjs_ left
Timbus no, thats what you want.. 10:10
10:12 makapa left
Timbus man its hard to search the synopsis for what i want. you basically want to explicitly not capture the last ';' inside the (.*), in perl 5 id use [^;] 10:13
10:14 kjs_ joined
mickcy_ca I saw how to do that someplace ... 10:14
Timbus extern \s+ ( \w+ ) \s+ ( \w+ ) \s* ('('.+?')') [\s* (<-[;]>+)]?';' 10:15
10:16 kjs_ left
mickcy_ca Thanks ... was pulling my hair out doing that. 10:16
Timbus which you could easily simplify?
10:16 ptc_p6 left
Timbus extern \s+ ( \w+ ) \s+ ( \w+ ) \s* ('('.+?')') (<-[;]>*) ';' 10:16
mickcy_ca I want not to need to strip any leading whitespace later. 10:17
10:19 molaf joined
Timbus put a \s* back in there i guess 10:19
mickcy_ca That works ... and still matches both cases. 10:20
Timbus ooh. youll need a plus after the negative character class, or youll match a zero-width nothing 10:22
extern \s+ ( \w+ ) \s+ ( \w+ ) \s* ('('.+?')') (<-[;]>+) ';'
10:22 masakq joined
masakq good antenoon, #perl6 10:22
10:22 spider-mario joined
Timbus thats just a copy paste, forgot to add the extra \s 10:23
helo masakq
10:27 Sir_Ragnarok left
Timbus mickcy_ca, ack i forgot to add-- here ill just paste it from my repl: extern \s+ ( \w+ ) \s+ ( \w+ ) \s* ('('.+?')') \s* (<-[;]>+)? ';' 10:27
masakq Timbus: without having any context really, I strongly suspect you want to (a) test your regexes, and (b) use 'rule' in a few places where you're currently using 'regex' or 'token'. 10:31
Timbus not mine :P
mickcy_ca masakq: just getting support for mine. 10:33
masakq: I am attempting to put together a grammar that will eventually fully parse a C header file. 10:34
See my gist at pastebin.com/PwMpwf7W 10:36
masakq looks
mickcy_ca The function token will eventually be a rule in order to parse it fully.
masakq right. those tokens there probably want to be rules. 10:37
and you probably want to write tests with succeeding and failing inputs.
gotta go.
10:37 masakq left 10:39 vendethiel- joined, vendethiel left 10:55 ptc_p6 joined 10:57 bjz joined 11:01 hekmek left 11:03 rindolf joined
+dalek frastructure-doc: 6f589e5 | (Konrad Borowski)++ | hosts/hack.p6c.org.pod:
Move rakudobrew out of Administration section.

Rakudobrew is available for users, it's not something that only administrators have access to (unlike adding new users and restarting
  dalek IRC bot).
11:05
11:10 vendethiel joined, vendethiel- left
+dalek frastructure-doc: 416882e | (Konrad Borowski)++ | hosts/hack.p6c.org.pod:
Move External Services into Administration section

Services in this section are pretty much global configuration (the user normally shouldn't need to override stuff like DNS or NTP), and the mirror only contains the repositories for various GNU/Linux distributions.
11:10
mickcy_ca Anybody want to comment on : pastebin.com/UtuCjFSY 11:13
xfix It probably needs to parse more in order to parse complete C header files :-). 11:14
mickcy_ca, but neat.
mickcy_ca, also, it's worth noting that variable names are optional in definitions. 11:17
mickcy_ca xfix: I am not sure if order of rules / tokens / regex's is actually important to the parse. This is designed to match on a line by line basis ... Would like to extend it to just eat an entire file to get what I want, but not sure how to do that yet.
xfix And extern is optional.
int socket(int, int, int); /* Valid function definition */ 11:18
11:18 araujo left
mickcy_ca I am aware that programming C extern is optional, but is it if the sub is getting exported by a library? 11:18
11:19 bjz_ joined
xfix The issue with parsing line-by-line is that sometimes those definitions have multiple lines. 11:19
For example, definition of fprintf from stdio.h.
extern int fprintf (FILE *__restrict __stream,
const char *__restrict __format, ...);
mickcy_ca OK ... this brings me back to how to get a grammar to eat an entire file.
moritz TheGrammar.parsefile($filename) 11:21
11:21 bjz left
xfix Parsing entire header file would be neat, but I'm also not sure if it's feasible. 11:22
(perhaps Clang has API for that, I don't kknow)
mickcy_ca xfix: If Perl 6 can parse itself with a grammar ... a header file, which is orders of magnitude simpler, is more than possible. 11:23
xfix Yes, okay.
mickcy_ca When is Clang usually online? 11:24
moritz clang.llvm.org/ 11:25
mickcy_ca lol, my mistake.
Thanks.
xfix It would be neat if Rakudo supported uint types. 11:26
mickcy_ca It would be ... what is the definition of uint? 11:27
xfix Unsigned.
uint8 -> unsigned char (assuming that bytes are 8-bit, which is an assumption that Zavolaj appears to do)
Although lack of unsigned types in JVM may make it more tricky. 11:28
r: 1/0 11:29
mickcy_ca Curios ... aside from the ability to store larger integers ... why uint?
+camelia ( no output )
xfix mickcy_ca, to make use of APIs that accept/return uint.
(although, I guess that int is close enough, as long the value is not huge enough) 11:30
mickcy_ca xfix: Could one not just define that data type at run time?
xfix unsigned int some_c_function(unsigned int something)
11:31 Sir_Ragnarok joined
xfix en.wikipedia.org/wiki/Criticism_of...eger_types 11:31
mickcy_ca Anyway ... gotta go to bed ... 04:30 where I am.
xfix "and the lack of these types prevents direct data interchange between C and Java" 11:32
This is why I want uint. Just for data interchange between C and Perl 6.
mickcy_ca Makes sens ...
xfix Also, bitwise operations are more convenient with unsigned types.
mickcy_ca See can't even type ...
Ok. 11:33
Good night ... logging off
11:33 mickcy_ca left, pecastro joined 11:40 rurban joined 11:43 bjz_ left, bjz joined 11:50 zakharyas joined 11:51 rurban1 joined, rurban1 left 12:00 kjs_ joined 12:10 Alina-malina left 12:11 Alina-malina joined
vendethiel m: sub q($x --> Bool) {} 12:12
+camelia ( no output )
vendethiel m: sub q($x --> Bool) { return 3 }
+camelia ( no output )
+dalek href="https://perl6.org:">perl6.org: 9194bca | moritz++ | source/documentation/index.html:
Label Synopsis also als Design Documents
12:17
12:20 spider-mario left 12:24 spider-mario joined 12:26 isBEKaml joined
+dalek rakudo/newio: 27a9887 | usev6++ | src/Perl6/Grammar.nqp: 12:26
rakudo/newio: Allow postfix operator called as method after unary postfix hyper operator
rakudo/newio:
rakudo/newio: currently something like '(my @a = 1)>>.++' fails, since METAOP_HYPER_CALL is called
rakudo/newio: instead of METAOP_HYPER_POSTFIX. Fixes RT #122342.
12:26 dalek left
synopsebot Link: rt.perl.org/rt3//Public/Bug/Displa...?id=122342 12:26
12:27 dalek joined, ChanServ sets mode: +v dalek, Mso150 left
+dalek c: 1b00933 | moritz++ | lib/HomePage.pod:
Link to perl6.org/documentation

  ... which in turn links to learnxinyminutes and other resources,
thus closing #26.
Also change the perlcabal.org link to design.perl6.org
12:27
12:29 hekmek joined 12:33 psch joined, dakkar joined
psch hi #perl6 \o 12:33
12:43 Rounin joined 12:44 zakharyas left 12:45 kjs_ left 12:46 a3gis joined
a3gis hello! total newbie to p6 here; could someone tell me what "$^0" does? it seems to return one((Any), 0) 12:47
I was expecting it to behave like a positional argument ($^a, $^b, ...)
psch m: { say $^0 }("foo") 12:48
+camelia rakudo-moar 7ea485: OUTPUT«one((Any), 0)␤»
lizmat m: say $ ^ 0 12:49
+camelia rakudo-moar 7ea485: OUTPUT«one((Any), 0)␤»
a3gis ooh 12:50
psch i suppose that's implicit state and EXPR somehow
a3gis so it behaves like an infix
lizmat ^ = junctive or
$ is unnamed scalar
a3gis alright, makes sense
thanks :)
psch no idea if we want to allow it as placeholder, considering $42 is designed to work
m: my $42 = 42; say $42
+camelia rakudo-moar 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/1lt5pAiIlg␤Cannot declare a numeric variable␤at /tmp/1lt5pAiIlg:1␤------> my $42⏏ = 42; say $42␤»
psch ahh
no, design is out of date it seems :)
wait 12:51
$\d+ is match captures
i'm not awake yet :)
lizmat feels we should probably disallow $^\d+ without whitespace 12:52
12:52 Theo_ joined
lizmat to prevent conceptual confusion with $^a 12:52
errands&
vendethiel m: say $^0.perl # wtf is that? 12:54
+camelia rakudo-moar 7ea485: OUTPUT«one((Any), 0)␤»
12:54 LLamaRider joined
vendethiel oh, a3gis asked already 12:55
12:56 kjs_ joined
itz events.ccc.de/congress/2014/Fahrpl...ule/0.html 12:56
(OT for perl6 but maybe of interest)
dakkar what's the p6 idiomatic signature for a sub that accepts a string or undef? (single positional parameter) 12:57
vendethiel m: *.say for ^10
+camelia rakudo-moar 7ea485: OUTPUT«===SORRY!===␤P6opaque: no such attribute '$!phasers'␤»
vendethiel ^ seems pretty LTA
psch dakkar: depends on how you want it. you could give it a default value or declare multis 12:59
dakkar: or just put it optional
vendethiel $version.split('.').map({any(@els[0..(state $)++]) ?? ( (state $)++ ?? 0 !! $_ + 1 ) !! $_}).join('.') <- so now, I can remove the "(state)" part?
dakkar psch: in p5 I have sub foo { my ($arg)=@_; return '' unless defined $arg; do_stuff }
that looks like a multi, then. 13:00
what the signature to bind to undef? sub foo(undef) ?
no
vendethiel waves at a3gis :P 13:02
psch m: multi foo(Str:U $x) { say "undef" }; multi foo(Str:D $x) { say "$x" }; my Str $x = "foo"; foo $x; $x = Nil; foo $x # dakkar 13:04
+camelia rakudo-moar 7ea485: OUTPUT«foo␤undef␤»
dakkar ah! thank you. where is it in the synopses? I've looking for a while
psch S12/Abstract vs Concrete types 13:05
S12:Abstract vs Concrete types
synopsebot Link: perlcabal.org/syn/S12.html#Abstract...rete_types
dakkar grr. I was looking at the sub/signature syn
vendethiel moritz++
13:06 isBEKaml_ joined 13:08 tinyblak joined 13:09 isBEKaml left
psch vendethiel: i think so. there was a change somewhen about having bare '$' mean 'state $' somewhen... 13:16
vendethiel psch: yes 13:17
psch s:2nd/somewhen//
vendethiel psch: I've made the change anyhow :)
psch vendethiel: as for the WhateverCode iteration, that breaks in the optimizer. from the looks of it optimize_for_range expects a proper block and can't deal with a WhateverCode 13:18
lizmat is testing a fix 13:19
+dalek kudo/nom: c5e7a77 | lizmat++ | src/Perl6/Optimizer.nqp:
Protect range optimizer from not having a block

Fixes the LTA error vendethiel++ found: *.say for ^10
13:20
lizmat really errands&
vendethiel lizmat++ !
psch lizmat++ 13:21
+dalek c: 21e20c1 | moritz++ | lib/ (2 files):
Document mkdir as requested in #33 and §34

also try to make $*CWD better findable
13:22
13:23 sergot_ is now known as sergot 13:25 isBEKaml_ is now known as isBEKaml, isBEKaml left, isBEKaml joined
psch m: :2() # RT #112728 13:29
synopsebot Link: rt.perl.org/rt3//Public/Bug/Displa...?id=112728
+camelia rakudo-moar 7ea485: OUTPUT«You have confused the number with the textual representation "";␤if you wanted to render the number in the given base, use $number.base($radix)␤ in block <unit> at /tmp/na_4apNiYp:1␤␤»
psch std: :2()
+camelia std 76ccee1: OUTPUT«ok 00:00 136m␤»
13:33 vendethiel- joined 13:34 vendethiel left
hahainternet that is nearly a fantastic error message 13:45
although it is a bit anti DWIM
psch std: my $a; { $^a } # my favorite error to date 13:48
+camelia std 76ccee1: OUTPUT«ok 00:00 137m␤»
psch :/ 13:49
i forgot
xfix This is not an error.
psch oh right
std: { my $a; $^a } 13:50
+camelia std 76ccee1: OUTPUT«===SORRY!===␤$a has already been used as a non-placeholder in the surrounding block,␤ so you will confuse the reader if you suddenly declare $^a here at /tmp/ZZ3HHOBrqD line 1:␤------> { my $a; ⏏$^a }␤Potential diff…»
psch that's it :P
xfix (although, a point can be made in that Perl 6 should allow the user to confuse people who will maintain the code) 13:51
psch std: { $^a; $a } 13:52
+camelia std 76ccee1: OUTPUT«ok 00:00 136m␤»
psch that's what makes the error good there IMO 13:53
xfix My favorite error is something else.
r: promptt "What's your name? "
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
..rakudo-moar 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Undeclared routine:␤ promptt used at line 1. Did you mean 'prompt'?␤␤»
xfix (hm... and Parrot complains about ICU... this is not what I wanted)
"Did you mean 'prompt'?"
It tells you what you may have expected, but at the same time, it doesn't automatically replace (DWIM is not always good). 13:54
psch yeah, the levenshtein stuff in the Actions is great. timotimo++ iirc
xfix p: 1 13:58
+camelia ( no output )
xfix p: deqwuinfdigner
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/naVGGunoku␤Undeclared routine:␤ deqwuinfdigner used at line 1␤␤»
xfix Hm, and now it complains about undeclared routine.
p: promptt
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
xfix Interesting. 13:59
psch p: ssay
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/0Hj6dbg2WS␤Undeclared routine:␤ ssay used at line 1. Did you mean 'say'?␤␤»
psch p: prampt
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/56ma3UMFE0␤Undeclared routine:␤ prampt used at line 1. Did you mean 'prompt'?␤␤»
xfix Oh well, it's probably better to enable ICU, but why it complains on promptt when it doesn't on prampt. 14:00
psch p: promptd
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
psch huh 14:01
xfix r: say $*VM.config<has_icu>
+camelia rakudo-moar 7ea485: OUTPUT«(Any)␤»
..rakudo-parrot 7ea485: OUTPUT«0␤»
14:02 aborazmeh joined
psch p: sayz 14:03
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/CSzNv34T75␤Undeclared routine:␤ sayz used at line 1. Did you mean 'say'?␤␤»
psch i don't think i want to build parrot to look at that :) 14:04
xfix moritz, can you install libicu-dev on host08.perl6.com? 14:05
But ICU aside... why this only happens only sometimes? 14:07
xfix checks
psch p: prompt
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/eUnYe9MELe␤Calling 'prompt' requires arguments (if you meant to operate on $_, please use .prompt or use an explicit invocant or argument)␤ Expected: :(Any $msg)␤at /tmp/eUnYe9MELe:1␤--…»
14:07 LLamaRider left
psch p: prompt "foo" 14:07
+camelia rakudo-parrot 7ea485: OUTPUT«foo»
psch xfix++
xfix First of all, this error comes from Parrot VM. 14:08
When is unicode_compose called... 14:09
p: sayd 14:10
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/xBWlxGbQO5␤Undeclared routine:␤ sayd used at line 1. Did you mean 'say'?␤␤»
xfix p: promptq
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
xfix p: prompq
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/OiQDv9aROO␤Undeclared routine:␤ prompq used at line 1. Did you mean 'prompt'?␤␤»
xfix p: prompqq
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
xfix p: sub long-method-name { }; long-method-named 14:11
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/c_AQcHrpZP␤Undeclared routine:␤ long-method-named used at line 1. Did you mean 'long-method-name'?␤␤»
xfix p: sub oeinor { }; oeinorr 14:12
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
xfix p: sub oeinorq { }; oeinorqr
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
xfix p: sub oeinorqrdse { }; oeinorqrdser
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!===␤no ICU lib loaded␤»
xfix p: sub oeinorqrdsezxcv { }; oeinorqrdsezxcvr
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/NkZaLcZxLF␤Undeclared routine:␤ oeinorqrdsezxcvr used at line 1. Did you mean 'oeinorqrdsezxcv'?␤␤»
xfix p: sub oeinorqrdsezx { }; oeinorqrdsezxr
+camelia rakudo-parrot 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/8_NDdoKu8c␤Undeclared routine:␤ oeinorqrdsezxr used at line 1. Did you mean 'oeinorqrdsezx'?␤␤»
xfix Ok, this is crazy.
It feels so arbitrary.
Pretty sure levenshtein is related, but... 14:13
14:14 kjs_ left
dakkar what am I doing wrong? «my ($key,$value) = @($string ~~ m{^ (\w+) '=' (.*) $}) or My::Exception.new.throw» 14:14
when the $string does not contain a '=', the exception is not thrown… 14:15
psch m: say "a" ~~ /b/ or die "foo"
+camelia rakudo-moar 7ea485: OUTPUT«Nil␤»
psch m: say "a" ~~ /b/ // die "foo"
+camelia rakudo-moar 7ea485: OUTPUT«foo␤ in block <unit> at /tmp/KenssRjaSw:1␤␤»
psch dakkar: "or" is truthy, not defined-y
xfix r: my ($key,$value) = @($string ~~ m{^ (\w+) '=' (.*) $}) or My::Exception.new.throw 14:16
+camelia rakudo-{parrot,moar} 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Variable '$string' is not declared␤at /tmp/tmpfile:1␤------> my ($key,$value) = @($string⏏ ~~ m{^ (\w+) '=' (.*) $}) or My::Except␤ expecting any of:…»
dakkar and a match is always true? even when it does not match?
xfix r: my ($key,$value) = @("abcd" ~~ m{^ (\w+) '=' (.*) $}) or My::Exception.new.throw
+camelia ( no output )
xfix r: my ($key,$value) = @("abcd" ~~ m{^ (\w+) '=' (.*) $}); print ($key, $value).perl;
psch m: say Nil or "foo"
+camelia rakudo-{parrot,moar} 7ea485: OUTPUT«(Bool::False, Any)»
rakudo-moar 7ea485: OUTPUT«Nil␤»
psch m: say so Nil
+camelia rakudo-moar 7ea485: OUTPUT«False␤»
xfix r: print (my ($key,$value) = @("abcd" ~~ m{^ (\w+) '=' (.*) $})).say;
+camelia rakudo-{parrot,moar} 7ea485: OUTPUT«False (Any)␤True»
xfix r: print (my ($key,$value) = @("abcd" ~~ m{^ (\w+) '=' (.*) $})).perl.say; 14:17
+camelia rakudo-{parrot,moar} 7ea485: OUTPUT«(Bool::False, Any)␤True»
14:17 kjs_ joined
xfix r: print (so(my ($key,$value) = @("abcd" ~~ m{^ (\w+) '=' (.*) $}))).perl.say; 14:17
+camelia rakudo-{parrot,moar} 7ea485: OUTPUT«Bool::True␤True»
xfix Ok, so my ($key, $value) converts False into (False, Any).
(False, Any) is True.
Hm...
dakkar oh ffs
xfix r: (my ($key,$value) = Nil).perl.say;
+camelia rakudo-{parrot,moar} 7ea485: OUTPUT«(Any, Any)␤»
xfix It's silly... 14:18
dakkar a non-matching match in list context is not very false, then :/
xfix r: (so (my ($key,$value) = Nil)).perl.say;
+camelia rakudo-{parrot,moar} 7ea485: OUTPUT«Bool::True␤»
xfix Ok, why Nil is true? 14:19
n: (so (my ($key,$value) = Nil)).perl.say;
+camelia niecza v24-109-g48a8de3: OUTPUT«Potential difficulties:␤ $key is declared but not used at /tmp/LOJbZOAt7O line 1:␤------> (so (my ⏏($key,$value) = Nil)).perl.say;␤ $value is declared but not used at /tmp/LOJbZOAt7O line 1:␤------> (so (my ⏏…»
psch dakkar: just un-terse it, «if $string ~~ m/pat/ { ($key, $value) = $0, $1 }»
xfix Right...
n: (so (my ($key,$value) = Nil)).perl.say; say "$key $value"
+camelia niecza v24-109-g48a8de3: OUTPUT«Bool::True␤Use of uninitialized value in string context␤ at /home/camelia/niecza/lib/CORE.setting line 1389 (warn @ 5) ␤ at /home/camelia/niecza/lib/CORE.setting line 269 (Mu.Str @ 15) ␤ at <unknown> line 0 (ExitRunloop @ 0) ␤ at /tmp/RS…»
xfix n: (so (my ($key,$value) = Nil)).perl.say; if False { say $key + $value }
+camelia niecza v24-109-g48a8de3: OUTPUT«Bool::True␤»
dakkar psch: I thought this was Perl :)
xfix pugs: (so (my ($key,$value) = Nil)).perl.say; if False { say $key + $value }
+camelia pugs: OUTPUT«sh: /home/camelia/.cabal/bin/pugs: No such file or directory␤»
dakkar writes it the verbose way
xfix xfix@papaya ~> perl -E 'if (my ($key, $value) = undef) {say "abc"}' 14:20
abc
xfix@papaya ~> perl -E 'if (my ($key, $value) = ()) {say "abc"}'
nothing
Okay, why Nil doesn't work the way it should?
psch xfix: which way should it work?
and () is not Nil
and a list is never Nil
xfix It's Perl 5 in this case. 14:21
psch oh, right
missed that, sorry
xfix Nil is absense of value.
While () in Perl 5 is undef in scalar context, and empty list in list context. 14:22
r: (so (my ($key,$value) = ())).perl.say;
+camelia rakudo-{parrot,moar} 7ea485: OUTPUT«Bool::True␤»
xfix Come on...
It shouldn't behave this way (I think).
psch m: my $x, $y = (); $x.perl.say; $y.perl.say
+camelia rakudo-moar 7ea485: OUTPUT«===SORRY!=== Error while compiling /tmp/SJ7_funVze␤Variable '$y' is not declared␤at /tmp/SJ7_funVze:1␤------> my $x, $y⏏ = (); $x.perl.say; $y.perl.say␤ expecting any of:␤ postfix␤»
psch m: my ($x, $y) = (); $x.perl.say; $y.perl.say 14:23
+camelia rakudo-moar 7ea485: OUTPUT«Any␤Any␤»
xfix I know it's Any.
psch m: my ($x, $y) = (); ($x, $y).perl.say
+camelia rakudo-moar 7ea485: OUTPUT«(Any, Any)␤»
xfix my ($x, $y) = () changes into (Any, Any).
psch and why should that be False?
xfix Which is IMO wrong.
psch, because this behavior makes if ($a, $b) = something() { } broken. 14:24
Even if it's intended behavior, it's wrong.
14:24 aborazmeh left, pecastro left
isBEKaml m: (so (Nil, Nil)).perl.say 14:25
+camelia rakudo-moar c5e7a7: OUTPUT«Bool::True␤»
psch m: sub foo { Nil, Nil }; my ($a, $b); if ($a, $b) = foo { say "here" }
+camelia rakudo-moar c5e7a7: OUTPUT«===SORRY!===␤Function foo needs parens to avoid gobbling block␤at /tmp/HMzLgXvngZ:1␤------> a, $b); if ($a, $b) = foo { say "here" }⏏<EOL>␤Missing block (apparently taken by 'foo')␤at /tmp/HMzLgXvngZ:1␤---…»
psch m: sub foo { Nil, Nil }; my ($a, $b); if ($a, $b) = foo() { say "here" }
+camelia rakudo-moar c5e7a7: OUTPUT«here␤»
psch m: sub foo { () }; my ($a, $b); if ($a, $b) = foo() { say "here" }
+camelia rakudo-moar c5e7a7: OUTPUT«here␤»
psch i don't know, i wouldn't use if that way ever
because the assignment clearly worked 14:26
isBEKaml xfix: why would that be wrong? Even if it's (Nil, Nil), it's still a populated tuple - it'll return Bool::True
xfix I'm not saying that (Any, Any) shouldn't be True.
psch m: sub foo { () }; my ($a, $b); if foo() -> $a, $b { say "here" }
+camelia ( no output )
psch xfix: that's what you want i think?
xfix The thing is, my ($x, $y) = () returns (Any, Any), not () or something.
psch m: sub foo { Nil, Nil }; my ($a, $b); if foo() -> $a, $b { say "here" }
+camelia rakudo-moar c5e7a7: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤ in block <unit> at /tmp/EtRzCVIq9w:1␤␤»
xfix Is it specified what = operator returns?
dakkar let's put it this way: «($a) = @('a' ~~ /b/)» is False, «($a,$b) = @('a' ~~ /b/)» is True 14:27
that is, at the very least, surprising
(especially coming from Perl 5)
14:27 woolfy left
psch not to me, tbh. consider «if(x = 5) { }» in e.g. C 14:28
i mean, i can see the confusion
dakkar fails to see the parallels
xfix It behaves differently to Perl 5, for example.
isBEKaml p: my ($x, $y) = 1,2,3; say $x, " --" , $y;
+camelia rakudo-parrot c5e7a7: OUTPUT«1 --2␤»
psch yeah, let me clarify
i understand why the behavior seems weird and inconsistent, but i've filed it as "don't do that", which means i'm probably not arguing from the idioms merits, but from prejudice... 14:29
xfix In Ruby: a, b = [] returns []. In Perl 5, ($a, $b) = () returns ().
psch so i'll better keep out of it
dakkar oh well :) 14:30
xfix The behavior of returning (Any, Any) is wrong in my opinion.
Sure, this is what is the value of ($a, $b), but it doesn't appear to be useful in my opinion.
of ($a, $b) is* 14:31
dakkar anyway, I'm porting from JS to P6 via P5, so my idoms are getting *very* confused :)
isBEKaml m: ().length.say; 14:32
+camelia rakudo-moar c5e7a7: OUTPUT«No such method 'length' for invocant of type 'Parcel'␤Did you mean 'elems', 'chars', 'graphs' or 'codes'?␤ in block <unit> at /tmp/5lIJbE4SN3:1␤␤»
huf perl5 doesnt *quite* appear to do that :)
isBEKaml m: ().size.say;
+camelia rakudo-moar c5e7a7: OUTPUT«No such method 'size' for invocant of type 'Parcel'␤ in block <unit> at /tmp/xbTttPqpCZ:1␤␤»
isBEKaml m: ().elems.say;
+camelia rakudo-moar c5e7a7: OUTPUT«0␤»
isBEKaml m: my @foo = (); my ($x, $y) = @foo; ($x, $y).perl.say;
+camelia rakudo-moar c5e7a7: OUTPUT«(Any, Any)␤»
huf it looks like the result is the left side in list context and the count of the right side in scalar :) 14:33
psch m: $_ = "a b"; my ($key, $value) = @(m{^ (\w+) '=' (.*) $}) and $key // $value // die "foo"; say $key, $value # if it has to be terse dakkar :P
+camelia rakudo-moar c5e7a7: OUTPUT«foo␤ in block <unit> at /tmp/4budWaQJZJ:1␤␤»
dakkar eeeewweeww
isBEKaml ISTR a discussion around assignment and the comma operator. But I can't recall any specifics there. Anyone?
dakkar :)
masak isBEKaml: S03 has a bit about assignment and the comma operator. 14:34
14:34 rurban left
isBEKaml masak: is that where this behaviour is coming from? 14:34
xfix I cannot find anything about return value of ($a, $b) = c anywhere in S03. 14:35
masak what behavior. I haven't backlogged anything.
xfix ($a, $b) = ()
What is the return value of that. In my opinion, it should be (), but in Rakudo it's (Any, Any).
masak there's basically listy assignment and item assignment.
isBEKaml masak: my ($x, $y) = (); assings (Any, Any) to those 2
xfix Yes, ($a, $b) after ($a, $b) = () is without doubt (Any, Any). But what about result of list assignment? 14:36
masak m: my ($x, $y) = (); BEGIN { $x = 5 }; say $x
+camelia rakudo-moar c5e7a7: OUTPUT«(Any)␤»
masak hm, so it does.
xfix m: say my ($x, $y) = ()
+camelia rakudo-moar c5e7a7: OUTPUT«(Any) (Any)␤»
xfix m: say (my ($x, $y) = ()).perl
+camelia rakudo-moar c5e7a7: OUTPUT«(Any, Any)␤»
xfix m: say (my Int ($x, $y) = ()).perl
+camelia rakudo-moar c5e7a7: OUTPUT«(Int, Int)␤»
masak I think that makes sense, though. the list () ran out of elements, so the rest get Any.
xfix My reasoning is that the current behavior breaks behavior of if (my ($a, $b) = something) { } 14:37
Which is a perfectly fine Perl 5 idiom.
In Perl 5, you can write code like: 14:38
if (my ($a, $b) = "ab" =~ /(\w) (\w)/) { say "$a $b" } else { say "Nothing found" }
Any suggestion how to write this in Perl 6? 14:39
+dalek frastructure-doc: 6365994 | raiph++ | hosts/hack.p6c.org.pod:
Typos
14:40
psch m: if "ab" ~~ /$<a>="a" $<b>="b"/ { say "$<a> $<b>" } else { say "nothing found" } # this is how i would write that case in perl6
+camelia rakudo-moar c5e7a7: OUTPUT«a b␤»
xfix I guess that's a possiblity.. 14:41
huf that doesnt generalize well to non-regex stuff...
psch yes, i know
general case is unpack syntax, which i keep forgetting
14:42 raiph joined
psch m: sub something { 1,2,3 }; if something() -> @a [$a, $b, *@c] { say "have $a, $b and @c" } 14:43
+camelia rakudo-moar c5e7a7: OUTPUT«have 1, 2 and @c␤»
psch m: sub something { 1,2,3 }; if something() -> @a [$a, $b, *@c] { say "have $a, $b and @c[]" }
+camelia rakudo-moar c5e7a7: OUTPUT«have 1, 2 and 3␤»
psch that's the general case
+dalek c: 2c39a3b | moritz++ | lib/Type/IO.pod:
mkdir: link to exception
xfix Hm, looks fine.
psch @a could've been anon
i.e. just @ 14:44
xfix sub something { 1,2,3 }; if something() -> $a, $b, $c { say "have $a, $b and $c" }
psch it even generalizes to objects
dakkar oh, I like that one
xfix r: sub something { 1,2,3 }; if something() -> $a, $b, $c { say "have $a, $b and $c" }
+camelia rakudo-parrot c5e7a7: OUTPUT«Not enough positional parameters passed; got 1 but expected 3␤ in block <unit> at /tmp/tmpfile:1␤␤»
..rakudo-moar c5e7a7: OUTPUT«Too few positionals passed; expected 3 arguments but got 1␤ in block <unit> at /tmp/tmpfile:1␤␤»
xfix r: sub something { 1,2,3 }; if something() -> @[$a, $b, $c] { say "have $a, $b and $c" }
+camelia rakudo-{parrot,moar} c5e7a7: OUTPUT«have 1, 2 and 3␤»
xfix Neat.
psch m: sub foo { a => 1 }; if foo() -> :$key, :$value { say "key $key has value $value " } 14:45
+camelia rakudo-moar c5e7a7: OUTPUT«use of uninitialized value $key of type Mu in string context in block <unit> at /tmp/LSgfk2inbt:1␤␤use of uninitialized value $value of type Mu in string context in block <unit> at /tmp/LSgfk2inbt:1␤␤key has value ␤»
dakkar disappears for a bit
psch err, somewhat like that... :/
m: sub foo { a => 1 }; if foo() -> :(:$key, :$value) { say "key $key has value $value " }
+camelia rakudo-moar c5e7a7: OUTPUT«use of uninitialized value $key of type Mu in string context in block <unit> at /tmp/wRMUFpAyfq:1␤␤use of uninitialized value $value of type Mu in string context in block <unit> at /tmp/wRMUFpAyfq:1␤␤key has value ␤»
psch m: sub foo { a => 1 }; if foo() -> :($key, $value) { say "key $key has value $value " }
+camelia rakudo-moar c5e7a7: OUTPUT«Too few positionals passed; expected 2 arguments but got 0 in sub-signature␤ in block <unit> at /tmp/dhtQqok7U2:1␤␤»
psch i don't remember :)
m: sub foo { a => 1 }; if foo() -> $(:$key, :$value) { say "key $key has value $value " } # moritz++ for 5-to-6 14:46
+camelia rakudo-moar c5e7a7: OUTPUT«key a has value 1 ␤»
vendethiel- is it possible to commit in a "%" ?
like, if I matched it one time, never try to backtrack this segment?
isBEKaml m: sub foo { (a => 1) }; if foo() -> :$key, :$val { say "key : $key, val: $val" }
+camelia rakudo-moar c5e7a7: OUTPUT«use of uninitialized value $key of type Mu in string context in block <unit> at /tmp/438K38R3tZ:1␤␤use of uninitialized value $val of type Mu in string context in block <unit> at /tmp/438K38R3tZ:1␤␤key : , val: ␤»
isBEKaml m: sub foo { (a => 1) }; if foo() -> $key, $val { say "key : $key, val: $val" }
+camelia rakudo-moar c5e7a7: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤ in block <unit> at /tmp/WhtVRBW6Xp:1␤␤»
psch vendethiel-: insert a sequence point in the quantified bit?
vendethiel-: not sure if that does what you mean yet, but i think it should 14:47
vendethiel- psch: just [ 'x' :: ] % ',' ?
psch vendethiel-: i don't know if :: is implemented yet, i'd have tried {}
vendethiel- oke
isBEKaml psch: oh, $(PAIR) :-) 14:48
14:49 dakkar left
isBEKaml -> out 14:50
14:50 isBEKaml left
vendethiel- can you load a file in the REPL? 14:50
and have its state available 14:51
15:04 kjs_ left
timotimo o/ chaos communication congress 15:09
15:09 bjz_ joined 15:10 bjz left
psch o/ timotimo 15:13
15:16 jack_rabbit joined
psch vendethiel-: i don't think the REPL is up to that currently. EVAL would allow you to specify the context to put the EVAL'd stuff into, but i think the way the REPL is implemented doesn't fully honor all the package things it should 15:16
vendethiel- yeah 15:17
psch vendethiel-: i am thinking we'd want something like &drop-to-REPL or similar in module-space eventually, maybe even in the SETTING, but that'd need a better REPL
vendethiel- right-o
15:19 Theo_ left
colomon hurm, how to determine the common prefix of two strings? 15:20
or N strings, but if I can do the first I can do the latter
15:21 rurban joined
colomon m: my $a = "hello"; my $b = "hel"; say ($a.comb Z $b.comb).perl 15:22
+camelia rakudo-moar c5e7a7: OUTPUT«(("h", "h"), ("e", "e"), ("l", "l")).list␤»
colomon m: my $a = "hello"; my $b = "help"; say ($a.comb Z $b.comb).perl
+camelia rakudo-moar c5e7a7: OUTPUT«(("h", "h"), ("e", "e"), ("l", "l"), ("l", "p")).list␤»
colomon m: my $a = "hello"; my $b = "help"; say ($a.comb Z=> $b.comb) … { $_.key ne $_.value } 15:23
+camelia rakudo-moar c5e7a7: OUTPUT«===SORRY!=== Error while compiling /tmp/MNiJhEWlk_␤Two terms in a row␤at /tmp/MNiJhEWlk_:1␤------> $b = "help"; say ($a.comb Z=> $b.comb) ⏏… { $_.key ne $_.value }␤ expecting any of:␤ infix stop…»
15:23 skids left
colomon stupid IRC clinet 15:23
psch colomon: i think you want ...^ 15:25
colomon psch: yes
I've got it working locally now.
kind of hope there is a better solution. :)
my $a = "hello"; my $b = "kelp"; say (($a.comb Z=> $b.comb) ...^ { $_.key ne $_.value
argh
my $a = "hello"; my $b = "kelp"; say (($a.comb Z=> $b.comb) ...^ { $_.key ne $_.value }).map(*.key).join 15:26
15:26 mvuets joined 15:29 skids joined 15:34 vendethiel- left
a3gis hey! another question: is it possible to load a file directly into the perl6 repl? just like ghci "ghci hello.hs" 15:45
15:46 kjs_ joined
xfix a3gis, eval slurp "file" 15:47
timotimo we spell it EVAL now
xfix EVAL slurp "file" 15:48
Oh right.
masak grumbles
xfix (I don't understand why Perl in 5.16 introduced evalbytes function) 15:49
r: sub match { 'a' ~~ /(a)/ }; if 'b' ~~ /(b)/ { match; $/.perl.say } 15:52
+camelia rakudo-{parrot,moar} c5e7a7: OUTPUT«Match.new(orig => "b", from => 0, to => 1, ast => Any, list => (Match.new(orig => "b", from => 0, to => 1, ast => Any, list => ().list, hash => EnumMap.new()),).list, hash => EnumMap.new())␤»
xfix pl
ok*
r: sub match { 'a' ~~ /(a)/; say $/ }; if 'b' ~~ /(b)/ { match; say $/ }
+camelia rakudo-{parrot,moar} c5e7a7: OUTPUT«「a」␤ 0 => 「a」␤␤「b」␤ 0 => 「b」␤␤»
skids r: sub g( --> Nil) { 42; return; } sub f( -->Nil ) { 42 }; g().say; f().say; 15:54
+camelia rakudo-{parrot,moar} c5e7a7: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Two terms in a row␤at /tmp/tmpfile:1␤------> sub g( --> Nil) { 42; return; } ⏏sub f( -->Nil ) { 42 }; g().say; f().say␤ expecting any of:␤ i…»
skids r: sub g( --> Nil) { 42; return; }; sub f( -->Nil ) { 42 }; g().say; f().say; 15:55
+camelia rakudo-parrot c5e7a7: OUTPUT«Nil␤Type check failed for return value; expected 'Any' but got 'Int'␤ in block <unit> at /tmp/tmpfile:1␤␤»
..rakudo-moar c5e7a7: OUTPUT«Nil␤Type check failed for return value; expected 'Any' but got 'Int'␤ in any return_error at src/vm/moar/Perl6/Ops.nqp:649␤ in block <unit> at /tmp/tmpfile:1␤␤»
skids Second one should return Nil as well. 15:56
xfix r: sub a() returns False { False }; a # don't do this 15:58
+camelia rakudo-{parrot,moar} c5e7a7: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Cannot call 'trait_mod:<returns>'; none of these signatures match:␤:(Routine:D $target, Mu:U $type)␤at /tmp/tmpfile:1␤------> ␤»
skids r: sub a( --> 42) { return }; a().say; # spec says "If the return specification is a definite immutable value" so this should work too. 16:00
+camelia rakudo-{parrot,moar} c5e7a7: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Missing block␤at /tmp/tmpfile:1␤------> sub a( --> ⏏42) { return }; a().say; # spec says "If␤»
skids Anyway, as of the star release (and a few finagles) the Sum:: module now seems to work mostly on r-m now, and r-j is looking much better than last time I tried. Also, I added Tiger support. 16:03
Hope to play with the new POD features now, anchoring the docs to constructs. 16:05
a3gis xfix: but as a command? I'm trying to bind a shortcut to it in vim to load the current buffer 16:07
xfix a3gis, nope.
a3gis alright, thanks :) 16:08
xfix There is also -M option, but that can be only used outside of REPL. (perl -MSome::Module to load REPL with Some::Module preloaded)
16:11 mr-foobar joined
a3gis xfix: actually I can just create a script calling EVAL slurp file and get what I want 16:13
TimToady very backlog, so muchness 16:16
16:20 BenGoldberg joined, jack_rabbit left
TimToady m: say uint 16:50
+camelia rakudo-moar c5e7a7: OUTPUT«(uint)␤»
TimToady points out that, while P6 already has a uint type, there's no guarantee that it's the same size that C thinks it is
it's very likely to correspond to C's unsigned long (long) type 16:51
xfix m: say uint32 16:52
+camelia rakudo-moar c5e7a7: OUTPUT«(uint32)␤»
xfix m: my uint32 $x = 2
+camelia ( no output )
xfix m: my uint32 $x = 2; say $x
+camelia rakudo-moar c5e7a7: OUTPUT«2␤»
xfix Hm, okay.
TimToady because Perl 6 defines 'int' to mean the longest integer that runs at full speed
so if we interface to C, we need some explicit Cint and Cuint types, likely
or however we decide to spell 'em 16:53
those spellings are perhaps a bit too prone to freudian slips...
could go with _int and _uint I suppose 16:54
xfix NativeCall::long
TimToady if yer gonna make it that long, you should add a few more on the front :) 16:55
_int _unsigned_int _long_long would be fine by me 16:57
but yeah, a :: form would be more extensible to typedefs, I suppose 16:59
jnthn Yes, I've pondered before that NativeCall should export some sized types matching the local system's idea of sizes. 17:00
+yoleaux 22 Dec 2014 22:16Z <lizmat> jnthn: I'm thinking about prefixing "on-" to all Tap attributes so that you get a better message when e.g. trying to emit on a tap
22 Dec 2014 22:18Z <lizmat> jnthn: manufactured case: m: Supply.new.tap.emit(42) # should complain about not having an emit method
22 Dec 2014 22:24Z <lizmat> jnthn: www.engadget.com/2014/12/22/the-pro...reativity/ # served / available in Copenhagen :-)
17:01 virtualsue left
TimToady wonders if there's any systems out there where gcc and clang disagree on type sizes 17:01
or any other 'native' C compiler, for that mattter
xfix I doubt it, considering that such incompatibility would mean that code linked with clang couldn't link to code linked to gcc and back. 17:02
TimToady ss/any systems/any systems we care about/
jnthn .tell lizmat maybe the problem is that Tap exposes those methods... 17:03
+yoleaux jnthn: I'll pass your message to lizmat.
xfix The compilers disagree on stuff like vtables and name mangling in C++, but with C, as long there is one platform involved, the compilers are compatible (I think so, at least).
TimToady jnthn: o/ btw
xfix The compilers have to be compatible. Would you use a compiler that cannot link to system libraries because the compiler thinks that int is 40-bit, rather than 32-bit. 17:04
geekosaur the compilers agree on those things with c++11, iirc 17:05
xfix There are different calling conventions. For example, on Windows there is alternate __fastcall calling convention on x86 for historical reasons. However, those alternate calling conventions are marked in header files.
geekosaur c++ standards folks finally figured out that incompatibility was hurting them
jnthn TimToady: o/ 17:06
jnthn is doign the train trip between two bits of family, and figured he'd drop by :) 17:07
*doing
xfix geekosaur, even then, there are compilers before C++11 fixed stuff.
jnthn Turns out, UK trains run late too, just like their Swedish friends. :)
geekosaur xfix: I know only too well... 17:08
jnthn .tell lizmat +1 to Supply.for getting renamed; not entirely sure about from-list but I dont have a better idea. .for *should* exist on an instance of Supply and do .flat.map just as on a List. 17:20
+yoleaux jnthn: I'll pass your message to lizmat.
jnthn It's kinda funny how List's semantics on various methods is converging on how I implemented them in Supply (that is, don't flatten unless requested). :)
.tell lizmat to be clear, I mean .flat and .map in Supply-land, that is, it's still push semantics. 17:21
+yoleaux jnthn: I'll pass your message to lizmat.
17:23 rurban left
moritz \o jnthn 17:25
jnthn hi moritz 17:27
17:27 jamadam joined 17:28 raiph left 17:31 jamadam left 17:37 broquain1 joined, Sir_Ragnarok left, Sir_Ragnarok joined, broquaint left, raiph joined 17:38 colomon left 17:39 colomon joined 17:41 jack_rabbit joined
+dalek ecs: 9b2b9cb | moritz++ | S17-concurrency.pod:
S17: supplies are .done(), not .close()d
17:42
synopsebot Link: perlcabal.org/syn/S17.html#supplies_are
17:45 Ben_Goldberg joined 17:47 BenGoldberg left 17:48 BenGoldberg joined
moritz is Blob supposed to be immutable? 17:50
17:50 Ben_Goldberg left
jnthn Yes 17:51
moritz it seems we have a method assign_pos in Blob, which IMHO should go into Buf instead
TimToady psch: note that {} does not commit, it merely terminates LTM
jnthn Corect.
Not sure how it ended up in Blob...
TimToady used by the constructor maybe? 17:52
moritz TimToady: no, that uses nqp::bindpos_i
jnthn Would hope not, that'd be suboptimal...
TimToady my $blob = Blob.new: 1,2,3; $blob[1] = 42; say $blob 17:53
m: my $blob = Blob.new: 1,2,3; $blob[1] = 42; say $blob
+camelia rakudo-moar c5e7a7: OUTPUT«Buf:0x<01 2a 03>␤»
TimToady not very immutable...
xfix r: r: sub term:<int main(void) { puts("Hello, world!"); return 0; }> { say "Hello, world!" }; int main(void) { puts("Hello, world!"); return 0; }
+camelia rakudo-{parrot,moar} c5e7a7: OUTPUT«Hello, world!␤»
xfix Neat.
TimToady and sez its a Buf, not a Blob
17:53 telex left
jnthn m: my $blob = Blob.new: 1,2,3; $blob[1] = 42; say $blob.WHAT 17:54
+camelia rakudo-moar c5e7a7: OUTPUT«(Blob)␤»
jnthn Well, then it's the .gist that's lying, it seems.
17:54 telex joined
moritz somebody just moved method gist from Buf to Blob without updating it 17:54
jnthn So that'd want a fix too...
moritz works on it
jnthn moritz++
b2gills m: sub foo { (a => 1) }; if foo() -> $[:$key, :$value] { say "key : $key, value : $value" } # isBEKaml: Is this what you were trying to write? 17:55
+camelia rakudo-moar c5e7a7: OUTPUT«key : a, value : 1␤»
+dalek kudo/nom: 421176c | moritz++ | src/core/io_operators.pm:
remove unused code for deprecating cwd()
jnthn -> (:$key, :$value) { ... should probably do as well. 17:57
17:57 a3gis left
TimToady in fact, sigil followed by [] is reserved for shapes 17:58
xfix How to make case insensitive grammar in Perl 6 without saying :i everywhere?
jnthn I'd just .fc the input :P 17:59
I'm not aware of any convenient way to make :i the default. 18:00
And doing a transform on the initial string will be cheaper than checking the alternation everywhere, I suspect.
TimToady however, note that rakudo is rather weak on .fc, and does :i by comparing to .lc and .uc, ignoring .tc, currently
xfix If I do 'rule select { :i select <expressions> <from>? <where>? }', does from get case insensitive? 18:01
jnthn No.
xfix ok
jnthn It works lexically.
TimToady one could conceivably have a pragma that word work over an entire grammar
18:02 raiph left
jnthn TimToady: I thought we got .fc mostly correct? What's missing, ooc? 18:02
But yes, the :i is dubious.
xfix Well, I still want to match strings while preserving case. For example, SELECT 'abc';.
Or SELECT 'ABC';
They select different strings.
psch TimToady: commiting is with :: then, as vendethiel- suspected? 18:03
TimToady m: say fc("AbC")
+camelia rakudo-moar c5e7a7: OUTPUT«===SORRY!=== Error while compiling /tmp/83IjlkErFD␤Undeclared routine:␤ fc used at line 1. Did you mean 'lc', 'uc', 'tc'?␤␤»
TimToady yes, and NYI
jnthn m: say "AbC".fc 18:04
+camelia rakudo-moar c5e7a7: OUTPUT«No such method 'fc' for invocant of type 'Str'␤ in block <unit> at /tmp/Syg37KBGO9:1␤␤»
jnthn Bah
TimToady that seems 'rather weak' to me... :P
jnthn I guess it's Moar where I remember wroking on it... :P 18:05
TimToady the word fc doesn't occur inside nqp or Moarvm except in association with file channels or fcntl 18:07
+dalek ast: 7c3299d | peschwa++ | integration/advent2014-day13.t:
Insert a missing ^I.
18:08
jnthn :/
Then hell knows what I remember. Maybe it was nothing more than "we have the data in the unicode DB"
moritz you might remember tc and tclc 18:09
jnthn No, those are different...
+dalek kudo/nom: 449ea38 | moritz++ | src/core/Buf.pm:
move assign_pos from Blob to Buf

Blob is supposed to be immutable
kudo/nom: d771fa4 | moritz++ | src/core/Buf.pm:
Fix Blob.gist

it used to always return "Buf:...", now returns the type name in front
psch ugh 18:10
StackOverflowError in test #10 in man-or-boy.t :/
xfix r: Perl.new.say 18:12
+camelia rakudo-{parrot,moar} c5e7a7: OUTPUT«Perl 6␤»
xfix What is Perl?
TimToady the sound of no longer banging your head against the wall 18:13
xfix Oh, I see, it's used for $*PERL.
moritz m: say $*PERL.VMnames 18:14
+camelia rakudo-moar c5e7a7: OUTPUT«moar jvm parrot␤»
18:14 avuserow left
xfix m: say $*PERL.DISTROnames 18:14
+camelia rakudo-moar c5e7a7: OUTPUT«macosx linux freebsd mswin32 openbsd netbsd␤»
xfix Hm... clearly Rakudo Star is not a Perl distro.
18:14 avuserow joined
TimToady has not idea what those lists are supposed to be for, other than perhaps an impediment to extensibility 18:15
*no
xfix Hm, if $*PERL.VMnames shortens MoarVM to moar, then what about shortening JVM to j. 18:17
moritz sounds like a stupid idea. 18:18
jnthn Traveling by train in Britain was also a stupid idea. :/
moritz jnthn: my impression was that the coach network is better than the train network in GB 18:19
jnthn Depends on the traffic, I guess. :) 18:20
At least the train has wifi.
And at least the place I probably get stuck for over an hour has a pub...
TimToady you get a free massage on British trains, too 18:25
jnthn Tell me about it...this isn't a smooth ride at all. 18:26
moritz m: Blob[uint32].new(65535).unpack('H') 18:30
+camelia ( no output )
moritz m: say Blob[uint32].new(65535).unpack('H') 18:31
+camelia rakudo-moar 421176: OUTPUT«ffff␤»
18:31 ptc_p6 left
moritz m: say Blob[uint64].new(65535).unpack('H') 18:31
+camelia rakudo-moar 421176: OUTPUT«ffff␤»
jnthn Ah well, time to get off this one soon... Will probably be about here a bit more during the next week.
o/
moritz \o
m: say Blob.new(1, 2, 3, 4).unpack('C4') 18:32
+camelia rakudo-moar 421176: OUTPUT«1␤»
moritz bug, I'd say
it seems that most templates in unpack ignore quantifier 18:36
18:37 Ben_Goldberg joined 18:40 BenGoldberg left
moritz m: say Blob.new(1, 2, 3, 4).unpack('H A') 18:41
+camelia rakudo-moar 421176: OUTPUT«01020304 (Any)␤»
moritz suspects that nobody really used unpack yet 18:46
TimToady suspects that nobody really implemented unpack yet :) 18:47
18:47 jack_rabbit left
moritz well, somebody started to implement it, and I thought it was "mostly done" 18:52
using strings for unpacking templates feels kinda arcane 18:53
18:54 [Sno] left
moritz also weird: A4 returns a single string, C4 returns 4 ints 18:54
I wonder if C4 should return a List of 4 ints instead
colomon is it returning a parcel now? 18:56
moritz no, it simply flattens into the return list
colomon ah
moritz well, after my patch. Before my patch, C ignored any quantifier
and H always assumed H*
xfix I wonder... / ^ <uint32>**4 <int64>**2 $ / 18:57
Looks less cryptic than unpack, at least.
colomon moritz++ 18:58
xfix (but I guess it's possible to have both pack/unpack and this regex thing as a module)
18:59 Ben_Goldberg left
xfix (oh, right, you cannot run regexes on Buf) 18:59
19:00 molaf left
+dalek kudo/nom: 3b9ebdd | moritz++ | src/core/Buf.pm:
Blob.unpack: pay attention to quantifiers

like, really. Before, some directives like A payed attention, C always extracted one, and H always used up the rest of the blob
19:02
TimToady you're supposed to be able to run regexes on a Buf, but it's NYI 19:03
(with ASCII-only semantics)
xfix TimToady, by ASCII only, you mean 8-bit, right? So I could do / \xFF /? 19:04
TimToady yes
moritz decides not to follow up on unpack
TimToady but ÿ is illegal for that
moritz .u ÿ
+yoleaux U+00FF LATIN SMALL LETTER Y WITH DIAERESIS [Ll] (ÿ)
moritz ... and all I wanted to do was document unpack 19:05
xfix It would be neat to have partially binary string. You know it has ASCII, but you don't know much else. For example, you write a bot that parses IRC messages, and uploads them to the database without charset conversion. 19:06
So you see people saying stuff like PRIVMSG #perl6 :some unreadable blob
TimToady that's the idea of allowing ASCII and binary matching
19:08 a3gis joined
a3gis hello; what is the recommended way to install librairies like github.com/jnthn/grammar-debugger ? 19:08
TimToady 'course, if we have a utf8 type, we can also have a latin1 type, and casting a Buf to latin1 would allow matching ÿ
but only if someone champions it
moritz a3gis: use panda, the module installer bundled with Rakudo Star
(or you can install panda from git too, once you have a rakudo compiled) 19:09
a3gis moritz: I cloned the rakudo repo directly
TimToady but I think we should get to NFG first, and define a latin1 buf to simply be NFG as represented in buf8
moritz a3gis: then 'make install', put install/bin into $PATH, clone the panda repo, cd into it, run 'perl6 bootstrap.pl'
xfix / ^ [ <[\x00..\x7F]> | <[\xC0..\xDF]> <[\x80..\xBF]> | <[\xE0..\xEF]> <[\x80..\xBF]>**2 | <\xF0..\xF7]> <[\x80..\xBF]>**3 ]* $ / 19:12
+dalek d: f9b7f55 | TimToady++ | STD.pm6:
do not parse sig (@[$x]) as declaring $x

The shape notation should not be confused with subsig notation, which requires space between any formal variable and the brackets.
TimToady p6: /^ \0 / 19:13
+camelia rakudo-{parrot,moar} 421176: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Unrecognized backslash sequence: '\0'␤at /tmp/tmpfile:1␤------> /^ \⏏0 /␤»
TimToady n: /^ \0 / 19:14
+camelia ( no output )
a3gis moritz: brilliant; thanks!
TimToady that's a surprising oversight...
xfix std: /\0/
+camelia std 76ccee1: OUTPUT«ok 00:00 135m␤»
xfix github.com/rakudo/rakudo/blob/32c6....nqp#L4412 19:16
Hm, it's here.
19:20 hekmek left 19:23 woolfy joined
TimToady suspects that nqp is not actually using that definition; one of the spots where the 'not quite' is showing through 19:24
19:25 Mso150 joined, rindolf left
TimToady n: say "\cIfoo" 19:26
+camelia niecza v24-109-g48a8de3: OUTPUT« foo␤»
TimToady m: say "\cIfoo"
+camelia rakudo-moar 3b9ebd: OUTPUT«===SORRY!=== Error while compiling /tmp/4cKth5eCTJ␤'I' is not a valid number␤at /tmp/4cKth5eCTJ:1␤------> say "\cI⏏foo"␤»
+dalek c: 8697985 | moritz++ | lib/Type/B (2 files):
move Buf docs to Blob

that is where those methods live now
19:28
c: 634eac7 | moritz++ | lib/Type/Blob.pod:
document Blob.unpack (for #10)
19:30 rurban joined
+dalek c: 385ba9e | moritz++ | lib/Type/Buf.pod:
add stub Buf documentation
19:35
masak jnthn: you're not hallucinating .fc -- but it's not in Perl 6, and has never been, I think. 19:36
I remember reading some blog post about it. 19:37
it's the thing that should be used instead of .lc (or .uc) for proper case-insensitive string comparison.
TimToady it's certainly part of Perl 6, just NYI 19:38
xfix r: Real.new 19:39
+camelia ( no output )
xfix r: Real.new.perl.say 19:40
+camelia rakudo-{parrot,moar} 3b9ebd: OUTPUT«Real.new()␤»
TimToady :P
xfix Why if I type Real.new in REPL, REPL gets stuck in infinite loop?
r: Real.new.say 19:41
TimToady because the punned class has no bridge to actual values?
+camelia rakudo-moar 3b9ebd: OUTPUT«Memory allocation failed; could not allocate 163840 bytes␤»
..rakudo-parrot 3b9ebd: OUTPUT«maximum recursion depth exceeded␤current instr.: 'print_exception' pc 155220 (src/gen/p-CORE.setting.pir:65744) (gen/parrot/CORE.setting:12364)␤called from Sub 'Bridge' pc 323316 (src/gen/p-CORE.setting.pir:134554) (gen/parrot/CORE.setting:4766)␤ca…»
xfix Ok, so infinite recursion.
TimToady could probably be handled with a proper stub method in the role 19:42
xfix So I just learned that Buf and Blob are roles, not classes.
TimToady they just default to uint8 when punned
a3gis is it possible to have non-whitespace-sensitive rules in a grammar? to avoid insrting <ws>* between each nonterminal 19:43
xfix (also, I miss easy recognization of infinity loops when working on hack... on my PC, fan starts working, but on external server, I hear nothing)
TimToady a3gis: that's what 'rule' is for
xfix r: say '2 +2' ~~ rule { (2) (\+) (2) }
+camelia rakudo-{parrot,moar} 3b9ebd: OUTPUT«「2 +2」␤ 0 => 「2」␤ 1 => 「+」␤ 2 => 「2」␤␤» 19:44
TimToady rule { <foo> <bar> } will automatically provide <.ws> after each matching piece
and <ws>* makes no sense, btw
masak r: say '2 +2' ~~ rule { 2 '+' 2 }
+camelia rakudo-{parrot,moar} 3b9ebd: OUTPUT«「2 +2」␤␤»
TimToady ws is already multichar if necessary
masak <ws>* will most likely put you in an infinite loop.
TimToady and also allows no whitespace if not between alphanumerics
so you don't need the 0 case either 19:45
xfix r: say '22' ~~ rule { (2) (2) } # Nothing matched, because \w
+camelia rakudo-{parrot,moar} 3b9ebd: OUTPUT«Nil␤»
xfix r: say '++' ~~ rule { (\+) (\+) } # Matched, because \W
+camelia rakudo-{parrot,moar} 3b9ebd: OUTPUT«「++」␤ 0 => 「+」␤ 1 => 「+」␤␤»
xfix (of course, if you need more specific matching, you can change ws method) 19:46
TimToady the p6 grammar allows pod as part of ws, for instance
and comments 19:47
xfix Yes, many programming languages allow comments between tokens. This is what changing "ws" can be useful for.
a3gis TimToady: right, thanks!
<ws>* because my token <ws> was matching exactly one whitespace 19:48
TimToady shouldn't, if you're using the built-in ws
19:48 FROGGS__ joined
xfix a3gis, \s 19:48
Or \h, if you only want horizontal whitespace. 19:49
TimToady yes \s* or \h* makes much more sense
xfix There is also ' ', if you only want to match U+0020 Whitespace.
(when dealing with Python, it may be a good idea to modify the definition of <ws> to only handle horizontal whitespace, because 2 \n + 2 is something else than 2 + 2) 19:51
19:51 FROGGS[tab]_ left
xfix <.ws>* 19:51
19:52 FROGGS_ left
a3gis xfix: could you take a very quick look at this and tell me if it can be simplified? gist.github.com/a3gis/c165ba276bb85bdb07f9 19:56
xfix Well, you could simplify production rule. 19:58
Instead of two rules, just <nonterminal> '::=' <expression>? ';' 19:59
Also, you don't need <ws> rule at beginning.
a3gis oh right
mmh
i tried without it but it wouldn't parse
xfix Also, there was some way to simplify <factor> [<ws> <factor>]*, but I don't remember what. 20:00
[\w]+ can be simply written as \w+.
20:01 jack_rabbit joined
psch <factor>+ % <ws> 20:02
xfix yes
I knew it was something with %, but I didn't exactly remember what.
20:03 FROGGS__ is now known as FROGGS
a3gis oh sweet 20:04
FROGGS .tell jnthn can you please take a look at that gist? line 28 triggers the shows error (I want to make `do while` work): gist.github.com/FROGGS/98e1a97434c3753dc081
+yoleaux FROGGS: I'll pass your message to jnthn.
a3gis what is the % doing exactly?
is it some generic syntax to interpolate some token between repetitions?
FROGGS 'x separated by y'
yes
xfix (I was trying to do <factor> %+ <ws>, but Perl 6 complained) 20:05
FROGGS that's also why % was chosen, because it looks like two identical things separated by another
masak FROGGS: wow, I had missed that rationale.
FROGGS and you can have: a+ % b, a* % b, a**1..5 % b, a**{code that gives a range object} % b 20:06
masak FROGGS: my mnemonic was "one or more of X things, *modulo* that Y things go in the middle"
TimToady but write it as a +% b because that dwims under sigspace
xfix Mnemonic for ** - mathematically, ho**3 = hohoho 20:07
FROGGS masak: TimToady told me IIRC :o)
20:07 darutoko left
masak you can even do `a? % b`, but since you can't have a `b` between zero or one thing... :) 20:08
TimToady but if you just want whitespace, use rule { <factor> + } or so
masak %% would make sense in that context, though.
FROGGS %% allows a trailing sep? 20:09
TimToady yes
FROGGS makes sense
TimToady "it comes out evenly divisible"
masak ooh :) 20:10
Perl 6 makes too much sense sometimes.
FROGGS it is just beautiful, aye 20:11
TimToady xfix: you do need to match ws at the beginning explicitly, but you can do that by saying rule { ^ <stuff> }
FROGGS most parts at least :o)
TimToady since it'll look for <.ws> after the ^
xfix TimToady, oh, right.
TimToady In-n-Out run for the hoarded hordes... & 20:12
a3gis oh cool
also, what is '»' in 'make $<question>».ast;'?
and is there a non-unicode alternative?
masak a3gis: >>
a3gis I assume it's some postfix operator
masak a3gis: it means "distribute method call .ast over elements"
a3gis oh
so it's map
?
masak yes, but hyper.
meaning conceptually there's no order of the calls. 20:13
though the results retain the order of the original elements.
a3gis alright
is there a neater way to write it than make $<production>>>.ast; ?
it's a bit unreadable
(without unicode)
masak »
» is just latin-1 :)
FROGGS and the reasoning that there is no guaranteed ordering of the calls is that the compiler is allowed to call all in parallel
masak a3gis: $<production>.map(*.ast) works too 20:14
20:14 Sir_Ragnarok left
a3gis masak: oh yeah that works; thanks! 20:15
moritz stricktly speaking, 'map' is also Unicode 20:19
s/k//
a3gis moritz: haha right, I should have been more precise :p
masak it's all Unicode. and if it isn't yet, then just wait a few years. 20:20
a3gis I should have said "something I can easily type on my keyboard" 20:21
moritz compse > >
*compose 20:22
moritz notices that he typos every fifth word or so, and should probably stop typing today
OTHO, better docs with lots of typos than no docs at all
20:23 denis_boyun_ joined
masak +1 20:23
FROGGS and btw, communication is not done to fulfil grammar rules... it is done to transfer meaning, and that still works with typos :o) 20:24
moritz ... sometimes
FROGGS hopefully most of the time I'd say
moritz there is a certain individual who sometimes joins this channel (and others where I'm in), and he garbles his sentences so much that I often cannot parse them correctly, even after several times 20:25
and I'm not talking about FROGGS++
FROGGS hehe
moritz: you are so kind :D
raydiak \o #perl6 afternoon good 20:28
FROGGS hi raydiak, we were just speaking of you...
moritz m: grammar A is Any { }; say A.^mro
+camelia rakudo-moar 3b9ebd: OUTPUT«(A) (Any) (Mu)␤»
FROGGS (joke :P)
raydiak hehe nah, not my sentences that are usually garbled, just the content therein :) 20:29
masak my sentences are usually garbled. I'm an amateur garbler. 20:31
moritz m: grammar A { token TOP { .* } }; say ~A.parse('ab', :c(1)) 20:32
+camelia rakudo-moar 3b9ebd: OUTPUT«b␤»
20:34 dakkar joined
raydiak masak: if you work hard you could go pro and shift careers from tech to law 20:35
masak I'm not sure I'm that into it. 20:37
dakkar for the people who saw me perpelxed a few (6) hours ago: «my ($a,$b) = @( $str ~~ $rx ) or Exception.new.throw» doesn't throw on match failure, but «my ($a,$b) = @( $str ~~ $rx or Exception.new.throw )» works 20:39
20:39 denis_boyun_ left
raydiak considers that machine-oriented occupations reward less garbling, while people-oriented ones seem to be the opposite 20:39
moritz hated garbling teachers 20:41
20:41 Sqirrel joined
sergot hi o/ 20:45
raydiak garbling is a prerequisite for success in acadameia as far as I can tell...by the time you're in far enough to be a teacher, seems like you've either developed your own internal anti-garble mechanisms, or are lost forever, doomed to wander the earth as one of the garbling hordes :) 20:46
a3gis erm sorry, another newbie question. I've a "rule factor { <nonterminal> | <terminal> }" and trying to build an action for it, which should return either the ast for terminal, or for nonterminal 20:47
raydiak \o sergot
moritz raydiak: I've met a fair amount of people in academia here in .de, and my impression was that the garbling ratio wasn't hire than in, say, IT
sergot raydiak: o/
masak a3gis: `if $<nonterminal> { ... }`, something like that? 20:48
moritz a3gis: make $<terminal> ?? $<terminal>.ast !! $<nonterminal>.ast;
a3gis masak: oh ok, so there is not shortcut for that
moritz is it still called make?
masak or what moritz++ said.
20:48 sirdancealot joined
masak a3gis: no. sometimes I wish there were. 20:48
moritz a3gis: well, you can also use 'make $/.hash.values[0].ast'
masak a3gis: occasionally I end up writing my own utility subroutine for things like that.
FROGGS a3gis: you could do: rule factor { $<thingy>=[ <.nonterminal> | <.terminal> ] } ... method factor($/) { make $<thingy>.ast }
a3gis also, is there some sort of soaked access in p6? e.g. $x?.y 20:49
which would only call y is $x is not Any
moritz $x.?y
a3gis oh ==>
moritz which calls y if y is callable
(which isn't quite the same, but often near enough)
a3gis what is the best reference for that kind of stuffs in p6 by the way? is there a good tutorial out there? I read the learnxinyminutes 20:50
I feel a bit guilty harrassing you guys with very basic questions :p
FROGGS a3gis: never mind, we like to show off :P
moritz a3gis: it's ok; there's doc.perl6.org/type/Match for example
raydiak moritz: most of the people I've met here who are in IT have already been subjected to the garble-learning part of acadameia 20:51
moritz a3gis: also, github.com/perl6/book/ is a bit bitrotten, but the chapters on regexes and grammars should still be mostly fine
a3gis: doc.perl6.org/language.html also points to regex and grammar docs 20:52
FROGGS moritz: and the book teaches terms you can search for later... so I think the book is quite important
moritz a3gis: ... and all of that is reachable (more or less direct :-) from perl6.org/documentation/
a3gis: ... but do feel free to ask here, and also point out where docs are missing
or incomprehensible 20:53
in fact, I'm documenting class Grammar right now :-)
a3gis moritz: yeah I kind of skimmed over all of those, but they all seem to be missing smething :p
oh great!
+dalek c: 4800dfd | moritz++ | lib/Type/Grammar.pod:
document class Grammar
20:55
moritz a3gis: though that's probably not the missing you're wishing for
raydiak moritz++
a3gis moritz: I'll try to write some stuffs once I get my head around the whole thing 20:56
moritz a3gis: looking forward to it!
raydiak I was playing around with grammars last night, trying to add attributes and .new them with different values...didn't work very well iirc; is stuff like that expected to work without subclassing Grammar? 20:57
I know it's a weird thing to be doing, I was just kinda wondering why we allow methods and attributes in grammars if they aren't expected to work anyway 20:58
moritz raydiak: writing a 'grammar YourGrammarHere { ... }' automatically subclasses Grammar
raydiak oh, that makes sense
20:58 pmqs_ joined
raydiak m: grammar Foo { has $.bar }; Foo.new(:bar<foobar>).bar.say 21:00
+camelia rakudo-moar 3b9ebd: OUTPUT«foobar␤»
lizmat thinks she has messages
+yoleaux 17:03Z <jnthn> lizmat: maybe the problem is that Tap exposes those methods...
17:20Z <jnthn> lizmat: +1 to Supply.for getting renamed; not entirely sure about from-list but I dont have a better idea. .for *should* exist on an instance of Supply and do .flat.map just as on a List.
17:21Z <jnthn> lizmat: to be clear, I mean .flat and .map in Supply-land, that is, it's still push semantics.
raydiak hm, will have to go back thruogh the bash history and see exactly what wasn't working
maybe I was just tired again *shrug*
lizmat moritz: thanks for eradicating &cwd, I was weary of doing that myself because of potential ecosystem breakage 21:04
21:04 kjs_ left
moritz lizmat: I didn't remove it; just a version of cwd that was in an inner scope, thus not visible outside the setting 21:04
m: say cwd 21:05
+camelia rakudo-moar 3b9ebd: OUTPUT«"/home/camelia".IO␤Saw 1 call to deprecated code during execution.␤================================================================================␤Sub cwd (from GLOBAL) called at:␤ /tmp/Jmf9qfiLz7, line 1␤Deprecated since v2014.10, will be remo…»
a3gis gist.github.com/a3gis/483ee7268309...le1-p6-L22
why does nonterminal have type Array?
$<nonterminal>.ast 21:06
moritz m: say 'ab' ~~ /('a')?/; say $0.^name 21:07
+camelia rakudo-moar 3b9ebd: OUTPUT«「a」␤ 0 => 「a」␤␤Match␤»
moritz a3gis: what version of rakudo are you using?
a3gis 2014.12-34-ge861672
moritz a3gis: that's not where the error comes from 21:10
a3gis: it comes from line 80, when I run it 21:11
class BNF::Production { has @.nonterminal;
that's where the Array comes from
you declared it to be an array :-)
21:11 Mso150_j joined 21:12 kaare_ left, Mso150 left
a3gis moritz: oh crap, I meant to make the attribute public but messed up the sigil --> 21:12
sorry 21:13
moritz a3gis: no problem
a3gis: parsing BNF with grammar - I like it :-)
a3gis haha yeah, I thought writing a LL(1) parser generator would be a good exercise to touch different areas of perl6
raydiak m: grammar G { has $.str; token TOP { $.str }; }; G.new(:str<foo>).parse("foo"); # should this work? 21:14
+camelia ( no output )
raydiak m: grammar G { has $.str; token TOP { $.str }; }; G.new(:str<foo>).parse("foo").say;
+camelia rakudo-moar 3b9ebd: OUTPUT«(Any)␤»
lizmat .tell jnthn I don't see how those methods could not be public, unless you want to go all getattr ?
+yoleaux lizmat: I'll pass your message to jnthn.
TimToady arg, RT #83952 is just wrong, \cI is supposed to be a tab 21:15
synopsebot Link: rt.perl.org/rt3//Public/Bug/Displa...l?id=83952
TimToady someone completely missed the point of matching '?' .. 'Z' 21:17
moritz I've now taught the doc.perl6.org update job to only do something if there was a new commit on master, and run it twice per hour 21:18
raydiak nice
moritz I guess I should do the same magic on moar update jobs
21:19 FROGGS[tab] joined
+dalek ast: 8a98e6e | TimToady++ | S02-literals/quoting.t:
test control forms of \c
21:25
: 82d3cd8 | moritz++ | util/update-design.perl6.org.sh:
skip updates dor design.perl6.org if nothing changed in git
moritz people will notice I write bash scripts with baby vocabulary only 21:26
style critique welcome
21:27 a3gis left
+dalek p: 77d2a4b | TimToady++ | src/HLL/ (2 files):
\c is suppose to support control codes too
21:27
TimToady *supposed 21:28
raydiak (bash scripts with baby vocabulary only)++ 21:30
+dalek : 569850b | (Konrad Borowski)++ | util/update-design.perl6.org.sh:
Use short conditional for fast exit
21:31
moritz xfix++ 21:35
xfix (it's bash idiom)
(also in Perl)
lizmat TimToady: t/spec/S02-literals/quoting.t is failing compilation atm, maybe an nqp bump is warranted ? 21:36
21:39 Rounin left
TimToady I'm trying to sneak the \0 fix in with the same bump 21:42
+dalek p: a760e4e | TimToady++ | src/QRegex/P6Regex/ (2 files):
match \0 in regexland too
21:43
kudo/nom: ce1e747 | TimToady++ | tools/build/NQP_REVISION:
bump NQP
21:44
21:45 xfix left
TimToady lizmat: that should fix it 21:46
lizmat checks
21:47 rurban left 21:51 kjs_ joined 21:56 dakkar left
raydiak m: grammar G { token TOP { {say self.WHICH} } }; my $g = G.new; say $g.WHICH; $g.parse: "" # ? 21:58
+camelia rakudo-moar 3b9ebd: OUTPUT«G|50355888␤G|50356000␤»
TimToady cursors != grammars 21:59
in fact, every spot in your parse is a *different* cursor 22:01
masak folks, sergot and I have a little surprise for you.
over the Christmas weekend, we put together a small experimental language. 22:02
lizmat
.oO( it was christmas already? )
masak now we feel it's time to share it and get some early feedback.
this is especially true for people who would like to play around with Qtrees today. 22:03
+dalek osystem: c94bef4 | sergot++ | META.list:
add 007
masak please have a look at masak.github.io/007/
it's basically a minimal language that is nevertheless big enough to talk about itself. 22:05
the tutorial at masak.github.io/007/ is a little bit ahead of the language implementation. not a lot. 22:06
22:07 mickcy_ca joined
masak there are plenty of tests. 144 tests by last count. 22:09
raydiak somehow ++ doesn't cut it :) awesome job sergot & masak, exciting work 22:12
mickcy_ca Does anybody have any idea why pastebin.com/pqs0Q1Qa works and pastebin.com/1zPHb8dY does not???? The offending portion is ('('.+?')') (matches) vs '('(.+?)')' (fails)
masak raydiak: well, let's see how much mileage we can get out of it. in the best case, we'll be able to prototype some crazy macro ideas in 007. 22:13
raydiak: in the worst case, it was just a fun experiment in minimalism. 22:14
mickcy_ca You can see the diff at pastebin.com/diff.php?i=pqs0Q1Qa where line 16, 'change is here' is the matching one. 22:15
psch hrm, $*W.find_symbol gets me DEPRECATED, and calling it with nqp::call does happen, but the Deprecation for :from<java> doesn't show up :/ 22:18
raydiak masak: wish I could tell you I had some exciting ideas, but the whole thing makes my head spin every time I try to really grok it (every few days) 22:20
masak raydiak: "it"? 22:21
psch masak++ sergot++
raydiak masak: macro stuff in general
masak it is head-spinny, no doubt.
but I think it's slightly easier to understand in 007 than in Perl 6, actually.
'night, #perl6 22:27
mickcy_ca Never mind about the grammar I posted ... found a solution, but it is ugly. 22:29
pastebin.com/ak4sz7Ca
raydiak g'night masak 22:30
moritz masak++ # 007 22:44
mickcy_ca Back at regex's again ... I am having difficulty getting the results that I want. 22:45
This is related to the pastebins that I posted.
I want to explicitly match '(' and ')' outside of a capturing group. 22:46
psch m: say "(a)" ~~ token { '(' <-[)]>+ ')' } 22:47
+camelia rakudo-moar ce1e74: OUTPUT«「(a)」␤␤»
psch huh
oh the token of course matches everything
m: say "(a)" ~~ m:r{ ^ '(' (<-[)]>+) ')' $ }
+camelia rakudo-moar ce1e74: OUTPUT«「(a)」␤ 0 => 「a」␤␤»
22:48 mvuets left
psch :ratchet was no "no backtracking", i think..? 22:48
moritz yes, and token { } enables that
use regex { } if you want a backtracking regex
psch moritz: yeah, my confusion was actually not using the capture group in the anon token 22:49
mickcy_ca psch: that particular syntax is in my last pastebin ... I want '('(.+?)')' to match atcheting
m: say "(a)" ~~ m:r{('('.+?')')} 22:50
+camelia rakudo-moar ce1e74: OUTPUT«「(a)」␤ 0 => 「(a)」␤␤»
mickcy_ca Works here ... AAAARRRRGGGHHH
Oops wrong one ...
psch m: say "(a)" ~~ / '(' ~ ')' (.)/ # this also works
+camelia rakudo-moar ce1e74: OUTPUT«「(a)」␤ 0 => 「a」␤␤»
psch m: say "(a)" ~~ m:r/ '(' ~ ')' (.)/ # this also works 22:51
+camelia rakudo-moar ce1e74: OUTPUT«「(a)」␤ 0 => 「a」␤␤»
mickcy_ca Trying to parse on commas ... that is the reason for trying to match with .+?
m: say "(a)" ~~ m:r{'('(.+?)')'} 22:52
+camelia rakudo-moar ce1e74: OUTPUT«「(a)」␤ 0 => 「a」␤␤»
TimToady m: say "(aa)" ~~ m:r{'('(.+?)')'}
+camelia rakudo-moar ce1e74: OUTPUT«False␤»
TimToady that's a bug
? and ! are both supposed to override :r 22:53
mickcy_ca That explains it.
22:55 aborazmeh joined
mickcy_ca I can replace .+? with \S+ ... that seems to work to tokenize my string. 22:55
TimToady m: say "(aa)" ~~ m:r{'('(.+!)')'}
+camelia rakudo-moar ce1e74: OUTPUT«False␤»
TimToady that one should also work
except I think what's happening is actually that it's installing a : after the () 22:56
mickcy_ca say "(aa)" ~~ m:r{'('(\S+)')'}
m: say "(aa)" ~~ m:r{'('(.+!)')'}
+camelia rakudo-moar ce1e74: OUTPUT«False␤»
TimToady m: say "(aa)" ~~ m:r{'('(.+!):!')'}
+camelia rakudo-moar ce1e74: OUTPUT«False␤»
mickcy_ca say "(aa)" ~~ m:r{'('(\S+)')'}
TimToady m: say "(aa)" ~~ m:r{'('(.+!):?')'}
+camelia rakudo-moar ce1e74: OUTPUT«False␤»
mickcy_ca m: say "(aa)" ~~ m:r{'('(\S+)')'} 22:57
+camelia rakudo-moar ce1e74: OUTPUT«False␤»
mickcy_ca Worked in my string ....
22:57 Ven joined
TimToady now that one shouldn't match 22:57
mickcy_ca Not sure why it doesn't work on '(aa)'
TimToady \S matches ) and then can't backtrack
mickcy_ca Sorry about all of that ... I was experiencing some pasty finger obejibuts 22:58
Just looked at what matches here ...
m: say "(aa)" ~~ m:r{'('(\S+?)')'} 22:59
+camelia rakudo-moar ce1e74: OUTPUT«False␤»
TimToady it's the automatic marking of every matcher with a : that is preventing it from backtracking into the ()
m: say "(aa)" ~~ m:r{'('(.+?)**1')'} 23:00
+camelia rakudo-moar ce1e74: OUTPUT«False␤»
mickcy_ca Regex nightmares. 23:01
TimToady when you use m:r it translates '('(.*?)')' to something like '(': ( .*? ): ')': 23:02
it's the : after the capture that suppresses backtracking into the .*? when ')' is falsified 23:03
mickcy_ca If I understand correctly, tokens ratchet ... and I am trying to get this into a grammar.
moritz mickcy_ca: you can use 'regex' instead of 'token', or switch off ratcheting with :!r within a token 23:04
TimToady marking () with : is related to the notion of marking <foo> with a : to prevent backtracking into it, but I'm not entirely sure that was a correct decision back when it was made 23:05
to be sure, there are WATs with the other behavior as well
m: say "(aa)" ~~ m:r{'(' $<foo>=[.+?] ')'} 23:06
+camelia rakudo-moar ce1e74: OUTPUT«「(aa)」␤ foo => 「aa」␤␤»
TimToady m: say "(aa)" ~~ m:r{'(' $<0>=[.+?] ')'} 23:07
+camelia rakudo-moar ce1e74: OUTPUT«「(aa)」␤ 0 => 「aa」␤␤»
TimToady there's a workaround
'cause it only marks (), not []
moritz not having followed the whole conversation, is a a reason not to use <-[)]>* ? 23:08
TimToady arguably having to repeat the ) character is a smell 23:10
moritz and also if you want to get error messages, use '(' ~ ')' [ <-[)]>* ]
yes, I sometimes wondered if we want a primitive or built-in for that
23:11 aborazmeh left 23:12 BenGoldberg joined
mickcy_ca moritz: The reason for not using <-[)]>* is that I want to tokenize 23:13
int socket (int __domain, int __type, int __protocol)
TimToady in STD I think '(' ~ ')' would set $*GOAL to ')', so you could conceivably write '(' ~ ')' [<!before $*GOAL> .] or some such
moritz mickcy_ca: I don't understand what that means 23:14
mickcy_ca: I know what tokenizing it, and I don't see how it conflicts with using <-[)]>*
mickcy_ca I want to get the output... 23:15
23:15 virtualsue joined
mickcy_ca int 23:15
socket
int
__domain
int
__type
int
__protocol
TimToady well, .*? doesn't tokenize either
you really want a subrule there
23:15 jack_rabbit left
TimToady much like the p6 grammar looks for <parameters> there 23:16
mickcy_ca I realize that ... i am just at the stage of trying to get the entire contents of the parameter list as a string that I can split up in a subrule.
TimToady well, a seqence of <parameter> 23:17
which will break as soon as one of your parameters has () in it
like a function pointer, say 23:18
mickcy_ca To tokenize, I would use something to the tune of [(\w+) \s+ (\w+)]*
TimToady that won't even allow *
you really need subrules to stay sane 23:19
23:19 jack_rabbit joined
mickcy_ca Yes, and that is what I had planned for the subrule. 23:19
TimToady you can play fast and loose with ordinary regex, but tokens have to be a bit stricter, or your parse goes off on wild goose chases when you quantify something too general, such as . 23:21
mickcy_ca I guess that I could use (<-[) ]>*)\s*<-[),]>*\s* as a start anyway. 23:22
TimToady or something too strict, such as \w
moritz well, tokenizing would traditionally keep the parens, but as separate tokens
mickcy_ca I have noticed that using token the fast and loose way seems to work.
TimToady at some point the quick and dirty is not as quick as just writing the subrules you want :) 23:23
well, except it didn't, when you put () around it, which prevented backtracking into it
moritz but if you just tokenize, you have parse afterwards, and Perl 6 grammars won't help you if you have a custom token stream
mickcy_ca At least fast a loose sometimes works.
moritz so it might be more efficient (from a code development perspective) to do proper parsing right away 23:24
mickcy_ca I fully agree with that ...
TimToady but we -Ofun around here, so if you want to play with other approaches, we certainly won't stop you :) 23:25
if that's your idea of fun...
mickcy_ca Of course ... I realize that.
moritz 's idea of fun is, at this time of day, identical to sleeping 23:26
good night& 23:27
psch g'night moritz \o
mickcy_ca Nighty night ... late afternoon here.
TimToady there's an idea, though here it's more like nap time :)
mickcy_ca Here too.
TimToady zzz &
psch i realized my mistake with DEPRECATED \o/ 23:28
my branch is not up to nom HEAD, so deprecating with 2014.12 didn't work because i'm on 2014.11...
figuring out how to get Java fields to Perl 6 properly is gonna be an appropriate amount of fun as well 23:30
the first idea was just generating a method for the adaptor that's named the same as the field, but that's not rw
kjs_ moritz: ping 23:31
psch so now i'm thinking Proxy, but i think that needs some MOP-stuff to work, which i have no clue how to do
colomon psch: at its most basic, Proxy is very easy to use. 23:57
psch colomon: well, i'll have to generated bytecode for getters and setter inside the adaptor class, and a proxy on the perl6 class that calls those in FETCH and STORE respectively 23:59
colomon: the bit i'm stuck with is more the latter, i.e. telling perl6 that instantiating a class :from<Java> means it has to wrap all adaptors that belong to fields with Proxys