»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
timotimo at least they had lots of space on the discs for code ... except they put lots of FMV in there :D 00:01
pilne and they were limited on how much they could cram in the RAM as well, it really was quite a feat 00:02
00:04 roguelazer joined
timotimo oh, of course 00:04
i didn't consider that
pilne although i still have a code-crush on mr. carmack of Id fame 00:05
timotimo he's a cool one 00:06
00:09 mr-foobar left 00:10 mr-foobar joined
ugexe geekosaur: `PERL6LIB="inst#/home/perl6/custom" perl6 -e "use Text::Table::Simple; say 'ok'"` or `PERL6LIB="CompUnit::Repository::Tar#repos/Perl6-Text--Table--Simple.tar.gz" perl6 -e "use Text::Table::Simple; say 'ok'"` 00:11
(e.g. short identifier version, and full class-name version) 00:12
and does `PERL6LIB="..." prove -e 'perl6' ...` even carry the PERL6LIB env var through to new processes? 00:14
thought it would have to be (export PERL6LIB="..." prove -e 'perl6' ...)
raschipi If you put the variable asignement in the same line in the shell, it's exported to the command being executed right after it. 00:21
If it's in a line of it's own, you'll need to export it to get it to affect multiple commands.
timotimo and if you're using fish, it forces you to put "env" in front of any such assignments that go before a command 00:22
raschipi Well, that means it doesn't have the feature at all. 00:24
env is a program that does it, external to fish. 00:25
00:29 Skarsnik left 00:33 mcmillhj left 00:35 mcmillhj joined 00:38 Cabanossi left 00:41 Cabanossi joined, TEttinger joined
colomon is there a standard idiom for “run to completion” for Procs spawned by run? 00:42
seems like $proc.out.slurp works, but that seems roundabout
raschipi The docs have 'say $p.out.slurp: :close;' 00:49
Geth doc: flussence++ created pull request #1361:
Small IO guide formatting fix
00:53
00:56 sivoais_ left 01:00 lookatme joined
lookatme morning .o/ 01:00
ugexe so run '...'; 01:08
01:08 sivoais joined 01:09 mr-foobar left 01:10 aborazmeh joined, aborazmeh left, aborazmeh joined 01:14 mr-foobar joined
colomon ugexe: “so run” definitely doesn’t do it? 01:25
afk 01:31
01:42 tardisx joined, TEttinger left 01:44 ilbot3 left 01:47 ilbot3 joined, ChanServ sets mode: +v ilbot3 01:53 mcmillhj_ joined 01:58 mcmillhj_ left 02:09 mr-foobar left 02:11 mr-foobar joined 02:33 labster left, labster joined 02:39 Cabanossi left, mr-foobar left 02:40 TEttinger joined, Cabanossi joined 02:43 mr-foobar joined, noganex joined 02:46 noganex_ left 02:53 mullagainn left 03:02 pilne left 03:04 mcmillhj left 03:08 Cabanossi left, mr-foobar left 03:10 Cabanossi joined 03:11 mr-foobar joined 03:22 fatguy joined
Geth doc: 791f267502 | (Will "Coke" Coleda)++ | xt/code.pws
learn new code snippet
03:22
03:28 AlexDaniel left 03:39 raschipi left, mr-foobar left
ugexe m: say now; say so run "perl6", "-e", "sleep 5"; say now 03:41
camelia Instant:1496720499.957286
run is disallowed in restricted setting
in sub restricted at src/RESTRICTED.setting line 1
in sub run at src/RESTRICTED.setting line 14
in block <unit> at <tmp> line 1
03:43 mr-foobar joined
ugexe really just need to sink it 03:45
say now; run( "perl6", "-e", "sleep 5", :out ) andthen *.out.close; say now 03:47
evalable6 (exit code 1) Instant:1496720959.972139
run is disallowed in restricted setting
in sub restricted at src/RESTRICTED.setting line 1
in sub run at src/RESTRICTED.setting line 14
in block <unit> at /tmp/xLUoZS2u4V line 1
03:53 Cabanossi left
[Coke] .tell pmurias build for rakudo/js fails on OS X for me. 03:53
yoleaux [Coke]: I'll pass your message to pmurias.
03:55 Cabanossi joined
[Coke] (ah, due to self-signed certs) 03:56
03:57 Cabanoss- joined 04:01 Cabanossi left, Cabanoss- is now known as Cabanossi
fatguy is there 'Carp' 'Croak' in perl 6 ? 04:11
zengargoyle_ there are Exceptions... 04:19
m: fail "oops"
camelia oops
in block <unit> at <tmp> line 1
zengargoyle_ i think they work a bit different than die/carp/croak but basically handle the same purpose. 04:20
04:27 KDr2 joined 04:33 khw left 04:35 aborazmeh left 04:37 curan joined 04:39 skids left, mr-foobar left 04:40 mr-foobar joined
fatguy look the same 05:06
05:14 Cabanossi left 05:16 Cabanossi joined 05:17 khisanth_ left 05:23 lowbro joined, lowbro left, lowbro joined 05:30 khisanth_ joined 05:40 mr-foobar left 05:43 mr-foobar joined 05:45 Cabanossi left 05:46 Cabanossi joined 05:49 BenGoldberg left 05:51 xtreak joined 05:52 BenGoldberg joined 05:56 nadim joined 05:58 lookatme left, lookatme joined 05:59 BenGoldberg left, drrho_ left 06:04 BenGoldberg joined 06:09 mr-foobar left 06:11 domidumont joined 06:12 BenGoldberg left, mr-foobar joined 06:15 domidumont left 06:16 domidumont joined 06:28 ceevusee left 06:34 domidumont left, domidumont joined, wamba joined 06:40 mr-foobar left
fatguy how to set schema using DBlish ? 06:42
06:44 mr-foobar joined 06:48 dj_goku left, dj_goku joined, dj_goku left, dj_goku joined, wtw joined, m0ltar left 06:50 hahainternet joined, m0ltar joined, shmibs left 06:52 shmibs joined 06:55 Actualeyes left 07:01 pecastro left 07:08 mr-foobar left, Actualeyes joined 07:12 mr-foobar joined 07:14 Cabanossi left
moritz fatguy: what do you mean by "set schema"? 07:14
lizmat colomon: could it be that the program you run is async? in other words, it returns immediately and keeps playing? 07:16
07:16 Cabanossi joined
lizmat run() appears to wait until completion for me: 07:17
$ time perl6 -e 'run <sleep 10>'
real0m10.160s
07:18 simonm_ joined
lizmat clickbaits p6weekly.wordpress.com/2017/06/05/...illed-tap/ 07:18
tyil already read it
oh wait 07:19
its tuesday
lizmat: p6 meetup tonight in amsterdam?
lizmat yes, afaik
tyil eater: ^
lizmat we'll be going there
tyil u must cum
lizmat there's only the tiny matter of not having one with a key to TechInc at 6pm 07:20
tyil hmm
isnt there a p6 module to solve this
07:21 simonm left
eater /f then 07:29
k 07:30
07:32 cgfbee left 07:36 pecastro joined 07:39 mr-foobar left
lizmat eater tyil looks like the key issue at TechInc tonight is fixed 07:41
07:41 cgfbee joined
tyil lizmat: yay :D 07:42
otherwise just apply TIMTOWTDI to the opening the door :'D
lizmat actually, it's 3 doors we need to get through :-)
07:43 mr-foobar joined
fatguy moritz: www.postgresql.org/docs/current/st...hemas.html 07:43
07:44 Cabanossi left
moritz fatguy: I guess you could execte the "SET search_path ..." with a .do call 07:45
07:46 Cabanossi joined, leont joined
leont I'm trying to name a role Scalar, and rakudo is rather complaining about it 07:46
Is that supposed to be illegal?
HMmm, minimal test case doesn't bomb, let's see if I can find the trigger 07:48
07:48 khw joined
fatguy moritz: ok, so there's no parameter to handle that 'set search_path' on .connect call ? 07:48
07:49 salv0 joined
lizmat benchable6: help 07:52
benchable6 lizmat, Like this: benchable6: f583f22,HEAD my $a = ‘a’ x 2¹⁶; for ^1000 {my $b = $a.chop($_)} # See wiki for more examples: github.com/perl6/whateverable/wiki/Benchable
moritz fatguy: not that I'm aware of 07:53
lizmat benchable6: 2017.05,HEAD my @w = ^50 .map( { my $now = now; run <<perl6 -e "">>; ((now - $now) * 1000).Int }); say @w.sum/@w
benchable6 lizmat, starting to benchmark the 2 given commits
lizmat, benchmarked the given commits, now zooming in on performance differences
lizmat, ¦2017.05: ««run failed, exit code = 1, exit signal = 0»» ¦HEAD: ««run failed, exit code = 1, exit signal = 0»»
domm1 fatguy: you could do "alter database foo set search_path to bar,public", but that's probably not what you want
07:54 domm1 is now known as domm
fatguy moritz: thanks ! 07:56
lizmat committable6: help
committable6 lizmat, Like this: committable6: f583f22,HEAD say ‘hello’; say ‘world’ # See wiki for more examples: github.com/perl6/whateverable/wiki/Committable
fatguy domm1: yes, i just want to change it on particular connection 07:57
lizmat m: my @w = ^50 .map( { my $now = now; run <<perl6 -e "">>; (now - $now) * 1000 }); say (@w.sum/@w).fmt("%.2f")
camelia run is disallowed in restricted setting
in sub restricted at src/RESTRICTED.setting line 1
in sub run at src/RESTRICTED.setting line 14
in block <unit> at <tmp> line 1
lizmat argh
07:57 g4 joined 07:58 g4 left, g4 joined, parv joined
leont evalable6: role Scalar {}; my $foo; 08:00
evalable6 (exit code 1) ===SORRY!===
You cannot create an instance of this type (Scalar)
leont That is a bug, right?
08:01 dakkar joined
leont It shouldn't look up the Scalar container by name in the local namespace, that doesn't make sense 08:01
moritz that's not quite ironed out, I think 08:04
08:07 leont left 08:09 mr-foobar left 08:11 mr-foobar joined 08:15 wamba left 08:25 fatguy left 08:30 khw left 08:38 mr-foobar left 08:41 mr-foobar joined 08:43 Cabanossi left 08:46 Cabanossi joined 08:53 parv left 09:06 pmurias joined
pmurias hi 09:06
yoleaux 03:53Z <[Coke]> pmurias: build for rakudo/js fails on OS X for me.
pmurias [Coke]: how does it fail? 09:07
09:08 lookatme left 09:09 wamba joined, mr-foobar left, lookatme joined 09:10 lizmat left 09:11 mr-foobar joined 09:13 kst left 09:14 kst joined 09:21 xtreak left 09:22 robertle joined 09:24 xtreak joined 09:30 xtreak_ joined 09:31 xtreak left 09:33 lizmat joined 09:39 mr-foobar left 09:41 TEttinger left 09:42 mr-foobar joined 09:44 Cabanossi left 09:46 Cabanossi joined 09:48 lookatme left 09:54 nadim left 10:09 rindolf joined 10:10 mr-foobar left 10:12 mr-foobar joined
tbrowder hi, #perl6! 10:13
two questions ref current state of IO: 10:14
10:15 kurahaupo_ joined
tbrowder 1. how can i get the line number of a file handle, "$fh.ln"? i think i read that in Znet's final grant report but i don't see it in docs (need to search...) 10:16
10:18 kurahaupo left, wamba left 10:19 astj_ joined, astj left
tbrowder 2. i just saw that file handles don't automatically close when going out of scope, is that ever going to change? 10:19
nine tbrowder: 2. no. That's just an artifact of Perl 6 not using reference couting. 10:20
jnthn On 2 - no, because that relies on reference counting.
heh ;)
tbrowder ok, i need to change my habits! thanks 10:23
jnthn And resons not to reference count are 1) avoiding the circular reference problem, 2) it can become a huge source of contention in parallel programs, and 3) because it'd prevent Perl 6 from running on things like the JVM which are themsleves not reference counted.
10:23 sivoais left
nine OTOH we have LEAVe phasers 10:24
10:26 webart left
samcv tbrowder, if you use slurp then use slurp(:close) for example if slurping a file handle 10:33
if you do: my $cmd = run 'echo', 'hi', :in, :out; if you don't access .in or .out do you still need to close them? 10:34
jnthn samcv: Yes
samcv ok :)
i have not done that most times 10:35
jnthn Well, yes-ish in that Proc is about to be re-worked in terms of Proc::Async
tbrowder samcv: thanks. but why would slurp not auto close?
jnthn Which may well end up making it "not matter"
10:35 cognominal left
samcv tbrowder, that's how it works 10:35
idk
jnthn slurp does auto-close if you use the slurp($filename) or slurp($some-io-path)
10:35 wamba joined
samcv yeah 10:35
jnthn It's only .slurp on an already opened handle that does not
So if you
samcv that doesn't ever return a handle though
jnthn my $stuff = slurp('filename') you're totally fine
10:36 cognominal joined
tbrowder ok, my use of slurp so far is safe. 10:36
jnthn It's only my $fh = open 'filename', :r; my $stuff = $fh.slurp; that would leak a handle if .close isn't called
tbrowder on the run output, my use says the out and err are strings, not file handles, so why do they need to be closed? lazy? 10:37
ignore my ? on run for the moment, got to check my veracity... 10:39
10:40 mr-foobar left 10:41 AlexDaniel joined
tbrowder ok, ref run: doesn't .slurp-rest close the file? 10:42
10:43 Cabanossi left 10:44 mr-foobar joined
jnthn That'd need :close, although a plain .slurp works just as well as .slurp-rest these days, and .slurp(:close) isn't much longer than .slurp-rest 10:46
10:46 Cabanossi joined 10:50 kurahaupo_ is now known as kurahaupo
tbrowder i don't see slurp :close in docs... 10:50
10:51 nadim joined
tbrowder ref non-auto close on file handles needs a mention in "Traps..." 10:51
jnthn docs.perl6.org/routine/slurp#class...A%3AHandle 10:52
10:56 lizmat left
tbrowder oops, picked sub slurp! thanks. :close is not searchable 10:59
11:02 lizmat joined 11:05 AlexDaniel left 11:09 mr-foobar left 11:14 mr-foobar joined, Cabanossi left 11:16 Cabanossi joined 11:22 xtreak_ left 11:23 simonm_ left 11:28 Zoffix joined
Zoffix tbrowder: we don't need to put everything in traps. It's not a trap. It's how the language works. The handle closure is mentioned in at least two places. 11:29
tbrowder: it's not lack of auto-close, buylt close on GC, not scope leave. And many routines offer :close argument 11:30
tbrowder: and .slurp-rest will be deprecated on 6.d. Use slurp
tbrowder: .err and .out on Proc are IO::Pipes. I've no idea how you get them to be stringa. 11:31
11:31 nadim left
tbrowder Zoffix: ref yr last comment: i said ignore the question because i remembered i was working on the slurped file (pipe) 11:35
11:36 KDr2 left
tbrowder Zoffix: any way to get line number on a file handle? 11:38
colomon lizmat: I don’t think so? certainly it doesn’t if you call it directly from the command line.
11:40 mr-foobar left
Zoffix tbrowder: no 11:40
tbrowder t'anks 11:41
Zoffix tbrowder: you can use lines.kv on data
and the index will be line number - 1
11:42 mr-foobar joined
tbrowder ah, that's it: k is index, v is string, n'est ce pas? 11:42
Zoffix yes
11:42 Zoffix left
tbrowder thanks (still looking for need to close file handle in docs...) 11:43
colomon wonders why he has never had problems with too many file handles open from “run”…
11:44 Cabanossi left
timotimo .o( the loneliness~ of the long distance runner~ ) 11:45
tbrowder ah, there it is in your new IO doc!!
11:45 araraloren joined 11:46 raschipi joined
araraloren ^_^ 11:46
11:46 Cabanossi joined
raschipi colomon: You just never hit the limit, probably. 11:53
yoleaux 10:01Z <Zoffix> raschipi: no, I don't want chdir to do any magiks with '-' paths. IMO the fact that it .open treats it magically is unwanted in itself
timotimo the limit might also differ between distros 11:54
lizmat colomon: well, I don't have another explanation 11:57
raschipi Zoffix: Fair enough. I was just interested in what the plans were.
11:58 wamba left 12:00 vetmaster joined
raschipi Debian has a recommended limit of 20 filehandles open at the same time for each user in a multi-user system. 12:00
So it can be very low. 12:01
12:01 zakharyas joined
vetmaster could you suggest some docs on working with extracted tokens/rules? 12:01
I saw one two days ago, but today I can't find it again.. 12:02
12:02 isacloud_ left 12:03 wamba joined 12:04 kyan left
Geth doc: 285a45c77a | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Handle.pod6
Duplicate note about the need to close handle

in .open docs
12:08
doc: bc1d0e8266 | flussence++ (committed by Zoffix Znet) | doc/Language/io-guide.pod6
Add missing `=for code` on one paragraph (#1361)

On docs.perl6.org/language/io-guide this bit was rendering as plain body text. I decided against putting `=begin code`..`=end code` around the whole area in case someone else might want to add exposition in between later.
12:09
12:09 mr-foobar left 12:12 mr-foobar joined
zengargoyle_ raschipi: is that 20 total or per user process? 12:20
raschipi Each user. 12:22
Enforced by pam_limits
zengargoyle_ that's pretty low, i don't think i've ever seen a limit set below 1024 in my life.
nine That's ridiculously low 12:23
zengargoyle_ is that diferent than `ulimit -n` or something?
raschipi It's just documented, not enforced by default.
It's what the users are allowed to set in their ulimit. 12:24
zengargoyle_ that's only like 6 processes with in/out/error
12:25 vetmaster left, vetmaster joined
raschipi The example is for a multi-user system where aumini, faculty and staff have remote access, so it's extreme. 12:25
kurahaupo raschipi: per user or per user process? the latter seems more likely 12:29
Geth doc: 259d86899d | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Path.pod6
Fix example output; dogbert17++
raschipi limits.conf(5) 12:30
kurahaupo per-user limits that share across processes generally need to be enforced by a quota server; limits.conf sounds more like per process 12:31
ilmari according to the man page the limits are per-session (except maxlogin, which is system wide) 12:33
kurahaupo (and the limit is the number of filedescriptors, each of which may be shared between prices and with multiple fd numbers, so the controlling tty counts as only 1, even if it's used for stdin, stdout & stderr)
ilmari nproc wouldn't make much sense per-process
tbrowder ref using IO.lines.kv for file line number in k: any clever way to increment it before the block so first line is number 1 instead of 0?
kurahaupo processes*
20 open files per process was the typical limit in 1980's Unix systems 12:34
[Coke] tbrowder: at that point, I'd just have my own var. either way you're adding 1 to something every time through the loop. 12:35
12:38 firefu joined
[Coke] If someone's looking for a way to help out the docs with only knowing a little perl 6, github.com/perl6/doc/issues/1366 could use some work. Happy to answer any questions about individual code blocks that aren't currently compiling. 12:39
12:39 mr-foobar left
raschipi Reading the docs for pam_limits, it says these limits are for each user session, and the max number of sessions can also be configured. 12:40
Geth doc: 16e596268a | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Path.pod6
Fix .extension examples; dogbert17++
12:41
12:42 firefu left 12:43 mr-foobar joined
tbrowder [Coke] thanks, at least the kv method allows scoping thr line number var, a bit of cleanness. 12:43
12:44 Cabanossi left
pmurias [Coke]: any hints how rakudo.js is failing to build on your machine? ;) 12:46
12:46 Cabanossi joined
[Coke] pmurias: noted immediately after; self-signed certs (when grabbing js modules to install) 12:47
so I can't install any (most?) of the JS you pull in, so boom.
tbrowder ah, Zoffix just showed a clever way to avoid an increment: "once next;" as the first expression in the block...trying it now... 12:48
[Coke] This is on $dayjob's laptop, so it's possible there's a security issue other users won't face.
rightfold Did a fun exercise :) glot.io/snippets/eqjxhomm0r
[Coke] tbrowder: then you lose your first line.
rightfold: I am glad you had fun, but that looks like brain hurty math. 12:50
(and I had an engineering degree with lots of math.) 12:51
rightfold For this you need to understand lambda calculus and elementary set theory.
tbrowder i would lose it anyway with an increment, and this should be more efficient
12:52 nadim joined
tbrowder for purists 12:52
i'm used to emacs alwas counting lines from 1 (and i think other gnu tool also) while most every thing else is indexed from zero 12:54
12:56 mcmillhj joined
tbrowder yep, grep does the same with -n 12:56
13:02 xtreak joined 13:04 Xiaoyafeng joined
Xiaoyafeng Hi! I 13:04
Hi!
pmurias [Coke]: what's your node.js/npm version? 13:05
Xiaoyafeng I have a question: how set lib directory in nativecall like gcc-L does? 13:06
13:06 xtreak left 13:07 g4 left
daxim andrewalker, I don't know whether this counts as impolitely sticking my fingers into your pot; I want to request some db design constraints for your grant which I think will be useful and potentially save some extra work down the road: 13:08
1. comments need to be hierarchical and addressable, this way we can import the "use.perl.org" articles and comment archive without loss of fidelity.
2. user management needs to support merging identities, because on b.p.o article authors and commenters are already different identities and this is a favourable moment to clean up some mess.
if you agree, no need to edit the grant proposal, I think the constraints are compatible with the text as is.
Xiaoyafeng Oops..... 13:09
p6:say 3
. 13:10
andrewalker daxim: yes, I agree. It's really weird that b.p.o. authors and commenters are different identities, this should definitely be fixed. And 1. also makes sense, shouldn't be a problem.
13:11 xtreak joined, mr-foobar left
daxim excellent 13:11
andrewalker daxim: thanks for the input :)
13:12 aborazmeh joined, aborazmeh left, aborazmeh joined, mr-foobar joined 13:13 xtreak left, xtreak joined, curan left
raschipi Xiaoyafeng: "-I path" adds the path to the module search path 13:14
13:15 mspo left 13:16 skids joined
raschipi For nativecall, you can use the full path. 13:17
13:17 Xiaoyafeng left, xtreak left 13:18 webart joined
Geth doc: 1463ef1272 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/traps.pod6
List \qq[] as an easier alternative for avoid interpolation issues
13:32
13:35 skids left 13:40 mr-foobar left 13:41 mr-foobar joined
zengargoyle_ at least way back when, if you had your own .so that wasn't in a regular place, and if it was one you built yourself and were going to install with a module... you put it under resources/lib/*.so 13:42
Geth doc: b6507d5bf8 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/traps.pod6
Add IO::Path stringification to traps

  'cause it's unlikely people will end up reading IO::Path.Str docs,
and misused stringification isn't instantly apparent.
13:43
zengargoyle_ and then wrote a sub library to find it in %?RESOURCES and then used is native(&library). 13:44
13:44 hartenfels joined
Geth doc: 725cb4e056 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/traps.pod6
reword; fix broken L<>
13:47
13:48 zakharyas left
zengargoyle_ seems like it would be nice if is native checked the normal .so loading and then tried from %?RESOURCES{"lib/$libname"} automagically. 13:49
vetmaster I want to get all symbols except "/", "-" and "." literally 13:50
<-["/" | "-" | "."]>+
compiler says that's wrong
<-["/" | "-⏏" | "."]>+ 13:51
WAIDW?
araraloren m: say "ABC/as" ~~ m/<-["/" "-" "."]>+/;
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of - as character range; in Perl 6 please use .. for range, for explicit - in character class, escape it or place it as the first or last thing
at <tmp>:1
------> 3say "ABC/as" ~~ m/<-…
araraloren m: say "ABC/as" ~~ m/<-[/\-\.]>+/;
camelia 「ABC」
araraloren quote is unnecessary 13:52
vetmaster ok
[Coke] pmurias: node v6.10.3, npm 3.10.10 13:55
13:57 cyphase left 13:59 Cabanossi left 14:01 Cabanossi joined 14:02 eyck left, eyck joined 14:04 travis-ci joined
travis-ci Doc build failed. Zoffix Znet 'Add IO::Path stringification to traps 14:04
travis-ci.org/perl6/doc/builds/239970312 github.com/perl6/doc/compare/1463e...507d5bf8fb
14:04 travis-ci left 14:06 kyan joined
vetmaster how to match a token after a literally written string? 14:08
the string: " ~ "
14:08 lizmat left
vetmaster I try doing this: <" ~ "> <token> 14:09
moritz just " ~ " <token>
14:09 mr-foobar left 14:11 mr-foobar joined
tbrowder another question: is there any safe way to "alias" a built-in sub or method so that one can have "default" settings such as :close on .spurt? subclass maybe? 14:12
14:12 raiph joined
araraloren wrap ? 14:13
m: sub f(:$close) { say $close; }; f; &f.wrap(sub (|c) { callwith(|c, :close); };); f; 14:15
camelia (Any)
Too many positionals passed; expected 2 arguments but got 3
in block <unit> at <tmp> line 1
araraloren m: sub f(:$close) { say $close; }; f; &f.wrap(sub (|c) { callwith(|c, :close); }); f;
camelia (Any)
True
araraloren tbrowder, ↑
tbrowder as in a sub? i think that would do it in lots of cases, but how about adverbs on containers?
14:17 Actualeyes left
tbrowder ah, wrap, more advanced usage to play with... 14:17
thanks, araraloren
14:18 cyphase joined
araraloren em, tbrowder, also wrap maybe not lightweight 14:22
m: sub f(:$close) { say $close; }; my &z = -> |c { f(|c, :close); }; &z();
camelia True
14:22 travis-ci joined
travis-ci Doc build failed. Zoffix Znet 'reword; fix broken L<>' 14:22
travis-ci.org/perl6/doc/builds/239971719 github.com/perl6/doc/compare/b6507...5cb4e0568b
14:22 travis-ci left 14:28 pmurias left, cyphase left 14:31 lowbro left, Actualeyes joined 14:32 vetmaster left, lizmat joined 14:33 cyphase joined 14:34 AlexDaniel joined 14:41 Skarsnik joined 14:43 Zoffix joined
Zoffix I don't get why that ^ fails. The =end code is for the =begin code :/ 14:43
14:43 MasterDuke left
Geth doc: deeca520d9 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/traps.pod6
Fix L«»
14:44
Zoffix Never mind
14:44 Zoffix left 14:45 Zoffix joined
Zoffix tbrowder: you want .assuming docs.perl6.org/routine/assuming 14:46
Don't wrap core routines. It affects the entire program. perl6.party/post/Exploiting-Perl-6...ency-Chain
14:46 Zoffix left 14:48 domidumont left 14:49 domidumont joined
Geth doc: 82895bb2b3 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/Callable.pod6
Include named params in .assuming docs
14:53
14:56 khw joined
Geth doc: 6a870130f7 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/Callable.pod6
Add examples of other Callables in .assuming docs
15:02
tbrowder Zoffix: that's it! and i assume you can assign the callable to a var? 15:03
15:04 skids joined
tbrowder Thanks! 15:04
anyone working on a p6 linter? 15:05
15:06 domidumont left
Geth doc: d4391cf568 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/Callable.pod6
Fix .assuming example

Not sure why I wrote half of it talking about .wrap >_<
15:08
tbrowder i'm starting my own simple one to catch my stupid mistakes, first two are mismatched pod =begin/=end pairs, second is unclosed open :w 15:09
perlpilot tbrowder: you using DrForr's Perl 6 parser? 15:10
tbrowder s/two are/one is/ 15:11
15:14 aborazmeh left 15:22 lizmat left 15:24 simonm joined 15:28 nadim left
tbrowder no, i haven't tried it yet; would it catch those? 15:31
15:32 cdg joined 15:36 travis-ci joined
travis-ci Doc build passed. Zoffix Znet 'Include named params in .assuming docs' 15:36
travis-ci.org/perl6/doc/builds/239998632 github.com/perl6/doc/compare/deeca...895bb2b39d
15:36 travis-ci left
Juerd How can I have a subtype of Array with a few extra methods, and then declare a @-sigiled variable? 15:40
15:41 TeamBlast left 15:44 TeamBlast joined 15:47 travis-ci joined
travis-ci Doc build passed. Zoffix Znet 'Fix L«»' 15:47
travis-ci.org/perl6/doc/builds/239994371 github.com/perl6/doc/compare/725cb...eca520d9e9
15:47 travis-ci left 15:48 lizmat joined
araraloren Juerd, maybe augment : docs.perl6.org/syntax/augment 15:49
jnthn Argh, not augment :P
m: class MyArray is Array { method hi() { say "it's me!" } }; my @a is MyArray; say @a.hi 15:50
camelia it's me!
True
jnthn ah, two says
But anyways, like that :)
perlpilot Juerd: you can also mixin a role with your extra methods into an already declared @array. 15:51
Juerd Ah, "is". Thanks! 15:52
araraloren That's greater than augment! 15:53
Juerd Yeah, I'd rather not augment for such a specific use case :)
I need a stack of things, and it needs to be pretty-printed and checked for consistency. I like to use methods instead of functions for something like that.
15:54 cdg left
raschipi Juerd: Write a Str(MyArray: --> Str) method in that derived class and you'll be able to interpolate it. 15:55
araraloren jnthn, Is there anyway to do what RAII does ? 15:56
Juerd raschipi: Oooh, very fancy!
raschipi: I've written Str's for my other classes but for some reason I didn't think of it for this one :) 15:57
araraloren jnthn, Or Perl6 will add some operator like `with` in python or C#
perlpilot araraloren: Perl 6 already has such things, they're just spelled different. :-) 15:59
jnthn I think adding something like Python's with or C#'s using would be the way to go for Perl 6
We already took with :)
rightfold In F# you write `use` instead of `let` 16:00
No body but just a variable declaration
araraloren perlpilot, do you mean DESTROY, but that's depend on GC. Actually it's not useful for RAII 16:01
jnthn, Oh, great!
jnthn using isn't bad 16:03
closing may work
rightfold One could imagine `use $x = f();` as sugar for `my $x = f(); LEAVE { $x.close(); }`.
jnthn But I tend to leave the naming bits of language design to others and worry about the semantics, where there's less bikeshedding ;) 16:04
perlpilot araraloren: I was thinking more about our various phasers, but yeah, that would be more verbose than python's `with`
16:05 travis-ci joined
travis-ci Doc build passed. Zoffix Znet 'Add examples of other Callables in .assuming docs' 16:05
travis-ci.org/perl6/doc/builds/240001971 github.com/perl6/doc/compare/82895...870130f72a
16:05 travis-ci left
Juerd Is there a shortcut to get .^name without the package? 16:06
16:08 sivoais joined
raschipi Juerd: Tell us what you really want. 16:08
Juerd Objects that stringify to the last part of their class name 16:09
perlpilot Juerd: like a Foo::Bar::Baz object would stringify to "Baz" ?
Juerd Yes
In my use case, Command::is-at that stringifies to is-at, or Command::help that stringifies to help
jnthn m: class Foo::Bar {}; say Foo.^shortname 16:10
camelia Foo
Juerd Almost :)
jnthn m: class Foo::Bar {}; say Bar.^shortname # even :)
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
Bar used at line 1. Did you mean 'Bag'?
jnthn grr!
m: class Foo::Bar {}; say Foo::Bar.^shortname # even :)
camelia Bar
jnthn There we go
Juerd Great, thanks :)
jnthn It really is time to go home for dinner :)
16:11 simonm left 16:12 wamba left
araraloren night . 16:14
\o.
16:14 araraloren left 16:15 travis-ci joined
travis-ci Doc build passed. Zoffix Znet 'Fix .assuming example 16:15
travis-ci.org/perl6/doc/builds/240004461 github.com/perl6/doc/compare/6a870...391cf56871
16:15 travis-ci left 16:18 robertle left 16:23 cdg joined
Juerd I don't understand why try { something that dies; CATCH { error handling } } dies after the error handling 16:26
I put in the CATCH hoping it would prevent the dieing :) 16:27
Skarsnik yeah it's weird
tbrowder um, Perl6::Parser fails using zef install Perl6::Parser, cant't find Perl::Parser::Factory
Juerd Is there a way of handling errors that in effect causes the rest of the try block to be skipped, as eval { ... } would do in Perl 5? 16:28
16:29 lizmat left
Skarsnik I think it was supposed to happen ? 16:29
16:30 itaipu joined
Skarsnik the catch is not outside the try? 16:33
Juerd Should it be?
Skarsnik I do'nt remember ^^
raschipi Juerd: do you have a default in the CATCH block?
Juerd No 16:34
raschipi CATCH is a phaser, it will run when there's an exception and goes inside the block.
Skarsnik docs.perl6.org/language/exceptions...blocks-try
inside
raschipi So the CATCH won't catch anything.
Without 'when' or default, the exception is raised again. 16:36
Juerd m: ().tail.this-method-probably-doesn't-exist
camelia ( no output )
stmuk_
Juerd Is that not supposed to blow up?
stmuk_ l
oops 16:37
raschipi Juerd: That returns a failure, it will blow up if you try to use the value. 16:38
m: say so ().tail.this-method-probably-doesn't-exist 16:39
camelia False
Juerd m: my $x = ().tail.this-method-probably-doesn't-exist; say $x;
camelia (Any)
Juerd Doesn't look like a failure though
16:40 cdg left, Zoffix joined
Zoffix Juerd: you're missing `default` {} block in your CATCH. Could that be the reason? 16:40
raschipi It's returning Nil, which is a failure. It will fail if you test for either truth or definedness.
Zoffix Nil isn't a Failure. it's a Nil
And calling non-existent method on Nil returns a Nil 16:41
raschipi Yeah, I'm realizing that now. Shouldn't it be a failure? Or just Nil?
Oh, Ok, Nil itself is special cased.
Zoffix Well, unless it's a Failure. Then calling a method on it explodes it 16:42
(Failure is Nil)
16:43 dakkar left
raschipi So, Juerd: it's Nil all the way down. 16:44
Zoffix And unless you hit the brokenedness...
m: Nil.contains: 42
camelia Invocant of method 'contains' must be an object instance of type 'Cool', not a type object of type 'Nil'. Did you forget a '.new'?
in block <unit> at <tmp> line 1
raschipi ().tail returns Nil, so you can call any method on it and it will just return Nil. 16:45
16:45 Cabanossi left 16:46 Cabanossi joined
Zoffix tbrowder: that's because its META file is missing most of the files the distro provides. Clone it. fix the meta file `provides` key to list all the files, then run zef install . and send a PR to DrForr_++ to fix the issue 16:47
16:48 cdg joined
Zoffix m: {{{ die; CATCH { .^name.say } }; CATCH { "oh hello".say } }; CATCH { default { .^name.say } } }; CATCH { 'meows'.say } 16:54
camelia X::AdHoc
oh hello
X::AdHoc
Zoffix TIL
raschipi m: {{{ die; CATCH { .^name.say } }; CATCH { "oh hello".say } }; }; CATCH { 'meows'.say } 16:56
camelia X::AdHoc
oh hello
meows
Died
in block at <tmp> line 1
in block <unit> at <tmp> line 1
raschipi m: {{{ die; CATCH { .^name.say } }; CATCH { "oh hello".say } }; }; CATCH { default {'meows'.say} }
camelia X::AdHoc
oh hello
meows
16:57 nowan left 16:58 webart left
raschipi m: {die 'croak'; }; CATCH { default { .payload.say} } 16:58
camelia croak
16:59 lizmat joined
raschipi A CATCH block outside the block will catch the exception because it's raised again when nothing inside the block deals with it. 17:00
17:00 nowan joined 17:01 wamba joined 17:06 Zoffix left 17:08 ZofBot left 17:09 ZofBot joined, ChanServ sets mode: +v ZofBot 17:10 eliasr joined
Juerd Re default { }: I left the default out because I had only one generic error handler. 17:10
17:11 hartenfels left
Juerd I find it aesthetically unpleasing to have CATCH { default { ... } }, but apparently I have little choice 17:11
raschipi That's exactly what default is for
Juerd Right - I thought it'd be like given/when, where default can be left out.
raschipi If you wanted to get an specific type of exception, you would use CATCH{ when X::Specific { ...} }
Juerd Nope, I just want to print an error message and abort a current transaction. 17:12
This program may not die.
Adding default { }, although it doesn't look very elegant, solves the issue :)
raschipi Throw an specific type of Exception and catch just that. 17:13
docs.perl6.org/type/Exception --> creating your own exceptions is easy. 17:14
class X::YourApp::SomeError is Exception {method message() {"A YourApp-Specific error occurred: out of coffee!";}} 17:15
17:17 zakharyas joined
raschipi If any other type of exception ends up raised, note or log it at least, to aid debugging 17:17
Besides reverting the transaction.
Juerd raschipi: Normally I would do that, but it doesn't fit this use case very well.
A generic approach works well here, and saves me lots of code. 17:18
raschipi Don't forget to log what happened, at least.
17:19 pilne joined 17:20 andrei joined, kaare_ left
Juerd raschipi: Not even relevant in this case. It's an interactive thing, and the operator has to deal with any fallout anyway, and after that, it will never again matter... 17:20
raschipi You know things can be resumed from the poin t where they were raised, right? 17:21
andrei my @a = <aa bb cc> ; for @a ( -> $x { $x.say } )
why that above does not work?
raschipi andrei: It's expecting a block after the 'for @a', but it finds '(' 17:22
andrei I am a beginner, sorry. I thought parenthesis are just for grouping 17:23
17:23 wamba left
andrei The block is -> $x { $x.say } 17:23
raschipi They can group where P6 expects a group
m: my @a = <aa bb cc> ; for @a -> $x { $x.say }
camelia aa
bb
cc
andrei This is misterious...
17:24 grumble is now known as grumble2
raschipi Do you know any other programming language? 17:24
17:24 wamba joined
andrei Yes, some Python 17:24
17:24 grumble joined 17:25 kaare_ joined
andrei and some Haskell 17:25
In Haskell, parehtesis are just for precedence... I guess P6 is more like Python than Haskell !
Where should I read about the use of parenthesis in P6 ? 17:26
raschipi The message it gives is very clear in my opinion: for @a⏏ ( -> $x { $x.say } ) expecting any of: block or pointy block; infix; infix stopper
andrei Thank you. But I want to know, exactly under which circumstances I can use ( ... ) parenthesis? 17:27
hahainternet Rust doesn't support variable₁ … useless
andrei my @a = <aa bb cc> ; for @a { -> $x { $x.say } } 17:29
returns Nil , why ? I would think
that the value of the block would be the anonymous function -> $x { $x.say }
so, naively it would be the same as just my @a = <aa bb cc> ; for @a -> $x { $x.say } 17:30
raschipi m: my @a = <aa bb cc> ; my $b = do for @a { -> $x { $x.say } }; say $b.^name
camelia List
raschipi Returns a List of 3 subroutines 17:31
m: my @a = <aa bb cc> ; my $b = do for @a { -> $x { $x.say } }; say $b
camelia (-> $x { #`(Block|59054240) ... } -> $x { #`(Block|59054312) ... } -> $x { #`(Block|59054384) ... })
raschipi m: my @a = <aa bb cc> ; my $b = do for @a { -> $x { $x.say } }; say $b[0]() 17:32
camelia Too few positionals passed; expected 1 argument but got 0
in block <unit> at <tmp> line 1
raschipi m: my @a = <aa bb cc> ; my $b = do for @a { -> $x { $x.say } }; say $b[0]('j')
camelia j
True
raschipi So, the value of the block is an anonymous function, and it executes 3 times, a 17:33
and returns 3 anonymous functions 17:34
andrei Yes, thanks, this makes sense
17:34 grumble2 left
raschipi Parethesis can go in 2 places: after a name, they mean 'call a function' 17:34
m: my $a = { $^x ** 2}; $a(2) 17:35
camelia ( no output )
raschipi m: my $a = { $^x ** 2}; say $a(2)
camelia 4
andrei Yes ! And second place ? 17:36
raschipi They change what in an expression is executed first.
andrei i.e. precedence? 17:37
raschipi If you put a space after the name, they change from the first meaning to the other.
Yes, they change precedence.
andrei Nice, I see
But, what exactly happens when I say: for @a -> $x { $x.say } ?
raschipi m: my $a = { $^x ** $^y }; say $a(2,3); say $a (2,3) 17:38
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3$a = { $^x ** $^y }; say $a(2,3); say $a7⏏5 (2,3)
expecting any of:
infix
infix stopper
postfix
statement end…
andrei Is this just idiomatic? Can I split this into separate groups, to understand the logic?
nine andrei: @a.map: -> $x { $x.say }; is what happens
raschipi Perl6 expects the keyword (for), then an expression, then a block 17:39
( is part of expressions, so it finds the keyword, an expression (@a), and then another expression starts. 17:40
Which is not what it expects.
If it finds the '{' or '-->', that's the start of a block, so it's happy. 17:42
This is because they want to avoid "backtracking" as much as possible
andrei By the way, this works fine: my @a = <aa bb cc> ; for (@a) -> $x { $x.say }
No problem surrounding @a with ()
17:43 grondilu_ joined
raschipi So it has to know what follows is a block before even looking inside. 17:43
17:43 Cabanossi left
raschipi Like I said, () are part of expressions, so no problem putting them where expressions are next. But can't put them where blocks are expected. 17:44
17:44 eveo joined, eveo left
raschipi Taking away the spca between the 'for' and the ( changes it's meaning from the second case to first. 17:44
space* 17:45
andrei Yes, that I understand
17:45 grondilu left
andrei However, I dont understand how come -> $x { $x.say } is not just an expression ? This is just lambda, right, anonymous function? 17:46
Anonymous function is not an expression ?
raschipi The practical answer is that requiring that it be this way makes parsing Perl6 easier/faster
17:46 Cabanossi joined
TimToady it's a lambda, yes, but it's the only place where Perl 6 allows two terms in a row 17:46
so it must be parsed specially 17:47
andrei what does it mean " two terms in a row " ?
TimToady m: 42 43
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 03427⏏5 43
expecting any of:
infix
infix stopper
statement end
statement modifier
statement modifier …
raschipi In an expression, things are either terms or operators.
TimToady most of the time, we require an infix of some sort between any two terms 17:48
andrei Ahh, I see...
TimToady has to do with the concept of self-clocking code
knowing whether we expect a term or an infix allows us to separate those namespaces
17:49 ZofBot left
TimToady otherwise we could never distinguish /foo/ from division 17:49
that's true even in Perl 5
andrei So, you mean , $x and { $x.say } are two terms, right?
TimToady yes, so we specially allow the first expression to be terminated by { or ->
17:50 lizmat left
TimToady so you can't just poke any old expression into the second slot 17:50
raschipi Why 'for TERM BLOCK' and not 'for TERM, BLOCK'?
andrei Yes, why indeed?
TimToady it's ugly 17:51
raschipi Everyone would mio
TimToady and there's always map if you need it
raschipi *mock Perl6 for ugly systax
17:51 ZofBot joined, ChanServ sets mode: +v ZofBot
andrei So, after the "for" keyword is the only place where P6 allows two terms in a row ? 17:53
TimToady it would also become impossible to parse for 1, 2, 3, ->{}, 5, 6
well, it would parse, but it wouldn't make semantic sense
whereas with the current syntax, we know the block is special with a glance, and don't have to figure out whether it's just a term in the list 17:55
we reuse this idea for many kinds of block-oriented syntax, so it's not just a special feature of "for"
17:56 setty1 joined
TimToady so not just "for", but "given", "with", "if", "CATCH", and so on 17:56
andrei I see. Thanks a lot, I think this cleared my confusion. 17:57
TimToady m: with %*ENV<HOME> { .say }
camelia /home/camelia
TimToady same thing
m: with %*ENV<HOME> -> $foo { $foo.say } 17:58
camelia /home/camelia
TimToady that's how P6 is designed: we don't mind special syntax, but when we put in special syntax, we try to use it lots of places so that it justifies its mental load 17:59
18:00 lizmat joined
andrei have to run now unfortunately, thank you guys 18:00
TimToady you also see this in places like re-using weird pair syntax all over
18:00 andrei left
TimToady ciao 18:00
18:03 raschipi left, gregf_ left 18:04 obra left, espadrine_ joined 18:05 raschipi joined 18:11 ZofBot left 18:12 ZofBot joined, ChanServ sets mode: +v ZofBot 18:14 Cabanossi left 18:16 Cabanossi joined 18:17 itaipu left 18:21 obra joined 18:29 itaipu joined 18:37 vetmaster joined, domidumont joined 18:38 obra left
vetmaster how to split file content by newlines efficiently? 18:39
*contens
**contents
moritz .lines 18:41
18:43 domidumont1 joined, setty1 left, setty1 joined 18:44 Cabanossi left 18:45 labster left 18:46 domidumont left, perigrin_ is now known as perigrin, Cabanossi joined 18:47 simonm joined 18:48 domidumont joined 18:49 drrho joined 18:51 khisanth_ left, domidumont1 left, obra joined
vetmaster why that does not work : <pos> % [', '*] 19:02
m: grammar A { rule TOP { <pos> % [', '*] } rule pos { \w+ } }; 19:03
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %
at <tmp>:1
------> 3grammar A { rule TOP { <pos> %7⏏5 [', '*] } rule pos { \w+ } };
vetmaster ?
camelia says "missing quantifier on the left argument" 19:04
moritz the % is a modifier to a quantifier
so you first need a quantifier
<pos>* % ', ' maybe?
vetmaster ah yes 19:05
it should be equal to <pos> ', ' <pos> ', ' ...
<pos>*, of course
19:07 domidumont left
moritz m: say so "a, bc, d" ~~ / ^ [\w+]* % ', ' $ / 19:11
camelia True
geekosaur % changes * from "any number of the preceding token" to "any number of the preceding token, each separated by the following token"
rightfold m: my @xs = 1, 2; my @ys = @xs, 3; @ys.perl.say
camelia [[1, 2], 3]
19:12 nowan left
vetmaster m: my @xs = 1, 2; my @ys = @xs, 3; say @ys; 19:15
camelia [[1 2] 3]
vetmaster m: say A x 20;
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
A used at line 1
Undeclared routine:
x used at line 1
vetmaster m: say 'A' x 20
camelia AAAAAAAAAAAAAAAAAAAA
vetmaster m: say 'A' xx 20
camelia (A A A A A A A A A A A A A A A A A A A A)
vetmaster m: say 'A' xxx 20 19:16
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say 'A'7⏏5 xxx 20
expecting any of:
infix
infix stopper
postfix
statement end
statement modifier
vetmaster m: say "abc\ndef\nabc\ndef"
camelia abc
def
abc
def
vetmaster m: say "abc\ndef\nabc\ndef".lines
camelia (abc def abc def)
19:16 zakharyas left
vetmaster m: say "abc\ndef\nabc\n\n\n\def".lines 19:17
camelia 5===SORRY!5=== Error while compiling <tmp>
Unrecognized backslash sequence: '\d'
at <tmp>:1
------> 3say "abc\ndef\nabc\n\n\n\7⏏5def".lines
expecting any of:
argument list
double quotes
term
vetmaster m: say "abc\ndef\nabc\n\n\n\ndef".lines
camelia (abc def abc def)
geekosaur m: dd "abc\ndef\nabc\n\n\n\ndef".lines 19:20
camelia ("abc", "def", "abc", "", "", "", "def").Seq
19:22 lizmat left
moritz m: say ' ' ~~ /<sp>/ 19:28
camelia No such method 'sp' for invocant of type 'Match'. Did you mean 'so'?
in block <unit> at <tmp> line 1
vetmaster m: grammar A { rule TOP { <latin>* } token latin {\w+} }; say A.parse('word'); 19:29
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3grammar A { rule TOP { <latin>* }7⏏5 token latin {\w+} }; say A.parse('word'
expecting any of:
infix
vetmaster m: grammar A { rule TOP { <latin>* }; token latin {\w+} }; say A.parse('word');
camelia 「word」
latin => 「word」
vetmaster m: grammar A { rule TOP { <latin>* }; token latin {\w+} }; say A.parse('word /test/');
camelia Nil
vetmaster Why A matches 'word' in the first case, but don't match one in the second case? 19:30
19:30 dct joined
vetmaster * doesn't 19:30
Geth specs: 9c2105171e | (Moritz Lenz)++ | S05-regex.pod
Remove <sp> as an alias for \s

Nobody has bothered implementing it even though it would have been trivial. There are no tests for it either.
This means the community has not accepted it, so we can stop pretending :-)
19:31
geekosaur vetmaster, it doesn't return a partial match if the whole expression fails. and if you use parse, you are asserting the grammar matches the entire input string 19:32
so TOP matches 'word' and then fails because what follows doesn't match, and that fails the whole grammart
19:33 obra left
vetmaster m: grammar A { rule TOP {"/" \w+ "/"}; }; A.parse('/test/') 19:46
camelia ( no output )
vetmaster m: grammar A { rule TOP {"/" \w+ "/"}; }; say A.parse('/test/');
camelia 「/test/」
perlpilot m: grammar A { rule TOP { <latin>* }; token latin {\w+} }; say A.subparse('word /test/'); 19:48
camelia 「word 」
latin => 「word」
perlpilot vetmaster: maybe you wantted subparse instead?
(caveat lector, I've only been paying attention here about 5 seconds :) 19:49
19:52 kyclark joined 19:57 obra joined 20:00 cdg_ joined, avalenn joined 20:03 cdg left 20:05 nowan joined
vetmaster m: my $test_str = "абыл кай \/об. Ч\/"; 20:05
camelia ( no output )
vetmaster m: my $test_str = "абыл кай /об. Ч/"; 20:06
camelia ( no output )
vetmaster works good
"абыл кай /об. Ч/" ~~ /^<-[\/]>+/;
m: "абыл кай /об. Ч/" ~~ /^<-[\/]>+/;
camelia ( no output )
tbrowder [Coke]: you're right, the ' 20:08
the "once next" trick does appear to start index from one but it also skips the first value, so it's not useful. this does what i need wiith min fuss: "for ... lines.kv -> $i is copy, $line is copy { ++$i; # do stuff to the line}" 20:13
[Coke] tbrowder++ 20:14
20:17 cdg joined
perlpilot tbrowder: Zoffix's "once next" trick included an empty element as the first element in the list too. for "", lines.kv -> $i, $line { once next; ... } 20:18
vetmaster m: grammar A { rule TOP {<latin>+ % [" ~ "*]}; token latin { \w+ }; }; A.parse('test');
camelia ( no output )
vetmaster m: grammar A { rule TOP {<latin>+ % [" ~ "*]}; token latin { \w+ }; }; say A.parse('test');
camelia 「test」
latin => 「test」
vetmaster m: grammar A { rule TOP {<latin>+ % [" ~ "*]}; token latin { \w+ }; }; say A.parse('test ~ another'); 20:19
camelia 「test ~ another」
latin => 「test」
latin => 「another」
vetmaster m: grammar A { rule TOP {<latin>+ % [" ~ "*]}; token latin { \w+ }; }; say A.parse('test ~ another test');
camelia Nil
vetmaster m: grammar A { rule TOP {<latin>+ % [" ~ "*]}; token latin { <-[~]>+ }; }; say A.parse('test ~ another test');
camelia Nil
vetmaster m: grammar A { rule TOP {<latin>+ % ["~ "*]}; token latin { <-[~]>+ }; }; say A.parse('test ~ another test'); 20:20
camelia 「test ~ another test」
latin => 「test 」
latin => 「another test」
20:20 cdg_ left
vetmaster m: grammar A { rule TOP {<latin>+ % ["~ "*]}; token latin { <-[~]>+ }; }; say A.parse('testing grammar ~ another test'); 20:21
camelia 「testing grammar ~ another test」
latin => 「testing grammar 」
latin => 「another test」
perlpilot tbrowder: er ... for ("", |lines()).kv # it would work better if I used all the right syntax :)
vetmaster m: grammar A { rule TOP {<latin>+ % ["~ "*]}; token latin { <-[/~]>+ }; }; say A.parse('testing grammar ~ another test'); 20:22
camelia 「testing grammar ~ another test」
latin => 「testing grammar 」
latin => 「another test」
vetmaster m: grammar A { rule TOP {<latin>+ % ["~ "*]}; token latin { <-[/~]>+ }; }; say A.parse('testing grammar ~ another test /abc/');
camelia Nil
vetmaster m: grammar A { rule TOP {<latin>+ % ["~ "*] .*}; token latin { <-[/~]>+ }; }; say A.parse('testing grammar ~ another test /abc/');
camelia 「testing grammar ~ another test /abc/」
latin => 「testing grammar 」
latin => 「another test 」
tbrowder ok, i missed that, looks like that does work, but noiser to me than the simple increment. thanks all. 20:23
perlpilot tbrowder: yeah, it's "clever" and that's usually a sign you shouldn't use it :) 20:24
tbrowder yeah, i'm just a simple man and i have to read my code much later when I've forgotten the glamorous stuff 20:25
timotimo m: sub keyshift($kv, $n) { ($kv.key + $n) => $kv.value }; for <a b c d e f g>.kv>>.keyshift(1) -> $k, $v { say "$k: $v" } 20:26
camelia No such method 'keyshift' for invocant of type 'Int'
in block <unit> at <tmp> line 1
timotimo m: sub keyshift($kv, $n) { ($kv.key + $n) => $kv.value }; for <a b c d e f g>.kv>>.&keyshift(1) -> $k, $v { say "$k: $v" }
camelia No such method 'key' for invocant of type 'Int'. Did you mean 'keys'?
in sub keyshift at <tmp> line 1
in block <unit> at <tmp> line 1
timotimo oh, of course, not a pair
ugexe m: my $line = "a\nb\nc\nd"; for $line.lines.kv -> $i, $l { once redo; say $i } # seems weird
camelia 0
b
c
Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
timotimo m: sub keyshift($kv, $n) { ($kv[0] + $n), $kv[1] }; for <a b c d e f g>.kv>>.&keyshift(1) -> $k, $v { say "$k: $v" }
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5a' (indicated by ⏏)
in sub keyshift at <tmp> line 1
in block <unit> at <tmp> line 1

Actually thrown at:
in sub keyshift at <tmp> line 1
timotimo ah, hyper descends into pieces
m: sub keyshift($kv, $n) is nodal { ($kv[0] + $n), $kv[1] }; for <a b c d e f g>.kv>>.&keyshift(1) -> $k, $v { say "$k: $v" } 20:27
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5a' (indicated by ⏏)
in sub keyshift at <tmp> line 1
in block <unit> at <tmp> line 1

Actually thrown at:
in sub keyshift at <tmp> line 1
timotimo hmm.
m: sub keyshifter($n) { sub shifter($kv) { ($kv[0] + $n), $kv[1] } }; for <a b c d e f g>.kv.map(keyshifter(1)) -> $k, $v { say "$k: $v" }
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5a' (indicated by ⏏)
in sub shifter at <tmp> line 1
in block <unit> at <tmp> line 1

Actually thrown at:
in sub shifter at <tmp> line 1
i…
timotimo takes it to the local shell 20:28
would have been much easier with .pairs
20:29 vetmaster left
timotimo ah, i didn't realize .kv is already flat 20:29
well, that makes a lot of sense
20:30 robertle joined
timotimo m: sub keyshifter($n) { sub shifter($a, $b) { slip($a + $n, $b) } }; for <a b c d e f g>.kv.map(keyshifter(1)) -> $k, $v { say "$k: $v" } 20:30
camelia 1: a
2: b
3: c
4: d
5: e
6: f
7: g
raschipi .kv returns a zip between the line numbers and the values. Asigning it to a hash will pair them up. 20:31
timotimo of course
this is explicitly about iterating over a .kv and wanting to have it start at 1 rather than 0
at least that's how i interpreted the situation
raschipi Why not zip it with a 1..* range explicitly instead of calling .kv? 20:35
timotimo because then you'd have to call some operator (like a +) on the value as well
and that won't work very well for anything from strings to random objects
oh
20:35 itaipu left
timotimo you mean it totally differently from how i understood it 20:35
raschipi say (<a b c d e f g> Z 1..*) 20:36
evalable6 ((a 1) (b 2) (c 3) (d 4) (e 5) (f 6) (g 7))
20:37 lizmat joined
raschipi m: ( 1..* Z <a b c d e f g>).map: -> $k , $v { say "$k: $v" } 20:39
camelia 1 a: 2 b
3 c: 4 d
5 e: 6 f
Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
20:39 obra left, dct left
raschipi m: ( 1..* Z, <a b c d e f g>).map: -> $k , $v { say "$k: $v" } 20:39
camelia 1 a: 2 b
3 c: 4 d
5 e: 6 f
Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
perlpilot m: for 1..* Z <a b c d e f g> -> ($k, $v) { say "$k: $v" } 20:40
camelia 1: a
2: b
3: c
4: d
5: e
6: f
7: g
perlpilot (since that's what you really wanted :)
the minute vagaries of syntax may still trip people up though
raschipi The only way to avoid that is to not write Perl6. 20:42
perlpilot raschipi++
with the zip trick, you can pick your starting index too ... 20:45
m: for -5..* Z <a b c d e f g> -> ($k, $v) { say "$k: $v" }
camelia -5: a
-4: b
-3: c
-2: d
-1: e
0: f
1: g
20:46 obra joined
perlpilot which is useful for the same reason languages like pascal (and its progeny) and early Perl 5 allowed it (to make some algorithms simpler) 20:46
raschipi m: for 'a'...'z' Z <a5 b4 c3 d2 e1 f0 g5> -> ($k, $v) { say "$k: $v" } 20:47
camelia 5===SORRY!5=== Error while compiling <tmp>
Only identical operators may be list associative; since '...' and 'Z' differ, they are non-associative and you need to clarify with parentheses
at <tmp>:1
------> 3for 'a'...'z' Z7⏏5 <a5 b4 c3 d2 …
raschipi m: for ('a'...'z') Z <a5 b4 c3 d2 e1 f0 g5> -> ($k, $v) { say "$k: $v" } 20:48
camelia a: a5
b: b4
c: c3
d: d2
e: e1
f: f0
g: g5
20:54 lizmat left
timotimo m: for <a b c d e f g> Z[R,] 1..* -> $k, $v { say "$k: $v" } 20:59
camelia 1 a: 2 b
3 c: 4 d
5 e: 6 f
Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
timotimo heh. whoops :)
m: for flat <a b c d e f g> Z[R,] 1..* -> $k, $v { say "$k: $v" }
camelia 1: a
2: b
3: c
4: d
5: e
6: f
7: g
21:01 raschipi left 21:09 TEttinger joined, setty1 left, pecastro left 21:21 mcmillhj left
Geth doc: 81c2d2394d | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/5to6-perlvar.pod6
Use better idiom than .kv for numering lines; raschipi++
21:27
doc: 2b130cf5f6 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Handle.pod6
Reformat signature of IO::Handle.open

So it fits on screen
21:31
21:35 mcmillhj joined 21:39 skids left 21:40 AlexDaniel left, AlexDaniel joined, mcmillhj left 21:42 rindolf left
tbrowder .tell DrForr_ you have a new PR for Perl6::Parser 21:42
yoleaux tbrowder: I'll pass your message to DrForr_.
21:45 Cabanossi left 21:46 Cabanossi joined 21:49 AlexDani` joined 21:51 mcmillhj joined 21:52 robertle left, AlexDaniel left 21:56 mcmillhj left, AlexDani` is now known as AlexDaniel 22:00 eliasr left 22:07 mcmillhj joined 22:09 ceevusee joined 22:13 kyan left, mcmillhj left
Geth doc: dce339cc23 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/traps.pod6
Remove trailing ws; Fixes #1367
22:24
22:28 ceevusee left
Geth doc: 804dce6400 | (Kris Shannon)++ (committed using GitHub Web editor) | doc/Language/io-guide.pod6
Small grammar and syntax changes
22:31
doc: 7fdfdb5e03 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/glossary.pod6
Fix typo; Fixes #1363
22:36 wamba left
Geth doc: 1a5ee4fd39 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/io-guide.pod6
Fix minor factual info; Fixes #1362
22:39
22:40 Celelibi left, raschipi joined 22:45 eveo joined
eveo .tell jnthn would you be able to resolve this ticket? The question is is it guaranteed `run` will never use the shell to execute stuff. github.com/perl6/doc/issues/1208#i...-281522376 22:47
yoleaux eveo: I'll pass your message to jnthn.
22:47 eveo left 22:53 nadim joined 23:03 AlexDaniel left 23:05 mcmillhj joined 23:06 nadim left 23:10 Skarsnik left, skids joined 23:14 mcmillhj left
rightfold m: class C { has $.x! }; C.new(x => 1); C.new() 23:14
camelia 5===SORRY!5=== Error while compiling <tmp>
Negation metaoperator not followed by valid infix
at <tmp>:1
------> 3class C { has $.x!7⏏5 }; C.new(x => 1); C.new()
expecting any of:
constraint
infix
infix …
rightfold m: class C { has $.x is required }; C.new(x => 1); C.new()
camelia The attribute '$!x' is required, but you did not provide a value for it.
in block <unit> at <tmp> line 1
rightfold Ok nice
23:26 mcmillhj joined 23:30 Cabanossi left, pecastro joined 23:31 mcmillhj left, Cabanossi joined 23:39 Actualeyes left 23:42 mcmillhj joined 23:45 raschipi left 23:47 mcmillhj left 23:48 itaipu joined 23:50 simonm left 23:53 BenGoldberg joined 23:54 cdg left 23:57 kyclark left 23:58 mcmillhj joined