Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-04-11

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:14 mcmillhj joined #perl6
00:16 cyphase joined #perl6
00:21 _28_ria joined #perl6
00:28 Cabanossi joined #perl6
00:33 m0ltar joined #perl6
00:45 Ven joined #perl6
00:56 timotimo many modules in the ecosystem are using abspath ...
00:56 Cabanossi joined #perl6
01:01 AlexDaniel ^_^
01:05 Actualeyes joined #perl6
01:47 ilbot3 joined #perl6
01:47 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
02:00 leego joined #perl6
02:02 samcv i think i may have used it once myself
02:02 _28_ria joined #perl6
02:02 samcv not in an eco module though
02:05 AlexDaniel I thought whateverable used abspath, but no, it is using .absolute method
02:05 AlexDaniel and also only chdir sub, not method
02:06 AlexDaniel feels like I won't need to change any code because of IO grant work
02:06 AlexDaniel Zoffix++
02:15 mcmillhj joined #perl6
02:19 samcv joined #perl6
02:25 noganex_ joined #perl6
02:28 Cabanossi joined #perl6
02:36 geekosaur joined #perl6
02:45 jmiven joined #perl6
03:08 xtreak joined #perl6
03:16 samcv i think i've almost gotten travis ci to make commits to my repo of appimage builds
03:16 samcv crossing my fingers. it works the next time
03:26 Cabanossi joined #perl6
03:32 emdashcomma left #perl6
03:37 xtreak joined #perl6
03:39 xtreak joined #perl6
03:41 Cabanossi joined #perl6
03:56 mcmillhj joined #perl6
04:02 jdmmmmm joined #perl6
04:03 xinming joined #perl6
04:17 xtreak joined #perl6
04:21 wamba joined #perl6
04:25 Cabanossi joined #perl6
04:29 xiaomiao joined #perl6
04:33 xtreak joined #perl6
04:43 Actualeyes joined #perl6
04:46 mcmillhj joined #perl6
04:55 curan joined #perl6
04:56 Cabanossi joined #perl6
05:25 ufobat joined #perl6
05:25 samcv \o/
05:25 Cabanossi joined #perl6
05:25 samcv i got it!
05:29 samcv sweet https://github.com/samcv/rakudo-appimage/tree/gh-pages
05:30 samcv my matrix of 4 commited appimages for each one
05:30 lowbro joined #perl6
05:30 lowbro joined #perl6
05:37 domidumont joined #perl6
05:44 domidumont joined #perl6
05:52 RabidGravy joined #perl6
06:11 wamba joined #perl6
06:17 _28_ria joined #perl6
06:27 kurahaupo joined #perl6
06:31 geekosaur joined #perl6
06:32 simcop2387 joined #perl6
06:33 kurahaupo_ joined #perl6
06:41 Cabanossi joined #perl6
06:43 ChoHag joined #perl6
07:07 Actualeyes joined #perl6
07:10 Cabanossi joined #perl6
07:10 lizmat sjn++  # good catch, fixed
07:12 moritz what's an appimage? something for macos?
07:15 samcv no, linux
07:15 samcv you download the binary, and run it. standalone
07:15 moritz so statically compiled? or some kind of package manager?
07:15 samcv uh.
07:15 samcv not a package manager
07:15 moritz or like an .exe installer for windows?
07:15 samcv no
07:16 * moritz a thick today
07:16 samcv you +x it
07:16 samcv then run it
07:16 samcv and it starts perl6 prompt
07:16 samcv that's it.
07:16 curan joined #perl6
07:16 samcv no install
07:17 samcv and you can put it in whatever path you want
07:17 moritz wow, that's *way* cool
07:17 samcv yeah
07:17 u-ou is it like docker
07:17 moritz relocatable!
07:17 samcv dl https://github.com/samcv/rakudo-appimage/tree/gh-pages one of these
07:17 samcv the stable is uh. things work fine
07:17 samcv the testing you can give it relative paths and it will find things
07:18 samcv and that works mostly fine but there's some hackage of the command line args in the perl6 shell script
07:18 samcv not really u-ou
07:18 samcv it's like those linux iso's
07:18 samcv same format. like an executable tmp disk image
07:18 samcv thing...
07:18 u-ou ahh
07:19 samcv idk it's great. lots of hacks to get it to work though, including patching all the binaries
07:19 samcv to have relative paths ;)
07:19 samcv it builds in /rsu folder. and then my build script i made patches the binaries into ././
07:19 samcv and many other assorted things
07:20 samcv and i just an hour or so ago, got travis commiting to the repo with appimages that travis builds itself
07:21 samcv which is amazing
07:21 samcv i could put it on a cron and have it do nightly builds of rakudo blead
07:22 parv joined #perl6
07:23 samcv heh nice. just pushed changes to the build script. and now a new appimage build is in the repo built
07:23 samcv so sweet
07:29 xtreak joined #perl6
07:30 xtreak joined #perl6
07:36 dakkar joined #perl6
07:37 abraxxa joined #perl6
07:38 domidumont joined #perl6
07:39 jonas1 joined #perl6
07:39 CIAvash joined #perl6
07:45 avalenn joined #perl6
07:46 imcsk8 joined #perl6
07:52 rindolf joined #perl6
07:57 Ulti joined #perl6
07:58 Damianz joined #perl6
07:58 Damianz joined #perl6
08:00 spebern joined #perl6
08:01 Geth ¦ Inline-Python: 90cea00249 | (Stefan Seifert)++ | 4 files
08:01 Geth ¦ Inline-Python: Fix "Representation must be composed before it can be serialized"
08:01 Geth ¦ Inline-Python:
08:01 Geth ¦ Inline-Python: Modules using Inline::Python may not be precompiled as the Python
08:01 Geth ¦ Inline-Python: interpreter's state cannot be saved/restored.
08:01 Geth ¦ Inline-Python: review: https://github.com/niner/Inline-Python/commit/90cea00249
08:01 nine .tell AlexDaniel re https://irclog.perlgeek.de/perl6/2017-03-30#i_14348415 fixed in Inline-Python commit 90cea00249
08:01 yoleaux nine: I'll pass your message to AlexDaniel.
08:11 darutoko joined #perl6
08:11 xtreak joined #perl6
08:11 Cabanossi joined #perl6
08:12 spebern joined #perl6
08:13 _28_ria joined #perl6
08:20 ufobat joined #perl6
08:26 sven_123 joined #perl6
08:34 robertle joined #perl6
08:40 Cabanossi joined #perl6
08:40 samcv moritz, the appimages will be seamless if I can figure out a way to make perl 6 change directory on being run
08:41 samcv if we had a command line argument or something to do that, would solve the last main issue with the appimages, with them starting out with $*CWD in the ramdisk/whaever it is
08:41 samcv mounted squash image
08:42 wamba joined #perl6
08:44 g4 joined #perl6
08:44 g4 joined #perl6
08:44 bjz joined #perl6
08:48 xtreak joined #perl6
08:54 bjz joined #perl6
09:09 leont joined #perl6
09:11 Cabanossi joined #perl6
09:34 bjz joined #perl6
09:35 xtreak joined #perl6
09:42 zakharyas joined #perl6
09:51 mcmillhj joined #perl6
09:52 kent\n joined #perl6
09:54 rindolf joined #perl6
10:19 xtreak joined #perl6
10:20 Zoffix joined #perl6
10:20 Zoffix PSA: Merge your PRs:
10:20 Zoffix huggable: IO kills
10:20 huggable Zoffix, [XXXXX XXXXX XXXXX XXX]: See https://gist.github.com/zoffixznet/0ea1f4db792fc674abdde73f8dd11cc1
10:21 stmuk joined #perl6
10:22 xtreak joined #perl6
10:24 mcmillhj joined #perl6
10:31 Zoffix left #perl6
10:35 xtreak joined #perl6
10:40 Cabanossi joined #perl6
10:43 Cabanossi joined #perl6
10:44 xtreak joined #perl6
10:45 * lizmat clickbaits https://p6weekly.wordpress.com/2017/04/10/2017-15-kaboom/
10:46 Cabanossi joined #perl6
10:50 melezhik Hi Perl6 gurus!
10:50 melezhik I am struggling with main sub , passing options as array
10:50 melezhik perl6 -e 'sub MAIN ( Array :@a ){ }' -a=1
10:51 melezhik get this:  usage: -e '...' [-a=<Positional[Array]>]
10:51 melezhik and none zero exit code
10:52 masak yes, because that `1` you're passing is not an array
10:52 melezhik so, how can I pass is as array?
10:52 masak I've never thought about it. not sure you can
10:53 ilmari perl6 -e 'sub MAIN (Int :@a){ say @a }' -a=1 # no worky either
10:53 ilmari Usage: -e '...' [-a=<Positional[Int]>]
10:54 ilmari Array :@a asks for an array of arrays
10:54 masak oh, right. forgot to mention that.
10:54 jnthn I think the only place an array makes sense in MAIN is a slurpy one
10:54 masak that's an eternal gotcha for newcomers; the `@` already encodes Array/Positional
10:55 melezhik well, let me reshape , how can I pass a  list of values to MAIN sub? is it possible?
10:56 jnthn melezhik: I'm not aware of a way besides the slurpy
10:56 melezhik ok
10:56 jnthn sub MAIN(*@foo) { } # if you run it as script foo bar baz, then @foo has 3 elements
10:57 * jnthn has used that somewhere
10:57 lizmat melezhik: perhaps -a=1,2,3  and then split on ',' ?
10:57 melezhik good, but I need to pass a named parameters
10:57 jnthn OK, then juist take a string and split it yourself
10:57 jnthn As lizmat suggested
10:57 melezhik yeah, I already have a "split" version
10:57 melezhik just looked more elegant way
10:57 melezhik but that's ok
10:57 lizmat melezhik: or perhaps .words
10:58 melezhik will go with "split", not a big deal ...
10:58 jnthn I don't think there is one... Also if there was then it might also mean that you could pass -a=1 -a=2 and so on and it should collect all of the a options into the array
10:58 jnthn So it's not clear an auto-split semantic is what's wanted either
10:59 melezhik yeah, not still clear  why "-a=1 -a=2 -a=3" is bad idea?
11:00 jnthn melezhik: I didn't say it was a bad idea, just that it might be a more natural mapping for arrays in MAIN signatures
11:00 jnthn (Than splitting a single thing)
11:01 jnthn It can't mean both things, so we'd have to pick
11:01 kurahaupo joined #perl6
11:01 melezhik jnthn : Ok, I see
11:02 xtreak joined #perl6
11:02 melezhik as for me "-a=1 -a=2 -a-3" would be good ))
11:05 masak $ perl6 -e 'sub MAIN(:@a) { say @a }' -a=1 -a=2
11:05 masak [1 2]
11:05 masak seems to work
11:05 jnthn Oh...
11:05 * jnthn had no idea :)
11:06 ilmari oh, I had an ancient rakudo, so my test was probably invalid
11:06 * ilmari brews a new one
11:06 jnthn I note usage is like
11:06 jnthn [-a=<Positional>]
11:06 jnthn Which is a bit LTA
11:06 masak aye
11:06 masak m: sub foo(:$a) { say $a }; foo(a => 1, a => 2)
11:06 camelia rakudo-moar b6838e: OUTPUT: «2␤»
11:06 jnthn That's what I was going on when I figured it didn't know how to handle it.
11:06 masak some time in the distant past, this used to be spec'd to also make an array
11:07 masak but I think moritz and I killed off that bit, mebbe
11:07 masak semi-funnily, the "make an array" semantics makes some sense now that I consider it in light of MAIN, which I'm sure I didn't way back when
11:08 xfix_ joined #perl6
11:09 perlawhirl joined #perl6
11:11 ilmari masak: ah, it works without the type constraint on the array parameter
11:11 ilmari but only if you pass more than one -a
11:11 masak yes, type constraints on arrays are more or less useless in Perl 6
11:11 Cabanossi joined #perl6
11:11 masak yes, you need to pass more than one -a for it to *become* an array
11:12 masak heh. my several-years-down-the-line impression of Perl 6's efforts at being DWIMmy with types is... "don't" :P
11:13 masak I'd rather be explicit about what's an array/list/sequence than suffer the WATs of Perl 6 trying to figure it out
11:13 masak m: sub foo(:$x) { say $x.^name }; foo(<oh>); foo(<oh hai>)
11:13 camelia rakudo-moar b6838e: OUTPUT: «Too many positionals passed; expected 0 arguments but got 1␤  in sub foo at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
11:14 melezhik masak: good to know! thanks will try
11:14 masak m: sub foo(:$x) { say $x.^name }; foo(:x<oh>); foo(:x<oh hai>)
11:14 camelia rakudo-moar b6838e: OUTPUT: «Str␤List␤»
11:17 kurahaupo joined #perl6
11:20 stmuk_ joined #perl6
11:28 nadim_ joined #perl6
11:30 stmuk joined #perl6
11:31 mcmillhj joined #perl6
11:40 Cabanossi joined #perl6
11:41 mcmillhj joined #perl6
11:44 timotimo we can totally use the appimages to speed up all the travis builds. don't have to first compile moar, nqp, and rakudo. just download the appimage and go
11:57 melezhik masak:  looks like :@a approach is limited
11:57 melezhik ahh, sorry, probably I am wrong ...
11:58 melezhik let me try another tests on this ...
12:03 perlawhirl joined #perl6
12:06 melezhik masak: your example works for me, thanks!
12:10 mcmillhj joined #perl6
12:11 Cabanossi joined #perl6
12:11 lowbro joined #perl6
12:11 lowbro joined #perl6
12:25 mcmillhj joined #perl6
12:27 raschipi joined #perl6
12:27 sufrostico joined #perl6
12:52 Sound joined #perl6
12:53 mcmillhj joined #perl6
12:53 Sound_ joined #perl6
13:33 skids joined #perl6
13:34 sufrostico joined #perl6
13:41 Cabanossi joined #perl6
14:03 Grauwolf joined #perl6
14:03 perlawhirl hi perlers
14:03 perlawhirl clickbaits: http://www.0racle.info/articles/matplotlib_in_p6_part7
14:04 perlawhirl last part of this series
14:04 masak perlawhirl++
14:04 spebern joined #perl6
14:04 perlpilot perlawhirl++ indeed.
14:05 timotimo oh cool
14:11 Cabanossi joined #perl6
14:12 wamba joined #perl6
14:12 perlpilot perlawhirl: Did you add Matplotlib to the ecosystem?  If not, you should  :)
14:12 timotimo "Taking a scene the from Part 6 script" has two words swapped
14:13 perlawhirl timotimo: fixed, thanks
14:13 timotimo perlawhirl: you could have also written "matplotlib.pyplot.cm.$name\($idx)"
14:14 timotimo or "matplotlib.pyplot.cm.{$name}($idx)" should also work
14:14 perlawhirl perlpilot: I kind of don't wanna be in a position where people are asking me to fix issues, but I may throw the whole thing up in a gist.
14:15 perlawhirl timotimo: interesting... i might add a note mentioning that
14:15 alimon joined #perl6
14:15 timotimo m: my ($name, $index) = <foo 1>; say q:v"a.b.c$name($index)"
14:15 camelia rakudo-moar b6838e: OUTPUT: «a.b.c$name($index)␤»
14:15 timotimo m: my ($name, $index) = <foo 1>; say q:s"a.b.c$name($index)"
14:15 camelia rakudo-moar b6838e: OUTPUT: «No such method 'CALL-ME' for invocant of type 'Str'␤  in block <unit> at <tmp> line 1␤␤»
14:16 timotimo m: q:s"hi"
14:16 camelia rakudo-moar b6838e: OUTPUT: «WARNINGS for <tmp>:␤Useless use of constant string "hi" in sink context (line 1)␤»
14:16 timotimo ah, ok
14:19 timotimo so we have :s for scalar which "interpolates $ vars", but we don't have a way to turn off the method call detection?
14:19 khw joined #perl6
14:24 cog_ joined #perl6
14:25 robertle anyone got a tip for a url-en/decoding and splitting module?
14:25 robertle http that is of course
14:26 stmuk_ joined #perl6
14:27 Ulti robertle: https://github.com/perl6-community-modules/uri looks like the main one
14:28 Ulti robertle: http://modules.perl6.org/ for finding them
14:29 perlawhirl perlpilot: gist is up... i'll add a note at the end of the blog post too: https://gist.github.com/0racle/db70e910a3eef3f49d99a1f1b561e8d7
14:29 perlawhirl feel free to throw it on the ecosystem if you like :D
14:30 stmuk joined #perl6
14:31 jdmmmmm joined #perl6
14:31 robertle Ulti: thanks! I was aware of modules.p.o but was too stupid (URL vs URI...)
14:32 Ulti yeah URI is the generalisation
14:32 Ulti file:///root/ etc.
14:36 rindolf joined #perl6
14:40 stmuk_ joined #perl6
14:43 stmuk joined #perl6
14:46 raschipi URI is a bigger generalization than that. file:/// for example, is a URL too.
14:47 raschipi URI is the union between URLs and URNs.
14:47 raschipi URNs of course, were abandoned.
14:47 ilmari ISBNs are examples of URNs
14:49 raschipi Yeah, they are. But I haven't seen them used in the internet. There's DOI, but there's not much use too.
14:49 Khisanth joined #perl6
14:49 cdg joined #perl6
14:50 Geth joined #perl6
14:50 raschipi There's only 5,000 DOI users in total, tiny.
14:51 Geth joined #perl6
14:51 melezhik masak: universal way is perl6 -e 'sub MAIN( :$a) { say $a }' -a=1 -a=2
14:51 Geth joined #perl6
14:51 melezhik as it works for  both -a=1 (scalar) and -a=1 -a=2 (array)
14:52 Geth joined #perl6
14:53 moritz raschipi: how did you count that?
14:53 stmuk_ joined #perl6
14:53 raschipi DOI foundation numbers.
14:53 moritz I used DOIs when I was still in academia, but probably not in any way you could have counted
14:54 moritz raschipi: those are probably just the institutions that generate new DOIs; many more users actually use them
14:54 raschipi It's the number of entities that can register them. Of course they're all big and register a lot of them for their affiliates.
14:54 raschipi moritz: Yes, I agree.
14:55 moritz much like there is a small number of institutions that allocate ISBNs, but everybody who buys or cites a book uses them
14:57 raschipi Well, it is growing. They recently creted a registration authority system, similar to what ICANN does for domain names.
14:57 timotimo or like domain names
14:58 raschipi Anyone can get a domain name, some people buy them for fun, like Zoffix with his perl6.party and perl6.vip
14:59 stmuk joined #perl6
14:59 timotimo yeah, but only few can issue them
15:00 raschipi Yeah, it's the same on both systems now that the foundation has accreditated companies. The difference is that few can buy DOI names.
15:02 stmuk_ joined #perl6
15:25 Cabanossi joined #perl6
15:42 bjz joined #perl6
15:49 TreyHarris joined #perl6
15:50 ChoHag joined #perl6
15:53 cdg_ joined #perl6
16:01 cdg joined #perl6
16:02 robertle or my own exceptions, do I really want to put them into X::MyApp rather then have MyApp as the top-level namespace?
16:07 mcmillhj joined #perl6
16:10 ChoHag joined #perl6
16:18 setty1 joined #perl6
16:20 alimon joined #perl6
16:25 mcmillhj joined #perl6
16:27 cdg joined #perl6
16:31 mcmillhj joined #perl6
16:31 Geth ¦ specs: 9d446a48af | (Zoffix Znet)++ (committed by GitHub) | v6d.pod
16:31 Geth ¦ specs: Add reminder to deprecate IO::Handle.slurp-rest in 6.d
16:31 Geth ¦ specs: review: https://github.com/perl6/specs/commit/9d446a48af
16:35 ilmari joined #perl6
16:40 alimon joined #perl6
16:41 labster joined #perl6
16:44 drrho_ joined #perl6
16:49 moritz DrForr: please merge https://github.com/drforr/perl6-Inline-Scheme-Guile/pull/6 soon
16:50 mcmillhj joined #perl6
16:53 Geth ¦ ecosystem: f07cf965cd | (Zoffix Znet)++ (committed by GitHub) | META.list
16:53 Geth ¦ ecosystem: s/META.info/META6.json/ for drforr/perl6-ANTLR4
16:53 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/f07cf965cd
16:53 jdmmmmm joined #perl6
16:56 leont joined #perl6
17:00 TreyHarris Isn't there a 'use Very::Long::Name :as<Short>;' feature? I thought there was, but I can't find it
17:02 geekosaur no, in perl a module is always in its specified namespace. in perl 5 there's a glob-alias hack; dunno offhand how you'd translate it to perl 6
17:02 TreyHarris And related question: how can I create a class named the same as one that's already been used and still refer to the old class? In this case, I want to use a native Perl 6 class that's named the same as a class that I got using Inline::Perl5
17:02 geekosaur (you may be thinking of haskell's import ... as ?)
17:03 Geth joined #perl6
17:03 TreyHarris geekosaur: I definitely am, but I thought Perl 6 had similar.
17:03 geekosaur problem being that perl has an actual gobal namespace
17:03 geekosaur *global
17:03 geekosaur so the module space you see is the module space everything sees
17:04 TreyHarris Right. Can I do some lexical tricks to solve either problem? Make A::Very::Very::Long::And::Unwieldy::Module something I can refer to with a shorter variable, or to refer to the :from<Perl5> variant separately from the Perl 6 variant?
17:04 Geth joined #perl6
17:05 Geth ¦ ecosystem: f07cf965cd | (Zoffix Znet)++ (using GitHub Web editor) | META.list
17:05 Geth ¦ ecosystem: s/META.info/META6.json/ for drforr/perl6-ANTLR4
17:05 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/f07cf965cd
17:06 stmuk joined #perl6
17:09 TreyHarris (To put into context: as part of my project, I will need to port a Perl 5 module, because using it directly via Inline::Perl5 is unwieldy and misses some very obvious features because it isn't Perl 6. Porting the module is going to be slightly painful, and for my POC I wanted to just write a bridge. I can do that--*have* done that--by slapping ::P6:: into the namespace of the Perl 6 bridge. But I _keep_ making
17:09 TreyHarris the mistake of referring to the Perl 5 name instead of the ...::P6::... name, and because it works 90% of the time, it ends up being a really annoying bug to squash. So just naming my bridge exactly the same as the Perl5 module would fix it, but it appears that is just not possible?)
17:12 rindolf joined #perl6
17:13 geekosaur no, you'd have to inject the p6 stuff into the p5 module's namespace... which might be difficult given it lives in perl 5
17:16 TreyHarris Sigh. Maybe my best bet then is to rename my bridge into something very different from the P5 version and very short (instead of Proc::ProcessTable:from<Perl5> and Proc::ProcessTable::P6, maybe XBridge::ProcTable), then I can do a grep-replace once I've ported Proc::ProcessTable.
17:18 domidumont joined #perl6
17:24 TreyHarris Different subject: I'm finding in writing Inline::Perl5 bridges in general (which I do frequently for one-offs and POCs), there's a frequent need for something like this for "static methods": multi method foo (Klass:U $:) { self.new.foo } multi method foo (Klass:D $:) { ... }
17:24 TreyHarris Is there a shorter/idiomatic way for that?
17:25 b2gills constant AVVLAUM = A::Very::Very::Long::And::Unwieldy::Module;
17:30 ChoHag joined #perl6
17:33 TreyHarris b2gills: yes! Looking at my WIPs, I tried that, but when I had a different bug going on at the same time masking the issue. though I did binding to the const.... is there any reason to prefer "constant XYZ = X::Y::Z" over "constant XYZ := X::Y::Z"?
17:33 grondilu_ joined #perl6
17:33 TreyHarris they both seem to work interchangeably from quick REPL noodling
17:34 ufobat joined #perl6
17:36 MasterDuke TreyHarris: if you look at the --target=ast for both they're identical (except the places where it prints the input line), so seems to be interchangeable
17:38 TreyHarris MasterDuke: yup, thanks
17:42 Cabanossi joined #perl6
17:46 raschipi joined #perl6
17:48 espadrine joined #perl6
17:54 ChoHag joined #perl6
17:57 AlexDaniel joined #perl6
18:02 cdg joined #perl6
18:03 AlexDaniel joined #perl6
18:15 AlexDaniel .
18:15 yoleaux 08:01Z <nine> AlexDaniel: re https://irclog.perlgeek.de/perl6/2017-03-30#i_14348415 fixed in Inline-Python commit 90cea00249
18:15 AlexDaniel nine: thanks!
18:19 mattp__ joined #perl6
18:34 gdonald joined #perl6
18:38 Guest64639 joined #perl6
18:41 unclechu what would be native equvalent to `run(Q:w <tput cuu 1>, :out).out.get` (i use it to get char that i can print to move cursor one line up)?
18:41 unclechu like `chr(8)` to get char to move cursor one column left
18:42 moritz qx/tput cuu 1/
18:42 moritz what do you mean by "native"?
18:42 geekosaur joined #perl6
18:43 unclechu moritz: like special char code for `chr` function
18:43 moritz unclechu: you can reference characters by name, if that's what you're looking for
18:44 moritz "\c[BACKSPACE]"
18:45 unclechu moritz: i'm not looking for backspace, i already have it (`chr(8)`), but for char that `tput cuu 1` command prints
18:45 unclechu if anyone know this char name
18:46 leont joined #perl6
18:47 MasterDuke unclechu: i added `.uniname.say` to your example and it reports `<control-001B>`
18:47 moritz $ perl6 -e 'say qx/tput cuu 1/.uninames.join: ","'
18:47 moritz ESCAPE,LEFT SQUARE BRACKET,DIGIT ONE,LATIN CAPITAL LETTER A
18:47 unclechu or a code
18:49 MasterDuke unclechu: for `.ords.say` i get `(27 91 49 65)`
18:50 unclechu so, i guess it is sequence of symbols, i'll try
18:51 alimon joined #perl6
18:51 moritz "\c[ESCAPE][1A"
18:52 perlpilot unclechu: you could always do "tput cuu 1 | xxd" from the command line to see what it outputs.
18:52 perlpilot unclechu: change xxd for your favorite hex dumper  :)
18:53 moritz hexdump -C is also nice
18:55 unclechu thanks a lot to all of you, that solved my issue and i got more useful ways to debug stuff
18:55 [Coke] perl6 -MApp::Uni -e 'say uni-gist $_ for qx/tput cuu 1/.comb' # should be able to make this awesomer.
18:55 Cabanossi joined #perl6
18:56 [Coke] uni -c $(tput cuu 1) # awesomer.
18:58 perlpilot [Coke]++  (Why isn't uni-gist built-in yet?)
19:00 [Coke] u: •
19:00 unicodable6 [Coke], U+2022 BULLET [Po] (•)
19:05 perlpilot [Coke]: I get test failures trying to install that module via zef.   Looks like it's because bin/uni can't find App::Uni  (i.e. when I "zef look App::Uni" and "export PERL6LIB=lib" the tests run fine)
19:07 unclechu am i only one person who have this issue: https://github.com/perl6/perl6-lwp-simple/issues/12 ?
19:07 [Coke] perlpilot: I think it's the same bug that ugexe pointed out to me, I have to make the tests smarter because it's exec'ing p6
19:08 unclechu it's sad because i can't install gtk::simple that depends on lwp::simple
19:09 unclechu can i ignore failing tests while install package using `zef`?
19:09 gfldex unclechu: run `zef install --force LWP::Simple`
19:10 gfldex if you use Perl 6 sometimes the force needs to be with you
19:15 andrzejku joined #perl6
19:23 AlexDaniel joined #perl6
19:24 alphah Does "_" has special meaning here or just key name: %hash<_> = $<toplevel>.ast.hash
19:24 gfldex no special meaning
19:25 alphah Thanks
19:25 unclechu gfldex: thanks, it helps
19:26 unclechu what does `c` in `use v6.c;` mean?
19:26 unclechu `ceil`?
19:26 alphah christmas!
19:27 gfldex from the standpoint of the compiler, it doens't have special meaning beyond 'b'.succ
19:27 gfldex m: dd (v6.c).succ
19:27 camelia rakudo-moar b6838e: OUTPUT: «No such method 'succ' for invocant of type 'Version'␤  in block <unit> at <tmp> line 1␤␤»
19:30 TreyHarris Is there an idiom or something that will help with creating "static methods" that can be called on instances, or, when called on classes, call the method on a throwaway object? See https://gist.github.com/treyharris/919902805f27f447893e43b504d246bd
19:36 gfldex TreyHarris: you could use $?CLASS
19:36 El_Che don't you just want a sub for that?
19:39 gfldex m: class C { our sub s(){ dd $?CLASS::new } }; C::s
19:39 camelia rakudo-moar b6838e: OUTPUT: «Any $v = Any␤»
19:39 gfldex m: class C { our sub s(){ dd $?CLASS.new } }; C::s
19:39 camelia rakudo-moar b6838e: OUTPUT: «C.new␤»
19:40 TreyHarris gfldex: As in 'multi method hrm($?CLASS:U $: Int $n)' ?
19:40 jnthn Would need to be ::?CLASS:U
19:40 jnthn And the $ ain't needed
19:40 gfldex yes, that can help if you copypasta from methods between classes
19:40 TreyHarris That gives me en error: In signature parameter $?CLASS, it is illegal to use the ? twigil
19:40 jnthn Though this is optional; any method that doesn't access attributes can be called on the type object
19:41 jnthn So unless for some reason you want to *force* the user to only ever call it on the type object, and never on an instance, there's no particular need to mark it
19:41 TreyHarris yes, ::?CLASS:U works.
19:41 jnthn m: class C { method m() { say "look I'm static!" } }; C.m;
19:41 camelia rakudo-moar b6838e: OUTPUT: «look I'm static!␤»
19:42 TreyHarris jnthn: but then I can't call it as a class method
19:42 gfldex m: class C { method m() { say "look I'm static!"; dd self } }; C.m;
19:42 camelia rakudo-moar b6838e: OUTPUT: «look I'm static!␤C␤»
19:42 gfldex please note that self in this case points to the type object, not an instance of C
19:42 TreyHarris jnthn: Your example isn't relevant because it doesn't use an instance attribute. The compiler catches that and complains.
19:42 TreyHarris My gist does that
19:43 TreyHarris Are you saying in my gist I can remove the multi from the ":D" version and remove the ":U" version completely and get the same behavior? Because I'm not...
19:43 jnthn Ah, no
19:43 jnthn You want more than just a static method, I see
19:44 jnthn So yeah, multi over :D and :U is the way to go
19:44 TreyHarris So ::?CLASS is my first fix. Can I avoid repeating "hrm"?
19:44 gfldex m: class C { method m() { self := self // C.new } }; C.m;
19:44 camelia rakudo-moar b6838e: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Cannot use bind operator with this left-hand side␤at <tmp>:1␤------> 3 C { method m() { self := self // C.new 7⏏5} }; C.m;␤»
19:44 Guest64639 left #perl6
19:44 jnthn An alternative idiom for this might be
19:45 TreyHarris (Reload the gist for the ::?CLASS version.)
19:45 jnthn m: class C { has $.x = 0; method m($self is copy:) { .= new without $self; say $self.x } }; C.m
19:45 camelia rakudo-moar b6838e: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Preceding context expects a term, but found infix .= instead␤at <tmp>:1␤------> 3s $.x = 0; method m($self is copy:) { .=7⏏5 new without $self; say $self.x } }; C.m␤»
19:45 gfldex callwith should work if you provide the invocant by hand
19:46 jnthn m: class C { has $.x = 0; method m($self is copy:) { .=new without $self; say $self.x } }; C.m
19:46 camelia rakudo-moar b6838e: OUTPUT: «0␤»
19:46 jnthn Though that'll only work if youuse the . forms, not the ! forms, of attributes
19:46 TreyHarris what's the correct callwith syntax then?
19:47 jnthn An alternative is to just to meta-programming and write a MOP module that wraps everything :)
19:47 jnthn *just go
19:49 gfldex TreyHarris: i wrote 'should' not 'will' to indicate a guess on my side
19:51 TreyHarris jnthn, this is not the correct syntax, can you tell me what is? callwith(self.new(): $n);
19:51 jnthn callwith iterates an existing candidate list, rather than re-dispatching
19:51 jnthn So that isn't useful in this case
19:51 TEttinger joined #perl6
19:53 jnthn I *think* samewith - which does redispatch - also latches onto the original invocant
19:54 ChoHag joined #perl6
19:55 TreyHarris jnthn: I'd dealing with a whole mess of Perl5 modules that all have this issue where all methods must be called on a blessed reference even though that's only in order to get defaults. (Specifically, they all have "->fields" methods which tell you what fields are available for the given class, which is surely not something you need an instance for, but the way it was done in Perl 5 requires it.) I was trying
19:55 TreyHarris to write bridges to fix this behavior along with methods that used directly via Inline::Perl5 results in broken list-return behavior.
19:57 TreyHarris jnthn: samewith has exactly the same behavior as nextwith and callwith I wrote in my comment notes.
19:57 jnthn *nod*
19:58 jnthn So, MOP-y stuff is likely the best way
19:58 jnthn m: multi trait_mod:<is>(Method:D $m, :$auto-new!) { $m.wrap: -> \obj, |c { callwith(obj.DEFINITE ?? obj !! obj.new, |c) } }; class C { has $.x = 0; method m() is auto-new { say $!x } }; C.m; C.new.m
19:58 camelia rakudo-moar d0924f: OUTPUT: «0␤0␤»
19:58 jnthn That's probably the minimal way
19:58 jnthn With a little more effort you can make it into a class trait
19:59 jnthn So you only have to put "is auto-new" on the class, not on each method
19:59 jnthn Though maybe that's too sweeping
19:59 jnthn But it gets away from having to to :U/:D stuff and re-mention the method name
19:59 jnthn m: multi trait_mod:<is>(Method:D $m, :$auto-new!) { $m.wrap: -> \obj, |c { callwith(obj.DEFINITE ?? obj !! obj.new, |c) } }; class C { has $.x = 0; method m() is auto-new { say $!x } }; C.m; C.new(x => 42).m # just checking :)
19:59 camelia rakudo-moar d0924f: OUTPUT: «0␤42␤»
20:00 jnthn phew :)
20:00 TreyHarris but with that I'd write: use Whatever:from<Perl5>; class P6::Whatever is Whatever { method fields is auto-new { nextsame; } }
20:00 nine TreyHarris: feel free to ping me if there's anything I can do on the Inline::Perl5 side.
20:00 jnthn Do you need it to be a subclass?
20:01 jnthn And to respond correctly to .can?
20:01 jnthn If those don't matter than there's just wrapping it up and using FALLBACK
20:02 TreyHarris jnthn: "need"? Perl5 objects don't respond correctly to .can. But I would like to avoid rewriting the names of methods whose behavior I don't need to change
20:04 TreyHarris nine: my biggest issue has been with methods that return lists... the container they return is very odd. comparing 'my $t = FromP5.new.listy(); my @t = FromP5.new.listy();' is strange. Neither is directly iterable, but $t.elems is correct and $t can be indexed, while @t.elems is 1 and the single element is another list. I've dealt with this by wrapping such methods in 'method listy (--> Slip(Any)) { return
20:04 TreyHarris FromP5.new.listy(); }'
20:05 TreyHarris Also, oddly, 'my $obj = FromP5.new; $obj.listy() === $obj.listy() or die' dies, as does eqv and =:=
20:08 TreyHarris Oh! Sorry, only when something within the overall object is in XS. Hope you weren't writing your own test for this. (Proc::ProcessTable is a very simple thing to see this behavior.)
20:09 TreyHarris Proc::ProcessTable.new.table shows this behavior for instance.
20:10 TreyHarris Pure Perl5 seems to get translated okay.
20:10 nine TreyHarris: that sounds odd. Perl 5 arrays get wrapped in a Perl5Array object which does Iterable and Positional
20:11 cdg joined #perl6
20:16 TreyHarris nine: https://gist.github.com/69bac1c14bfd033de4066d2830630288
20:17 TreyHarris (must go for ~1hr, sorry)
20:19 nine TreyHarris: if those wrappers misbehave, you can also just .list them
20:22 TreyHarris nine oops sorry on phone so briefly: yes positional and iterable but the @version only has single element, @var[0] is actual list. Is why I used a Slip(Annie) return type
20:23 TreyHarris *Any
20:23 nine my @t = Proc::ProcessTable.new.table.list
20:23 nine ^^^ does what you need
20:26 nine Aaaand I may have a patch that fixes the issue altogether
20:26 nine Just have to sprinkle some "is raw" to avoid containerization of the Perl5Array return object.
20:29 Geth ¦ Inline-Perl5: 2b5d854575 | (Stefan Seifert)++ | 2 files
20:29 Geth ¦ Inline-Perl5: Support .can on Perl5Objects
20:29 Geth ¦ Inline-Perl5: review: https://github.com/niner/Inline-Perl5/commit/2b5d854575
20:30 AlexDaniel joined #perl6
20:30 TreyHarris nine: I see. .fields does not exhibit this behavior because its structure is pure Perl. But I can do a trait that just puts ".list" at the end of everything; I do enough maps and greps and such in code that having to put .list in each place it should go will be annoying. Got to write an override either way; not sure if "method table (--> Slip(Any)) { $p5obj.table }" or "method table() { $p5obj.table.list }" is
20:30 TreyHarris better. First is a few chars shorter, so it wins? :-)
20:31 _28_ria joined #perl6
20:31 nine TreyHarris: I already have a patch for making my @t = Proc::ProcessTable.new.table; do what you need. Just need to write a test for it.
20:33 nine Writing a test seems to be the harder part actually...
20:34 TreyHarris nine: Always is the case innit
20:45 bjz joined #perl6
20:53 nine Can't get the darned thing to fail :) And I also don't see why it should make a difference if a sub is in XS or pure Perl. They all just push onto the stack and Inline::Perl5 doesn't even know what exactly it is.
20:53 gdonald joined #perl6
20:56 Cabanossi joined #perl6
20:59 nine Ooooh...of course! Proc::ProcessTable::table returns an array ref, not just an array.
21:00 nine TreyHarris: I wonder if Inline::Perl5 is actually correct there. A Perl 5 array reference sounds like it's closer to an itemized Perl 6 array than a flat one.
21:11 TreyHarris nine: It's arguably "closer" but it's far, far more unwieldy (unless you know to just never use it until you use .list). In Perl5, the most you need do is add an @-sign to get it to work with built-ins, for, etc. In Perl 6, I was tearing my hair out trying to figure out if there was any way to assign it to an @array. Even '@a = ...table; @a = @a[0]; @a = @a[0]; say @a.elems' still gave you the same darn thing.
21:18 TreyHarris nine: In fact, you can't delay the '.list'. "my @a = ...table; say @a.list.elems # 1" is just as unusable. You have to do ".list" at call-time or wrap it in a Slip(Any). Otherwise, you're stuck with something that's uniterable and un-flat()-enable and only indexable through @a[0][$n], though @a[0] itself isn't iterable. It really, really confused me for a long time
21:20 raiph joined #perl6
21:20 kurahaupo joined #perl6
21:35 bjz joined #perl6
21:37 AlexDaniel joined #perl6
21:40 Cabanossi joined #perl6
21:51 bjz joined #perl6
21:59 mcmillhj joined #perl6
22:05 Geth ¦ doc: a30fae6896 | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
22:05 Geth ¦ doc: [io grant] Avoid potential confusion with use of word "object"
22:05 Geth ¦ doc:
22:05 Geth ¦ doc: Where it does not refer to an OOP object
22:05 Geth ¦ doc: review: https://github.com/perl6/doc/commit/a30fae6896
22:09 bjz joined #perl6
22:17 unclechu can i mark an argument of subroutine to copy that i can mutate?
22:17 sammers "is copy"?
22:18 sammers sub foo($i is copy) {...}
22:26 unclechu sammers: thanks, that's it
22:27 sammers np
22:31 DarthGandalf joined #perl6
22:33 mcmillhj joined #perl6
22:41 skids joined #perl6
22:41 bjz joined #perl6
22:41 Sgeo joined #perl6
22:42 Sgeo joined #perl6
22:43 DarthGandalf joined #perl6
22:45 Geth joined #perl6
22:46 Geth joined #perl6
22:47 mcmillhj joined #perl6
22:49 jdmmmmm joined #perl6
22:55 cpage_ joined #perl6
22:56 Cabanossi joined #perl6
23:02 mcmillhj joined #perl6
23:11 mcmillhj joined #perl6
23:17 mcmillhj joined #perl6
23:25 Geth ¦ doc: 2aa3c9f609 | (Zoffix Znet)++ | doc/Type/IO/Handle.pod6
23:25 Geth ¦ doc: [io grant] Document new behaviour of IO::Handle.Supply
23:25 Geth ¦ doc:
23:25 Geth ¦ doc: - Expand description
23:25 Geth ¦ doc: - Add examples
23:25 Geth ¦ doc: review: https://github.com/perl6/doc/commit/2aa3c9f609
23:28 mcmillhj joined #perl6
23:34 mcmillhj joined #perl6
23:37 mcmillhj joined #perl6
23:56 kyan joined #perl6
23:58 mcmillhj joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo