Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-12-26

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:13 itaylor57 joined #perl6
00:32 itaylor57 joined #perl6
00:33 astj_ joined #perl6
00:45 BenGoldberg joined #perl6
01:07 lookatme The REPL raise an exception in first using after update rakudo
01:07 lookatme say 123;
01:07 lookatme Internal error: unhandled encoding
01:07 lookatme in method CALL-ME at /usr/local/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 587
01:07 lookatme in method readline at /home/sgzxl/.perl6/sources/D8BAC826F02BBAA2CCDEFC8B60D90C2AF8713C3F (Readline) line 1391
01:07 evalable6 lookatme, rakudo-moar b2b39bad0: OUTPUT: «123␤»
01:16 Zoffix lookatme: what's your perl6 -v?
01:18 aindilis joined #perl6
01:19 lookatme I think its 2017.10 before update
01:19 lookatme and then is 2017.12
01:21 Zoffix No issues with 2017.12.11…
01:22 lookatme It's ok now, just in first time
01:22 Zoffix weird
01:22 lookatme yeah
01:26 Zoffix m: %*ENV<PATH> = join ($*DISTRO.is-win ?? ";" !! ":"), "extra-path", $*SPEC.path; dd %*ENV<PATH>
01:26 camelia rakudo-moar b2b39bad0: OUTPUT: «Str <element> = "extra-path:/home/camelia/perl5/perlbrew/bin:/home/camelia/perl5/perlbrew/perls/perl-5.20.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"␤»
01:27 Zoffix Feels like the $*SPECs could use some routine/arg that does ^ this for the user
01:29 Zoffix meh
01:38 lookatme yeah, good idea
01:39 lookatme But I thought it has one :)
01:39 lookatme in Perl6 thinking
01:40 Zoffix nope
01:42 AlexDaniel hmm never ever needed to change PATH from perl 6
01:42 AlexDaniel although I use “run” all the time
01:42 AlexDaniel maybe that's just me
01:45 lookatme yeah, maybe help when run some external tools
01:46 Zoffix Just needed it for first time here: https://github.com/zoffixznet/rdev/blob/master/lib/RDev.pm6#L126-L130
01:46 Zoffix Though there may be Other Ways™. I just translated a piece of bash script.
01:50 traxex joined #perl6
01:59 giraffe joined #perl6
02:00 Zoffix AlexDaniel: I solved the issue of release delays being hard to work with: https://irclog.perlgeek.de/perl6/2017-12-20#i_15602495
02:01 Zoffix Or rather, I will, the next time it happens. Just gonna add a command to my Z-Script Awesome Rakudo Build Helper :)
02:01 Zoffix It already does the separate-checkouts stuff.
02:02 Zoffix Z-Script being this: https://github.com/zoffixznet/rdev
02:02 Zoffix It's so awesome, I can't believe it took me a year to make it :)
02:02 AlexDaniel Zoffix: fwiw some of the stuff in rdev I kinda want to see in the main makefile… :) Not sure if that's a good idea but grrr, a separate script to do the basics 🤷
02:03 Zoffix Yeah, maybe. But the maintenance burden for it is a lot lower than a makefile
02:03 AlexDaniel sure. Maybe later when it's stable?
02:03 Zoffix Well, at least for me, since I know Perl 6 but not makefile/bash :)
02:07 AlexDaniel .oO( 1. rewrite everything using sake 2. look at the code and realize how beautiful everything is now 3. ?????? 4. Oh, now you can't build rakudo without having rakudo already built, may the force be with you! )
02:08 AlexDaniel Loss!
02:09 Zoffix Heh. On all my boxes I have "stable" rakudo installed and the dev stuff is separate.
02:13 Zoffix left #perl6
02:17 syntaxman joined #perl6
02:17 syntaxman joined #perl6
02:57 ilbot3 joined #perl6
02:57 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!
03:10 Kaiepi joined #perl6
03:14 epony joined #perl6
03:16 epony joined #perl6
03:17 unicodable6 joined #perl6
03:17 squashable6 joined #perl6
03:17 benchable6 joined #perl6
03:17 reportable6 joined #perl6
03:26 konsolebox joined #perl6
04:18 aindilis` joined #perl6
05:00 Cabanossi joined #perl6
05:01 edehont joined #perl6
05:18 sena_kun joined #perl6
05:34 astj joined #perl6
05:38 kerframil joined #perl6
05:43 Guest49524 does perl6 have these? https://perldoc.perl.org/functions/-X.html
05:48 geekosaur they're adverbs in the IO::Path class
05:48 darutoko joined #perl6
05:48 geekosaur (and methods but the adverb form is often more convenient)
05:50 astj joined #perl6
05:50 Zoffix joined #perl6
05:51 Zoffix Guest49524: https://docs.perl6.org/type/IO::Path#File_test_operators
05:51 Zoffix FWIW: there are no adverbs. It's just smartmatch-with-Pair syntax that calls the method names.
05:52 Zoffix m: say 42 ~~ :abs
05:52 camelia rakudo-moar 893d09ffa: OUTPUT: «True␤»
05:52 Zoffix m: say 42 ~~ :!abs
05:52 camelia rakudo-moar 893d09ffa: OUTPUT: «False␤»
05:52 Zoffix https://docs.perl6.org/type/Pair#method_ACCEPTS
06:07 Guest49524 how do you get the path of the script you are running?
06:08 Zoffix $*PROGRAM
06:08 Zoffix huggable: FindBin
06:08 huggable Zoffix, use lib $*PROGRAM.sibling: '../lib'; # finds lib/ for scripts in bin/ or t/
06:11 Guest49524 is there a docs page for it? I need the full path
06:11 Zoffix Guest49524: $*PROGRAM.absolute
06:11 Zoffix Guest49524: it's an IO::Path object
06:11 Zoffix huggable: IO::Path
06:11 huggable Zoffix, File or directory path: https://docs.perl6.org/type/IO::Path
06:25 Guest49524 $*PROGRAM.absolute.IO.dirname
06:25 Zoffix Guest49524: what are you trying to do?
06:25 Guest49524 is there a shorter way to do that?
06:26 Guest49524 get the directory path of the running script without me knowing what directory it is?
06:26 Zoffix Yeah, but then what are you doing with it?
06:26 Guest49524 there is a directory in that directory with files for the script to use
06:27 Zoffix Guest49524: $*PROGRAM.sibling('directory-with-files-to-use')
06:28 Zoffix There's also .parent and .add methods you can use to "navigate" a path (like, transform one path to another)
06:42 enheh joined #perl6
06:52 Guest49524 thanks
06:58 xcm joined #perl6
07:00 geospeck joined #perl6
07:01 Guest49524 say qqx{$script} if $script ~~ :e & :f & :rwx;
07:01 evalable6 Guest49524, rakudo-moar 893d09ffa: OUTPUT: «(exit code 1) ===SORRY!=== Error while compiling /tmp/_Zklrc4XNB␤Variable '$script' is not declared␤at /tmp/_Zklrc4XNB:1␤------> say qqx{⏏$script} if $script ~~ :e & :f & :rwx;␤»
07:01 Guest49524 say qqx{$script} or die;
07:01 evalable6 Guest49524, rakudo-moar 893d09ffa: OUTPUT: «(exit code 1) ===SORRY!=== Error while compiling /tmp/APGroY4ZYg␤Variable '$script' is not declared␤at /tmp/APGroY4ZYg:1␤------> say qqx{⏏$script} or die;␤»
07:01 Guest49524 which of those is better?
07:02 Zoffix :e test is useless, the other two already check existence
07:03 Zoffix AlexDaniel`: FWIW I see the bot get triggered by stray code more often than by someone forgetting the "m:" https://irclog.perlgeek.de/perl6/2017-12-26#i_15622312
07:05 Zoffix Guest49524: and second one has wrong condition; you're testing return value of `say` which is always True
07:07 Zoffix if shell $script, :out { $^p.out.slurp(:close).say } else { die "Could not run the $script" }
07:07 Zoffix Well, if you're just `say`ing it, you likely don't need to capture its STDOUT and can just let it be carried forward:
07:08 Zoffix shell $script; # it'll explode automagically when sunk
07:09 Zoffix Relevant docs: https://docs.perl6.org/type/Proc#method_new
07:09 Guest49524 but it says the other two fail with X::IO::DoesNotExist ? and is not `or die` like a (try) catch all for exception handling?
07:12 Zoffix Guest49524: `fail` means return a Failure object ( https://docs.perl6.org/type/Failure ) these are "lazy" Exceptions in that they don't explode and get disarmed when evaluated in .Bool context or are tested for .defined'ness and smartmatch (`~~` op) ensures they're not exploded, so `$script ~~ :f & :rwx` will aways give either True or False.
07:13 Zoffix Guest49524: The `$foo or die` the same as `die unless $foo`. The `or` operator has precedence lower than the precedence of a subcall, so your code is like `say(…) or die` or `die unless say(…)` and say() always returns True, so that'll never die
07:13 parv joined #perl6
07:14 Zoffix Guest49524: and no, we don't have the `or die` idiom. That's Perl 5's thing. In Perl 6, many things return Failure objects and they explode when sunk (when used in void context)
07:14 Zoffix m: sub do-thing-or-explode { rand > ½ and fail "boom!"; "no boom this time" }; do-thing-or-explode
07:14 camelia rakudo-moar 893d09ffa: ( no output )
07:14 Zoffix m: sub do-thing-or-explode { rand > ½ and fail "boom!"; "no boom this time" }; do-thing-or-explode.say
07:14 camelia rakudo-moar 893d09ffa: OUTPUT: «no boom this time␤»
07:15 Zoffix m: sub do-thing-or-explode { rand > ½ and fail "boom!"; "no boom this time" }; do-thing-or-explode.say
07:15 camelia rakudo-moar 893d09ffa: OUTPUT: «no boom this time␤»
07:15 Zoffix m: sub do-thing-or-explode { rand > ½ and fail "boom!"; "no boom this time" }; do-thing-or-explode.say
07:15 camelia rakudo-moar 893d09ffa: OUTPUT: «no boom this time␤»
07:15 Zoffix :(
07:15 Zoffix m: sub do-thing-or-explode { rand > .00001 and fail "boom!"; "no boom this time" }; do-thing-or-explode.say
07:15 camelia rakudo-moar 893d09ffa: OUTPUT: «boom!␤  in sub do-thing-or-explode at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
07:15 Guest49524 sometimes you just want it to halt & catch fire?
07:16 Zoffix m: sub do-thing-or-explode { rand > .00001 and fail "boom!"; "no boom this time" }; do-thing-or-explode() orelse "Whoa who whoa.. Looks like somethind {.mess}".say
07:16 camelia rakudo-moar 893d09ffa: OUTPUT: «Whoa who whoa.. Looks like somethind (HANDLED) boom!␤  in sub do-thing-or-explode at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
07:16 Zoffix m: sub do-thing-or-explode { rand > .00001 and fail "boom!"; "no boom this time" }; do-thing-or-explode() orelse "Whoa who whoa.. Looks like something said `{.exception.message}`".say
07:16 camelia rakudo-moar 893d09ffa: OUTPUT: «Whoa who whoa.. Looks like something said `boom!`␤»
07:16 Zoffix Guest49524: well, yeah, that's what Failures do if you don't "handle" them (evaluate in Bool or defined contexts)
07:17 Zoffix ^ like above, `orelse` op handles that Failure because it checks .defined'ness, and so nothing gets thrown
07:17 Zoffix Bascially Failures let you handle Exceptions using boolean/definedness constructs rather than `try { CATCH {} }` stuff (tho we have that too, if that's your thing)
07:18 Zoffix m: sub do-thing-or-explode { rand > .00001 and fail "boom!"; "no boom this time" }; try { do-thing-or-explode(); CATCH { default { "Whoa who whoa.. Looks like something said `{.message}`".say } } }
07:18 camelia rakudo-moar 893d09ffa: OUTPUT: «Whoa who whoa.. Looks like something said `boom!`␤»
07:18 Zoffix (`try` block automatically enables `use fatal` pragma which lexically makes Failures explosive right away)
07:21 Zoffix and shell() returns Proc object which throws when sunk if the exitcode isn't zero
07:26 Guest49524 my $say = qqx{"_$script"} or die;
07:27 konsolebox joined #perl6
07:34 konsolebox joined #perl6
07:37 * Zoffix finally tries out Cro
07:37 Zoffix Performance is A LOT better than what I was expecting.
08:00 konsolebox joined #perl6
08:00 domidumont joined #perl6
08:05 domidumont joined #perl6
08:06 psychoslave joined #perl6
08:26 philomath_ joined #perl6
08:38 setty1 joined #perl6
08:41 domidumont joined #perl6
08:46 psychoslave joined #perl6
08:57 Voldenet Zoffix: Really? The last time I tested it was quite terrible - how many requests per second?
08:59 moritz isn't "time per request" the more interesting measure?
08:59 moritz you can typically scale requests per second with more cores
09:03 Voldenet moritz: they are both interesting, some servers are highly concurrent but not very fast
09:09 wamba joined #perl6
09:10 Voldenet I'm more interested in requests per second because it means cheaper servers ;P
09:10 Voldenet uh, hm, time per request means that too though
09:20 astj joined #perl6
09:23 psychoslave joined #perl6
09:35 woolfy joined #perl6
09:36 woolfy left #perl6
09:37 rindolf joined #perl6
09:43 psychoslave joined #perl6
09:54 konsolebox joined #perl6
10:03 pmurias joined #perl6
10:10 lizmat joined #perl6
10:16 psychoslave joined #perl6
10:21 faraco joined #perl6
10:27 faraco left #perl6
10:35 itaylor57 joined #perl6
10:43 psychoslave joined #perl6
10:54 eliasr joined #perl6
11:00 konsolebox joined #perl6
11:11 psychoslave joined #perl6
11:17 FROGGS joined #perl6
11:17 sena_kun joined #perl6
11:18 pmooney joined #perl6
11:21 Guest49524 how do you run an external program and interact with it?
11:21 FROGGS morning
11:21 Guest49524 FROGGS: night
11:21 FROGGS Guest49524: see https://docs.perl6.org/language/ipc
11:22 pmurias joined #perl6
11:22 Guest49524 FROGGS: run and shell and qx and qqx do not work interactively
11:23 FROGGS Guest49524: and what about async mentioned at the bottom?
11:23 FROGGS I dunno what you need
11:24 pmooney which channel can I ask about the perl6 docs, in particular https://docs.perl6.org/language/classtut  ???
11:24 moritz here
11:25 pmooney cool
11:26 pmooney to my eyes, the method add-dependency is confusing. Its in the example class for Task but is not actually used. Am I right?
11:29 pmooney stepping away from computer for a short while, back soon
11:31 moritz pmooney: it's not used, but you could use it
11:31 moritz it's part of Task's API
11:36 konsolebox joined #perl6
11:38 buggable New CPAN upload: Sparky-0.0.24.tar.gz by MELEZHIK https://cpan.metacpan.org/authors/id/M/ME/MELEZHIK/Perl6/Sparky-0.0.24.tar.gz
11:42 Guest49524 FROGGS: async cannot handle pipes?
11:43 FROGGS I'm not sure
11:44 geospeck joined #perl6
11:44 * lizmat clickbaits https://p6weekly.wordpress.com/2017/12/25/2017-52-when-it-is-no-more/
11:58 eythian joined #perl6
12:00 markong joined #perl6
12:01 konsolebox joined #perl6
12:02 geospeck joined #perl6
12:04 piojo_ joined #perl6
12:11 Guest49524 https://docs.perl6.org/type/Proc::Async
12:11 Guest49524 No such method 'bind-stdin' for invocant of type 'Proc::Async'
12:12 Guest49524 that should allow piping
12:12 flatwhite joined #perl6
12:14 lizmat Guest49524: it may not be documented yet, but that method definitely exists in the Proc::Async code
12:16 lizmat https://github.com/rakudo/rakudo/blob/master/src/core/Proc/Async.pm#L226
12:16 R0b0t1 joined #perl6
12:18 Guest49524 lizmat: it only has a non working example in the docs
12:18 lizmat if it's not working, we would greatly appreciate a Github Issue on the rakudo repo  :-)
12:19 jnthn Guest49524: perl6 --version - perhaps you have a version older than that method?
12:19 Guest49524 how?
12:19 Guest49524 jnthn: This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda implementing Perl 6.c.
12:19 Geth ¦ doc: 564aae20bb | (Elizabeth Mattijsen)++ | 2 files
12:19 Geth ¦ doc: Minimal documentation of use newline / $?LF
12:19 Geth ¦ doc: review: https://github.com/perl6/doc/commit/564aae20bb
12:20 lizmat Guest49524: ah, yes, that would explain
12:20 Voldenet Guest49524: I've checked on 2017.10 and it does handle pipes
12:20 El_Che lizmat: does the rakudo test suite accept the TEST_VERBOSE=1 option?
12:20 lizmat not sure, /me checks
12:21 lizmat I don't see a difference in behaviour
12:21 El_Che so, no :)
12:22 Voldenet Guest49524: http://ix.io/DoK the code I've used to test piping, looks like it's working
12:29 jnthn Guest49524: I don't remember exactly what month bind-stdin went in, but it was summer this year. So that'll be why the error - that method didn't exist back in 2017.04
12:35 timotimo https://github.com/rakudo/rakudo/commit/dc0e39b6211b86013e2f5e47531e8835eacb173c - looks like 2017.06 is the first release to haev it
12:36 timotimo we should introduce a networking component to rakudo that regularly (once or twice a month) downloads a text file that lists all methods for all core setting classes and what release they first went in on, and then when we get a "method not found" exception for a class in the core setting we should search that file :P
12:40 lizmat .oO( and then download a patch, install that, and continue after the exception :-)
12:44 greppable6 joined #perl6
12:45 timotimo i didn't want to go quite that far :)
12:57 xinming_ joined #perl6
13:04 pecastro joined #perl6
13:08 geospeck joined #perl6
13:09 mahafyi joined #perl6
13:10 itaipu joined #perl6
13:15 AlexDaniel joined #perl6
13:27 R0b0t1 joined #perl6
13:28 psychoslave joined #perl6
13:47 teatime "30 things about Perl on its 30th birthday"  weird, I would have guessed Perl as older than that.
13:48 teatime quite young really, for such an influential language.
13:50 hummy2 joined #perl6
13:52 hummy2 Hi need to instll plod.shar for systemadministrators
13:53 masak teatime: Fortran is 60 years old. our whole industry is extremely new.
14:02 teatime I suppose you are right.l
14:02 teatime also I am old :/
14:02 MasterDuke joined #perl6
14:03 Aaronepo_ joined #perl6
14:07 mspo https://docs.perl6.org/language/5to6-perlsyn#Goto
14:11 kerframil left #perl6
14:16 ggoebel joined #perl6
14:19 hummy joined #perl6
14:23 hummy have installed gentoo foss-cloud. now want to make logs for management purposes. plod is tool but dont know how to install plod.shar file
14:26 psychoslave joined #perl6
14:37 konsolebox joined #perl6
14:38 cognominal joined #perl6
14:53 moritz hummy: wrong channel, maybe?
14:57 hummy2 joined #perl6
14:58 psychoslave joined #perl6
15:11 cognominal joined #perl6
15:28 xcm joined #perl6
15:37 psychoslave joined #perl6
15:40 telex joined #perl6
15:43 konsolebox joined #perl6
15:49 Summertime for the following: say do loop { state $x = 0;  last if ++$x > 2;  $x; };
15:49 Summertime why doesn't the state stay... statey? it seems to get reset each loop?
15:50 Summertime switching to:  loop { state $x = 0;  last if ++$x > 2;  $x.say; }
15:51 Summertime the state works, but then you can't get the values out as easily
15:51 moritz Summertime: state behaves like an outer lexical variable
15:51 moritz Summertime: if the outer lexical scope is re-entered, the state variable is reset
15:53 Summertime what would be the outer scope? it wouldn't have a reason to re-enter from... uh... say? would it?
16:03 Summertime say do for ^10 { state $x = 0;  last if ++$x > 2;  $x; } # seems to work fine too, just seems specific to loop's scope when used as an expression(?)?
16:03 AlexDaniel to me that looks like a bug
16:03 AlexDaniel 6c: say do loop { state $x = 0;  last if ++$x > 2; say $x; };
16:04 AlexDaniel uh
16:04 committable6 joined #perl6
16:05 coverable6 joined #perl6
16:05 nativecallable6 joined #perl6
16:05 AlexDaniel 6c: say do loop { state $x = 0;  last if ++$x > 2; say $x; };
16:05 quotable6 joined #perl6
16:05 releasable6 joined #perl6
16:05 statisfiable6 joined #perl6
16:05 AlexDaniel committable you kidding me!
16:05 b2gills m: do loop { state $x = 0; $x.say;  last if ++$x > 2;  $x; }
16:05 camelia rakudo-moar 5c2283331: OUTPUT: «WARNINGS for <tmp>:␤0␤1␤2␤Useless use of $x in sink context (line 1)␤»
16:05 committable6 joined #perl6
16:06 b2gills m: say do loop { state $x = 0; $x.say;  last if ++$x > 2;  $x; }
16:06 Summertime the poor innocent bots vv
16:06 camelia rakudo-moar 5c2283331: OUTPUT: «(timeout)0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0␤0…»
16:08 b2gills That is definitely a bug.
16:08 AlexDaniel 6c: my $global; say do loop { state $x = 0; last if ++$x > 2; say $x; last if $global++ > 10 };
16:08 committable6 AlexDaniel, ¦6c (26 commits): «1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤()␤»
16:08 AlexDaniel c: all my $global; say do loop { state $x = 0; last if ++$x > 2; say $x; last if $global++ > 10 };
16:09 committable6 AlexDaniel, https://gist.github.com/1392eb375ae2fc25a33c87a7917fe961
16:10 AlexDaniel c: all my $global; say do loop { state $x = 0; last if ++$x > 2; last if $global++ > 10; $x };
16:10 b2gills m: say do for 1..* { state $x = 0; $x.say;  last if ++$x > 2;  $x; } # it should work more like this
16:10 camelia rakudo-moar 5c2283331: OUTPUT: «0␤1␤2␤(3 3)␤»
16:10 committable6 AlexDaniel, https://gist.github.com/535b15bc50aa0fdb637d5f7070c8ef74
16:10 Summertime hmm, should I report it to morevm/morevm? or some other repo...?
16:11 AlexDaniel huggable: rakudobug
16:11 huggable AlexDaniel, Report bugs on https://github.com/rakudo/rakudo/issues/new    If you don't have access to GitHub, you can email your report to rakudobug@perl.org . See also: https://github.com/rakudo/rakudo/wiki/rt-introduction
16:11 AlexDaniel Summertime: ↑
16:11 Summertime ah, thanks!
16:11 AlexDaniel j: say 42
16:11 camelia rakudo-jvm a92950fb4: OUTPUT: «42␤»
16:11 AlexDaniel j: my $global; say do loop { state $x = 0; last if ++$x > 2; last if $global++ > 10; $x };
16:11 camelia rakudo-jvm a92950fb4: OUTPUT: «(1 2)␤»
16:11 AlexDaniel well, heh, that works on jvm?? :D
16:22 Kaiepi joined #perl6
16:24 Summertime and done, thanks for the feedback and extra testing, I was getting a bit confused trying to work out why it wasn't working
16:30 Kaiepi joined #perl6
16:38 mingdao joined #perl6
16:49 geospeck_ joined #perl6
16:49 Summertime j: say do loop { state $x = 0; last if ++$x > 2; $x }
16:49 camelia rakudo-jvm a92950fb4: OUTPUT: «(1 2)␤»
16:50 Summertime j: say do for ^5 { state $x = 0; last if ++$x > 2; $x }
16:50 camelia rakudo-jvm a92950fb4: OUTPUT: «(3 3)␤»
16:50 Summertime that'd be because loop is lazy?
16:55 lizmat m: do loop { state $x = 0; last if ++$x > 2; say $x; $x }
16:55 camelia rakudo-moar 5c2283331: OUTPUT: «WARNINGS for <tmp>:␤1␤2␤Useless use of $x in sink context (line 1)␤»
16:55 lizmat m: say do loop { state $x = 0; last if ++$x > 2; say $x; $x }
16:56 camelia rakudo-moar 5c2283331: OUTPUT: «(timeout)1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1␤1…»
16:56 lizmat seems to be some interaction between say and do and loop that causes a new scope to be cloned
16:56 geospeck joined #perl6
17:00 khw joined #perl6
17:06 cognominal joined #perl6
17:08 setty1 joined #perl6
17:31 rindolf joined #perl6
17:31 andrzejku joined #perl6
17:39 andrzejku hey
17:39 andrzejku people
17:43 moritz \o
17:47 andrzejku moritz :)
17:55 albongo joined #perl6
17:58 pmurias joined #perl6
18:04 Kaiepi joined #perl6
18:06 natrys joined #perl6
18:08 jast joined #perl6
18:24 Zoffix Voldenet: don't really care about requests per second. I'm not Facebook and rarely would have more than a couple.
18:27 rgrau joined #perl6
18:36 andrzejku joined #perl6
18:37 Zoffix El_Che: you can just add a command on travis to run perl6 t/02-rakudo/whatvertest-that-fails.t
18:37 Zoffix oh you already did it; nm
18:38 pmurias joined #perl6
18:40 Geth ¦ doc: 5893559b9f | (Jeremy Studer)++ (committed by Zoffix Znet) | 3 files
18:40 Geth ¦ doc: Rewrite, remove inaccurate Range truncation info (#1681)
18:40 Geth ¦ doc:
18:40 Geth ¦ doc: * Rewrite, remove inaccurate Range trucation info
18:40 Geth ¦ doc:
18:40 Geth ¦ doc: Previously, this section stated that:
18:40 Geth ¦ doc:
18:40 Geth ¦ doc: * All ranges (including non-lazy ones) will truncate the output/ omit
18:40 Geth ¦ doc: <…commit message has 51 more lines…>
18:40 Geth ¦ doc: review: https://github.com/perl6/doc/commit/5893559b9f
18:50 espadrine joined #perl6
18:54 pecastro joined #perl6
19:03 mingdao joined #perl6
19:05 itaylor57 joined #perl6
19:05 dugword joined #perl6
19:12 mingdao joined #perl6
19:25 cdg joined #perl6
19:31 pilne joined #perl6
19:31 traxex joined #perl6
19:38 pecastro joined #perl6
19:42 traxex joined #perl6
19:43 domidumont joined #perl6
19:44 cdg joined #perl6
19:53 pmurias joined #perl6
19:54 traxex joined #perl6
20:02 Zoffix left #perl6
20:13 traxex joined #perl6
20:23 bisectable6 joined #perl6
20:23 bloatable6 joined #perl6
20:25 andrzejku joined #perl6
20:27 cdg joined #perl6
20:28 traxex joined #perl6
20:28 andrzejku joined #perl6
20:33 traxex joined #perl6
20:33 pmurias joined #perl6
20:39 dugword joined #perl6
20:47 xinming joined #perl6
20:58 evalable6 joined #perl6
21:10 psychoslave joined #perl6
21:19 dugword joined #perl6
21:25 Zoffix joined #perl6
21:26 Zoffix timotimo: is JSON::Fast shoving {"0": null} for object by-design?
21:26 * Zoffix was expecting .Capture to be used
21:26 timotimo that doesn't sound right, yeah
21:27 timotimo well, can't really use capture, because no support for mixed positional and keyed in json objects
21:27 Zoffix Ah
21:27 timotimo looks like it uses .keys
21:27 timotimo and then accesses it via { }
21:28 Zoffix Ah
21:28 moritz star: use JSON::Tiny; say to-json( class { $.x }.new(:x(42)) )
21:28 camelia star-m 2017.07: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable $.x used where no 'self' is available␤at <tmp>:1␤------> 3use JSON::Tiny; say to-json( class { $.x7⏏5 }.new(:x(42)) )␤    expecting any of:␤        term␤»
21:28 timotimo need "has"
21:28 moritz star: use JSON::Tiny; say to-json( class { has $.x }.new(:x(42)) )
21:28 camelia star-m 2017.07: OUTPUT: «Can't serialize an object of type <anon|87187968>␤  in sub to-json at /home/camelia/star-2017.07/share/perl6/site/sources/9B467EEF9267A777BB53BAA2F19BE2C9D756BEED (JSON::Tiny) line 51␤  in block <unit> at <tmp> line 1␤␤»
21:28 moritz thanks timotimo
21:29 Zoffix star: use JSON::Tiny; say to-json (class { has $.x }.new(:x(42)),)».Capture
21:29 camelia star-m 2017.07: OUTPUT: «Can't serialize an object of type Capture␤  in sub to-json at /home/camelia/star-2017.07/share/perl6/site/sources/9B467EEF9267A777BB53BAA2F19BE2C9D756BEED (JSON::Tiny) line 51␤  in sub to-json at /home/camelia/star-2017.07/share/perl6/site/sources/9B467E…»
21:29 Zoffix bah
21:29 Zoffix Well, doing ».Capture Did The Right Thing with JSON::Fast :)
21:29 timotimo it does, eh?
21:30 Zoffix star: use JSON::Fast; say to-json (class { has $.x }.new(:x(42)),)».Capture
21:30 camelia star-m 2017.07: OUTPUT: «[␤  {␤    "x": 42␤  }␤]␤»
21:30 timotimo how is it supposed to handle things that give both positionals and nameds in the capture?
21:31 Zoffix star: use JSON::Fast; say to-json class { method Capture { \(<a b c>, :42foo) } }.Capture
21:31 camelia star-m 2017.07: OUTPUT: «{␤  "0": null,␤  "foo": 42␤}␤»
21:31 obfusk joined #perl6
21:31 timotimo that looks wrong
21:31 Zoffix mhm
21:31 timotimo m: say \(<a b c>, :42foo).keys
21:31 camelia rakudo-moar 5c2283331: OUTPUT: «(0 foo)␤»
21:31 timotimo m: say \(\<a b c>, :42foo).keys
21:31 camelia rakudo-moar 5c2283331: OUTPUT: «(0 foo)␤»
21:31 timotimo m: say \(|<a b c>, :42foo).keys
21:31 camelia rakudo-moar 5c2283331: OUTPUT: «(0 1 2 foo)␤»
21:31 timotimo you did the capture wrong :)
21:32 timotimo but it'll not do the right thing with those keys
21:32 Zoffix star: use JSON::Fast; say to-json class { method Capture { \(|<a b c>, :42foo) } }.Capture
21:32 camelia star-m 2017.07: OUTPUT: «{␤  "0": null,␤  "1": null,␤  "2": null,␤  "foo": 42␤}␤»
21:32 timotimo or does json support integer keys?
21:32 timotimo i don't think it does
21:32 moritz it does not
21:33 Zoffix FWIW, Perl5's Mojo::JSON and several other JSON modules try to call .TO-JSON on objects they don't recognize
21:33 timotimo hm, yeah, we could implement that in both our json modules
21:33 timotimo tiny and fast, i mean
21:33 moritz Zoffix: .TO_JSON, maybe?
21:33 timotimo i'd've maybe said either .Json or .JSON
21:34 * moritz likes AS-JSON better than TO-JSON
21:34 moritz "to" implies an in-place conversion
21:34 Zoffix moritz: they use .TO_JSON yeah, but IMO P6 version should be the status quo kebob-case
21:34 timotimo to-json doesn't do that either :)
21:39 moritz fwiw JSON::Tiny won't be the first mover when it comes to such a method, but will accept patches if other modules come to a consensus
21:40 moritz it's not JSON::Experimental after all :-)
21:44 xcm joined #perl6
21:45 timotimo gfldex had found some rather big speed improvements by making all escapes based on \u sequences rather than the different ones we have
21:47 timotimo i might be able to combine both approaches, actually
21:47 timotimo oh, but that code isn't able to handle surrogate pairs
21:49 Zoffix left #perl6
21:50 timotimo zoffix, got a good idea for when a capture has both positionals and string keys "0", "1", "2" for example
22:03 leah2 joined #perl6
22:07 aindilis joined #perl6
22:27 andrzejku joined #perl6
22:27 aindilis` joined #perl6
22:31 gfldex timotimo: i found that speeding to-json up breaks tests of quite a few modules that make the assumption that JSON round trips are easy
22:39 devmikey joined #perl6
22:39 timotimo i feared as much :(
22:39 gfldex we have to break those at some point
22:39 gfldex because that assumption is simply false
22:40 timotimo i think i'll steal your str-escape but make it output \t and friends again instead of \u...
23:06 timotimo looks like i found a way to make it rather a bit slower
23:09 timotimo um, huh
23:09 timotimo gfldex: did you test the str-escape change with strings that have to-be-escaped things in them? because it seems incredibly slow compared to the old code
23:14 lizmat m: say Mu ~~ (*); say Mu ~~ Whatever   # why the difference ?
23:14 camelia rakudo-moar 89d85baa4: OUTPUT: «True␤False␤»
23:15 timotimo gfldex: with my old code it does a 5k string with some special chars in it in just 1.02 seconds, whereas your code spends 112 seconds (this is for to-json-ing the same string 1k times)
23:16 lizmat sleep&
23:17 teatime lizmat: they seem totally different.  Mu ~~ Whatever should def. be false.  I dunno enough about whatever star to know what Mu ~~ (*) should be, however it's actually False on my 2017.09 install.
23:19 lizmat m: say (*).WHAT   # should be a bare Whatever afaics
23:19 camelia rakudo-moar 89d85baa4: OUTPUT: «(Whatever)␤»
23:20 lizmat ah, it's a test that Zoffix added today...
23:20 lizmat I think the test is wrong  :-)
23:21 lizmat really sleep&
23:21 dogbert17 anyone have time for a nOoB question?
23:21 teatime I've never been denied :)
23:21 aindilis joined #perl6
23:21 dogbert17 say (1, 0, -1) Z+ (1,0,-1); # this does what I expect
23:21 evalable6 dogbert17, rakudo-moar 89d85baa4: OUTPUT: «(2 0 -2)␤»
23:21 dogbert17 my %dirs = (ne => (1, 0, -1)); say %dirs<ne> Z+ %dirs<ne>; # but this doesn't
23:22 dogbert17 m: my %dirs = (ne => (1, 0, -1)); say %dirs<ne> Z+ %dirs<ne>; # but this doesn't
23:22 camelia rakudo-moar 89d85baa4: OUTPUT: «(6)␤»
23:22 Zoffix joined #perl6
23:22 dogbert17 expected the second example to give the same answer as the first
23:22 Zoffix lizmat: why is the test wrong? (*) is Whatever:D and accepts everything, while Whatever is Whatever:U and it's a type-check smartmatch
23:23 Zoffix m: my %dirs = (ne => (1, 0, -1)); say %dirs<ne><> Z+ %dirs<ne><>;
23:23 camelia rakudo-moar 89d85baa4: OUTPUT: «(2 0 -2)␤»
23:23 Zoffix dogbert17: their conted
23:23 dogbert17 huh
23:24 Zoffix huggable: decont
23:24 huggable Zoffix, Article on containers and decont: https://perl6advent.wordpress.com/2017/12/02/#theoneandonly
23:25 Zoffix m: dd (1, 2, 3) Z+ (4, 5, 6)
23:25 camelia rakudo-moar 89d85baa4: OUTPUT: «(5, 7, 9).Seq␤»
23:25 dogbert17 Zoffix++, lol guess I'll have to read it :-)
23:25 Zoffix m: dd $(1, 2, 3) Z+ $(4, 5, 6)
23:25 camelia rakudo-moar 89d85baa4: OUTPUT: «(6,).Seq␤»
23:25 Zoffix s/their/tehy're/;
23:26 * dogbert17 is actually working on an AoC problem
23:27 Zoffix lizmat: note, that along with the test there was a rakudo commit; you'll need it for test to pass
23:31 Zoffix timotimo: what if the named portion has "0", "1", "2" as keys?
23:32 Zoffix { "list": [0, 1, 2], "named": { "foo": 42 } }
23:32 cdg joined #perl6
23:33 Zoffix star: use JSON::Fast; dd from-json 「[ 0, 1, 2, { "foo": 42 } ]」
23:33 camelia star-m 2017.07: OUTPUT: «$[0, 1, 2, {:foo(42)}]␤»
23:33 Zoffix star: use JSON::Fast; dd from-json 「[[0, 1, 2], { "foo": 42 }]」
23:33 camelia star-m 2017.07: OUTPUT: «$[[0, 1, 2], {:foo(42)}]␤»
23:44 Zoffix left #perl6
23:55 eythian joined #perl6
23:55 eythian joined #perl6

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

Perl 6 | Reference Documentation | Rakudo