Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-10-30

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:02 seatek FROGGS: Thank you for linking that video by PM - just finished watching it.
00:10 timotimo i removed a duplicate ticket on perl6/doc, so i'm +1/-1
00:10 cyphase joined #perl6
00:16 kaare_ joined #perl6
00:21 AlexDaniel timotimo: yeah, well… yeah… I have a problem with this ratio
00:22 AlexDaniel in fact, I'm surprised nobody is beating me with a stick saying that I should get some stuff done
00:23 AlexDaniel … right now I am only turning my complaints into tickets, but I should be turning my complaints into code, I guess
00:29 cdg joined #perl6
00:41 timotimo don't worry about it
00:58 * viki beats AlexDaniel with a stick.
00:58 viki Write some code, dammit!
00:59 AlexDaniel ouch!
01:08 aborazmeh joined #perl6
01:08 aborazmeh joined #perl6
01:27 flaviusb joined #perl6
01:34 aborazmeh joined #perl6
01:34 aborazmeh joined #perl6
01:51 FROGGS joined #perl6
02:02 SmokeMachine____ viki: thanks!
02:14 viki ¯\_(ツ)_/¯
02:18 ugjka joined #perl6
02:22 bjz joined #perl6
02:26 TakinOver joined #perl6
02:51 skids joined #perl6
03:01 SmokeMachine____ Is there any way to from some code compile another file of code and get its $=pod?
03:02 noganex_ joined #perl6
03:06 SmokeMachine____ viki: (I was talking about the link that you fixed... the rakudo for mac download link)
03:11 cdg joined #perl6
03:40 viki ah
03:45 snowman joined #perl6
04:11 cdg joined #perl6
04:21 brillenfux joined #perl6
04:33 rindolf joined #perl6
04:36 kurahaupo__ joined #perl6
04:44 brillenfux joined #perl6
04:57 viki Adding to earlier talks about importing specific functions from a module... Neat idea worth stealing: https://doc.rust-lang.org/book/crates-and-modules.html#complex-imports
04:58 viki module Foo { sub some_awful_snake_case {... } }; import Foo (&awful_snake_case as &awesome-kebob-case); or whatever :)
04:58 canopus joined #perl6
05:01 viki s/&awful/&some_/;
05:01 viki bah...
05:01 viki you know what I meant :D
05:06 viki m: sub infix:<as> (&what, Str $as) { qq|our &$as = &what|.EVAL }; BEGIN &say as 'shout-loudly';  as::shout-loudly 42
05:06 camelia rakudo-moar db61aa: OUTPUT«42␤»
05:06 viki close enough      (•_•)           ( •_•)>⌐■-■          (⌐■_■)
05:19 bjz joined #perl6
05:42 Cabanossi joined #perl6
05:56 pierre_ joined #perl6
06:00 rurban joined #perl6
06:05 andrzejku_ joined #perl6
06:26 labster joined #perl6
06:45 wamba joined #perl6
06:46 darutoko joined #perl6
06:57 rurban joined #perl6
07:12 Tonik joined #perl6
07:30 samcv just trying out native call... so far printing out some values returned by a struct pointer in a library, but so far, impressed
07:30 samcv next to try and do something useful
08:13 CIAvash joined #perl6
08:17 mohae joined #perl6
08:22 firstdayonthejob joined #perl6
08:27 Cabanossi joined #perl6
08:34 Cabanossi joined #perl6
08:45 RabidGravy joined #perl6
08:45 brillenfux joined #perl6
08:47 pierre_ joined #perl6
08:56 pierre_ joined #perl6
09:03 espadrine joined #perl6
09:27 RabidGravy harr!
09:27 RabidGravy moritz++ # I  was just going to suggest that :)
09:29 moritz suggest what? giving you a commit bit?
09:29 * moritz a bit context deprived
09:30 RabidGravy yes
09:32 RabidGravy I am determined to have all the modules that are thus configured to be passing in Travis :)
09:53 domidumont joined #perl6
10:01 RabidGravy I am right in recalling MONKEY-SEE-NO-EVAL is lexical in its effect?
10:03 lizmat RabidGravy: should be
10:03 lizmat m: { use MONKEY-SEE-NO-EVAL }; EVAL "42"
10:03 camelia rakudo-moar db61aa: ( no output )
10:03 lizmat hmmmm...
10:03 lizmat m: EVAL "42"
10:03 camelia rakudo-moar db61aa: ( no output )
10:04 lizmat m: say EVAL "42"
10:04 camelia rakudo-moar db61aa: OUTPUT«42␤»
10:04 RabidGravy it doesn't do anything when it's just a literal
10:04 lizmat ah
10:04 lizmat m: { use MONKEY-SEE-NO-EVAL }; EVAL "my $a = 42"
10:04 camelia rakudo-moar db61aa: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$a' is not declared␤at <tmp>:1␤------> 3{ use MONKEY-SEE-NO-EVAL }; EVAL "my 7⏏5$a = 42"␤»
10:04 RabidGravy my $f = 42;   say EVAL $f;
10:04 RabidGravy m: my $f = 42;   say EVAL $f;
10:04 camelia rakudo-moar db61aa: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma to override this error,␤but only if you're VERY sure your data contains no injection attacks)␤at <tmp>:1␤------> 3my $f = 42;   …»
10:04 lizmat m: { use MONKEY-SEE-NO-EVAL }; EVAL 'my $a = 42'
10:04 camelia rakudo-moar db61aa: ( no output )
10:04 lizmat ah, ok
10:05 lizmat m: { use MONKEY-SEE-NO-EVAL }; my $f = 42; EVAL $f
10:05 camelia rakudo-moar db61aa: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma to override this error,␤but only if you're VERY sure your data contains no injection attacks)␤at <tmp>:1␤------> 3ONKEY-SEE-NO-E…»
10:05 lizmat m: { use MONKEY-SEE-NO-EVAL; my $f = 42; EVAL $f }
10:05 camelia rakudo-moar db61aa: ( no output )
10:05 lizmat so yes, lexical
10:08 RabidGravy cool, I proceeded on that assumption :)
10:43 samcv anybody know if i can asynchronously run nativecall functions?
10:43 samcv run a nativecall function processing the data but can terminate before it returns depending on the output of it
10:44 samcv should work with promises?
10:49 kjs_ joined #perl6
10:51 leont joined #perl6
10:54 nine Does an introduction into web programming in Perl 6 exist? Any pointer at what to use?
10:55 lizmat perhaps tbrowder has an idea ?
10:56 dalek ecosystem: 1813d2f | (Pawel Pabian)++ | META.list:
10:56 dalek ecosystem: Rename META.info to META6.json to be more compatible with S22 spec.
10:56 dalek ecosystem: review: https://github.com/perl6/ecosystem/commit/1813d2f8f7
11:12 AlexDaniel joined #perl6
11:23 RabidGravy samcv, well you can definitely run them asynchronously, but the terminating behaviour is dependent on the function itself
11:24 RabidGravy of course most library functions that are designed to be used in that way will actually take a function callback to provide the data
11:26 RabidGravy nine, depends on how much you want the module to do, I've had a lot of success with the HTTP::Server::Tiny/Crust combo
11:26 RabidGravy but if you want the module to deal with the templating and everything else then maybe something else
11:27 RabidGravy Bailador is coming on and I fixed Hiker the other dayd
11:30 RabidGravy samcv, also note that the thread safety or otherwise of a C library function is entirely dependent on its implementation - there are still libraries out there which use static data which usually don't play nicely with threads
11:31 nine RabidGravy: I'm contemplating giving a "Web dev and Perl 6" talk. While I've got good material on how to use Perl 5 frameworks and modules in Perl 6, I have a serious lack of knowledge about how far we are with pure Perl 6 web dev.
11:32 RabidGravy samc,, if the library provides an init() or something that returns an opaque pointer or struct that is then passed on to the other functions then you're usually good to go
11:32 RabidGravy samcv, ^ rather
11:33 RabidGravy nine, I think it can be summarised as "the fundamentals are getting there, but there isn't a high level of abstraction yet" :)
11:34 araujo joined #perl6
11:34 RabidGravy essentially if you think of Bailador as being in the same vein as Dancer and Crust as being similar to Plack then you won't go far wrong
11:43 RabidGravy nine, only example in the wild that I have is Lumberjack::Application
11:43 RabidGravy which uses Crust/Template6/Websockets ....
11:45 CIAvash joined #perl6
11:51 RabidGravy also Audio::StreamThing which isn't a traditional web application however
11:51 cdg joined #perl6
11:54 pierre_ joined #perl6
11:55 kurahaupo joined #perl6
11:55 cdg_ joined #perl6
11:57 pierre_ joined #perl6
11:59 kjs_ joined #perl6
12:00 tbrowder lizmat: I would love to know about such a link about web programming in P6. The only thing i've found is the various p6 frameworks in the ecosystem.  I wouldn't be surprised if Gabor were working on such a thing.
12:01 nine tbrowder: I've seen a talk by gabor about web dev in Perl 6 but that was really just a Bailador introduction. And lots of questions were answered by "you'll have fun implementing infrastructure"
12:02 nine not a quote but that was the gist ;)
12:10 RabidGravy I was looking at Scala's Play framework at work this week, and whilst people might rave about Scala - what we have is already more sophisticated than that
12:14 RabidGravy there's a really good new "web framework paradigm" in Perl 6 waiting to get out but I haven't quite grasped it yet
12:20 kurahaupo__ joined #perl6
12:25 kurahaupo_ joined #perl6
12:27 nine Yeah, I've been thinking about that on and off, too. I am however fairly biased towards Catalyst, as I have litte experience with anything else.
12:28 nadim joined #perl6
12:30 RabidGravy yeah, me too - I think nearly everyone is influenced by some existing framework - whether that's Catalyst, Dancer, Mojolicious or whatever - what we need is some ambitious young tyro to come in who hasn't got the baggage from other things and just make something
12:38 nine OTOH Mojolicous and Catalyst were both started by sri
12:43 RabidGravy and Catalyst was basically a fork of Mayflower which was started by Simon Cozens (who was a young tyro at that time ;-)
12:43 aborazmeh joined #perl6
12:43 aborazmeh joined #perl6
12:48 andrzejku_ joined #perl6
12:48 RabidGravy I think there needs to be a "Perl 6 Web Framework Hackathon" in a place with loads of booze
12:55 Actualeyes joined #perl6
13:11 cibs joined #perl6
13:15 andrzejku_ joined #perl6
13:15 RabidGravy the problem is that whenever this has been discussed before certain people think that you're saying that all of those other things are shit and get all upset, whereas what is actually being said that given a completely blank sheet you'd probably come up with something different in P6 vs P5
13:19 nine Like you wouldn't do the same as Catalyst because in Perl 6 you have real, introspectable method signatures
13:20 nine I kinda think I would like Catalyst's routing (using the mentioned signatures) and Dancer's dynamically scoped variables, so you'd not have to pass around $c everywhere.
13:22 BenGoldberg joined #perl6
13:25 BenGoldberg m: say use Test;
13:25 camelia rakudo-moar fc47bb: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared name:␤    Test used at line 1␤Undeclared routine:␤    use used at line 1␤␤»
13:25 BenGoldberg m: use Test;
13:25 camelia rakudo-moar fc47bb: ( no output )
13:26 BenGoldberg m: say do use Test;
13:26 camelia rakudo-moar fc47bb: OUTPUT«Nil␤»
13:27 RabidGravy nine, I quite liked how DrForr was going with Prancer using multi-dispatch to find the routes
13:34 RabidGravy there's a sweet spot around multi-dispatch, traits and introspection - I'll get there at some point
13:38 RabidGravy maybe I'll do a provocative talk on this at the LPW to chivvy along some discussion
13:55 domidumont joined #perl6
13:56 snowman joined #perl6
13:58 viki ehehe... an "Engineering Manager at Red Hat" isn't too happy that Perl 6's version of code is like 3 times shorter than Rust's: https://twitter.com/acruiz/status/792726277912395776
13:58 viki I wouldn't be too surprised if there's a shorter version, but... just show it to me dude :P
13:58 nine RabidGravy: though I wonder if that's where a web programmer's actual problems are.
13:59 viki Probably not :) routes are like 0.0005% of all of my apps code more often than not :)
14:00 nine Maintainability of our large web apps suffers not from odd looking routing syntax must mostly from architectural issues. Most notably people putting far too much code into controllers.
14:00 nine And *::Utils packages
14:02 nine And on the other end, models being implemented right into DBIx::Class Result and ResultSet classes. Now having business logic there instead of controllers is already a huge step forward, but it makes re-using that code for data you didn't fetch from a DB hard.
14:03 nine For example when you would like to do some calculations on the user's input before writing it to the DB when the code was written to work with query results.
14:03 RabidGravy yes, but that part is just "crap programming" ;-)
14:04 nine Yes and no. If it were dead easy to put all our business logic in plain old classes and have simple (or even better, free) ways to convert DBIC results to such classes, people would just do that.
14:05 masak nine: what's making it not-dead-easy?
14:05 nine Now with Moose creating lots of classes is already nice. In Perl 6 it's downright the easiest thing to do.
14:06 RabidGravy I've always worked like that, make a DB layer, make a business logic layer, consume business logic layer in the web part
14:07 nine masak: maybe it's just my own lack of knowledge.
14:08 masak nine: no, I was genuinely curious what's currently holding things back. you're most likely right that there is something.
14:09 masak viki: it's a pity you lost the high ground by being snarky with the guy there at the end :(
14:09 RabidGravy in the thing I made for "large investment bank" I had a trait that proxied things from the DB layer into the business layer where appropriate
14:09 masak viki: I know it's all too easy in a technical discussion to let hotbloodedness get the better of you. the conversation was going well until that point.
14:10 RabidGravy Moose being lovely like that (and indeed Perl 6)
14:18 rurban joined #perl6
14:23 RabidGravy right, that's GD::Raw fixed - what's up next :)
14:27 RabidGravy but only 16 pull requests in October that's a bit slack
14:34 viki masak: I don't consider "let me google it for you" going well.
14:35 nine masak: I've thought a bit more about it. The code we have in ResultSet classes is good as it is (it's about how to find results after all or more importantly, how to re-use code for querying).
14:35 viki He didn't have an answer. That's why from the start he was throwing bullshit half-phrases around instead of showing two lines of code.
14:36 nine masak: The code in Result classes (the objects we get from the DB queries) however should not depend in DBIx::Class as that hurts re-use and testing. But I don't know of a way for a query to give me my plain old objects.
14:37 nine And if there were a way, I don't know how to maintain the simplicity of accessing related objects for example.
14:38 nine While there is a settable result_class accessor in DBIx::Class resultsets, it completely replaces the result class, thereby throwing out the kid with the bath water.
14:39 mst trying to move some of that logic from result classes to somewhere it could be re-used by alternative result classes is something I've been thinking about for years
14:40 nine Putting the business logic into roles and having a way to auto-apply those to the result objects would be nice. But even in Perl 6 we lack a way to enforce the user to only use the interface the role provides.
14:40 nine Which will lead people to treat those objects as DBIx::Class::Row objects anyway.
14:41 mst have you considered has-a rather than is-a
14:41 nine True. When there's a way to auto-apply a role, there's surely a way to auto-create an object and set an attribute.
14:42 mst I don't entirely understand the 'auto-apply a role' part
14:42 mst what I was more thinking was that you'd have a factory object
14:42 mst with an inflate_result method that called the row class' inflate_result, and then passed the return of that to new()
14:42 mst and then set $rs->result_class($factory_object)
14:43 nine What I meant by "auto" was just that if the user needs to type code like '@results.map: BusinessLogicFoo.new-from-row($_)' we've lost already
14:44 mst what
14:44 mst I already told you how to not do that
14:44 mst result_class :(
14:44 nine Ah, only read that after finishing typing.
14:44 mst it was auto-apply rokles that confused me, because if you're returning the row object, just consume the role in the row class
14:45 mst but, yeah
14:45 mst sub inflate_result { my ($self, @args) = @_; $self->logic_class->new_from_row($self->dbic_row_class->inflate_result(@args)) }
14:45 nine So replace the result_class, but then manually call the DBIx::Class::Row subclass' constructor and the business logic class' one. Sounds implementable in a generic way.
14:45 mst precisely
14:46 mst I'm about 98% sure it's been done in perl5 before now to get two-layer code
14:48 RabidGravy well if you can get someone at DB to liberate the code I did most that already :)
14:49 mst RabidGravy: of the two layer pattern thingy?
14:50 RabidGravy except the business logic class had a role that did the part about getting the result and the attributes had traits to manage the relationship with the result
14:50 RabidGravy but yeah
14:50 nine And since we started out with web apps, there's the still unsolved issue with where the hell to augment the results with URIs. The endless $c->stash({ foo => map { $_->get_columns, uri_edit => $c->uri_for(...) } @results });
14:51 mst oh, ew, that's not how you do it at all :(
14:51 khw joined #perl6
14:51 mst I mean, it's unsolved in general, I agree, but ugly newbie catalyst code like that is just intentionally hurting yourself
14:52 nine I think by now we have just about every way to do that in our code base... But maybe you have one that I hate less?
14:53 nowan joined #perl6
14:53 mst generally, I'd have a :Chained part that stashes some subs called like foo_edit_uri and etc.
14:53 mst so I only have to write that once
14:53 mst then in the template [% foo_edit_uri(foo) %]
14:54 mst also, get_columns is massive encapsulation violation, use the accessors instead of poking into the object's guts like an animal
14:55 nine Promoting lazyness as a virtue may have uninteded side effects :)
14:55 RabidGravy I'd kinda be tempted for some result-aware uri template thing
14:56 RabidGravy or even object aware
14:56 mst my $uri_for = $c->curry::weak::uri_for;
14:57 mst $c->stash(foo_edit_uri => sub { $uri_for->(...) }, foo_create_uri => sub { $uri_for->(...) }, ...);
14:57 mst got me sufficiently far along that I couldn't find a further generalisation that wasn't more typing to configure than just writing the code
14:58 nine I wonder how well in practice business logic classes and actions correlate. Having a multi uri_for(My::Business::Product, 'edit') { ... }; multi uri_for(My::Business::Basket, 'show') { ... }; ...
14:59 nine I.e. using multi dispatch to promote business logic separation and save typing at the same time.
14:59 mst also depends if you're generating URLs within a REST service or for a server-side web UI
15:00 RabidGravy if you may be doing both it's stck it in the template
15:08 zakharyas joined #perl6
15:09 CIAvash joined #perl6
15:11 RabidGravy sometimes I'm a fan of things where the "actions" are completely normal (but possibly annotated) methods of a basically normal (but possibly annotated) class and can be used as such but become web actions when used in that context
15:13 RabidGravy this works better for API like things than UI type things obvioulsly
15:13 mst well, I mean, I tend towards the idea that if you have noticeable code in your controllers at all, you're doing the wrong thing
15:14 mst catalyst + roles + chained makes it fairly easy to have the would-be-boilerplate parts composed in
15:16 RabidGravy yeah, chained and roles is a massive combo
15:18 mcmillhj joined #perl6
15:19 RabidGravy especially if you have a lot of the same things under different parts of a rest interface
15:22 cdg joined #perl6
15:23 mst RabidGravy: another thing people often miss
15:23 mst if Controller/Foo.pm if you create a MyApp::Controller::Foo::Bar class catalyst'll register that as a controller too
15:23 mst so you can basically metamodel-up a set of nested namespaces in one go
15:25 RabidGravy aye
15:33 firstdayonthejob joined #perl6
15:36 RabidGravy gah, that poxy cargo culted "perl6 -MPanda::Builder -e 'Panda::Builder.build($*CWD)'" is everywhere in the ecosystem
15:37 rindolf joined #perl6
15:42 kaare_ joined #perl6
15:44 nine This is really scary. One can indeed pass a lexically scoped multi to Perl 5 like this: https://gist.github.com/niner/853be7c667b05ef058f30194738863b7
15:45 nine Now this makes me wonder: why is generating URIs a completely separated job from dispatch anyway?
15:46 mst it isn't
15:46 mst well, you're bypassing the dispatch-aware version
15:46 mst also I suspect creating a circular reference on $c
15:46 nine You mean because I don't pass action objects there?
15:46 mst correct.
15:48 mst I added that version along with Chained so that uri_for could ask the dispatcher to reverse engineer the URL for a particular chained endpoint and interleave the values correctly
15:48 mst you're just not currently using that :)
15:48 RabidGravy nine, do I take it that that is a Catalyst thing in Inline::Perl5 with the method attributes turned into traits?
15:49 nine RabidGravy: correct
15:49 RabidGravy that's quite cool
15:49 nine RabidGravy: I used my Catalyst demo project as test bed: https://github.com/niner/XStats/blob/master/lib/XStats/Controller/Root.pm
15:51 RabidGravy and the "CatalystX::Perl6::Component::Perl5Attributes;" does the trait/attribute magic?
15:51 nine mst: btw. if I can commit to overriding GLOBAL::CORE::bless, I should be able to go back to use v6-inline; again and thus lower Inline::Perl5's and Inline::Perl6's perl requirement considerably.
15:51 nine RabidGravy: it's not even that magical: https://github.com/niner/XStats/blob/master/lib/CatalystX/Perl6/Component/Perl5Attributes.pm6
15:52 mst nine: hmm. will objects constructed in XS still DTRT?
15:53 nine have to check that
15:55 nine I think not :/ sv_bless is a very low level thing
15:56 leont Quite
15:57 leont Darn thing doesn't even take a package name but the stash itself (which can lend itself for fun-with-internals)
15:58 nine Unfortunately I don't know of any other general hook for creating objects of a specific class
16:03 RabidGravy right, that's GetOpt::Tiny fixed
16:04 RabidGravy I think now it's time to track down all the failures down to a faulty Test::META test
16:04 mst nine: why are you trying to trap all construction?
16:08 nine mst: so that I can create the corresponding Perl 6 object and run its constructor if necessary.
16:09 nine If it weren't for the part about the constructor, I could even get by with lazily creating the Perl 6 object
16:10 mst nine: corresponding Perl6 object?
16:11 nine package Foo; use Moose; has 'foo' => (is => 'rw'); use v6::inline; has $.bar; method baz() { }
16:11 nine A Perl 5 object with a Perl 6 extension. I need a place to store the attributes defined bye the Perl 6 extension.
16:12 * leont has been thinking about adding a mop to p5 for years, that would make life so much easier…
16:12 leont I don't think steven is going to try again, and TBH I think he was always aiming too high
16:13 mst I thought as of last year he actually liked his current design
16:15 * FROGGS .oO( avoid the angry mop )
16:17 mst nine: I don't see how intercepting bless() helps for that. seems to me that you'd be better off lazily allocating the perl6 bit, and having something like
16:17 mst sub BUILD { my ($self, $args) = @_; BUILDALL_PERL6(__PACKAGE__, $self, $args) }
16:18 nine So just define a convention for when you actually need to run a Perl 6 constructor? Yes, could work.
16:19 nine Current implementation intercepts bless, checks if the result is one of the extended packages and runs the Perl 6 constructor if it is.
16:21 mst how can it even know what arguments to give to the perl6 constructor in that case?
16:22 RabidGravy so I have some "recruitment screening" people asking me to prove what I have been doing for the last year and a half
16:22 RabidGravy do you think I can just point them at my github contributions and say "a shed load of Perl 6" ?
16:23 nine RabidGravy: I'd be fine with that ;)
16:24 RabidGravy they've already hired me (I've been there for a week) so the actual people responsible for the hiring were fine with it
16:24 nine mst: it doesn't. The old version passed along everything, the new version doesn't have access to the arguments. So a Perl 6 constructor is of limited use anyway.
16:26 mst nine: right, so, I think lazy-construct if the constructor doesn't have required args, and an explicit protocol for passing stuff if it does, and then you can have Moo/Moose integration to make it smoother if you want but people still have control, is the least worst approach?
16:26 FROGGS RabidGravy: print of your github profile summary page?
16:26 RabidGravy :)
16:26 FROGGS RabidGravy: so yeah, show them that you are really interested in what you are doing
16:27 mst FROGGS: screenshot embedded in a PPT embedded in a word doc!
16:27 FROGGS enthusiasts are hard to find, they should know :o9
16:27 nine mst: sounds kinda elaborate. But then it's about making the impossible simple, so it's par for the course I guess :)
16:27 mst (bonus points if you get the screenshot via PrtScr+scanner)
16:27 FROGGS mst: ohh, yeah... we have a bunch of ppl that put screenshots in a .docx just to email it... -.-
16:28 mst nine: actually, it isn't. it's a bunch of small things that work together :)
16:28 RabidGravy yeah why do people do that
16:28 RabidGravy most odd
16:28 mst BUILDALL_PERL6 (or whatever name) is the only 'real' thing
16:28 nine FROGGS: if they are not faxing those screenshots, consider yourself happy
16:28 mst then for convenience you build into the perl6 code auto-invoking that on demand if possible
16:28 RabidGravy or screenshots of terminal output
16:28 mst and for convenience you teach the perl5 OO systems to auto-invoke it as part of construction
16:29 mst but the core mechanism is basically your original bless() wrapper, except explicit and without the giant hack
16:29 FROGGS RabidGravy: we also have at least two employees that actually print a screenshot of a webpage I did, then draw lines on the piece of info they dont understand
16:29 FROGGS AND THEN THEY SCAN IT AGAIN IN GREYSCALE JUST TO EMAIL IT ME AGAIN!!!111
16:29 mst (slowing bless() down just because Inline::Perl6 is loaded is not going to be helpful for sneaking -a- perl6 module into a perl5 project)
16:30 FROGGS some ppl just hate trees I guess
16:32 nine mst: that's what I feared most. Hence I haven't really committed myself to that path yet.
16:32 nine Thanks for showing a way out :)
16:34 mst hey, I want this to exist, and you're doing all the hard work of making it happen
16:37 cdg_ joined #perl6
16:40 RabidGravy Hmm the XML library is failing on 'latest' on travis, but not on a rakudo from about two weeks ago
16:40 RabidGravy that's special
16:41 * RabidGravy goes 'latest' to test
16:45 RabidGravy some pesky optimisation I'd guess
16:46 skids joined #perl6
16:56 * TimToady sitting in hotel lobby soaking up free wifi for a bit... :)
17:00 canopus joined #perl6
17:02 Tonik joined #perl6
17:03 RabidGravy Ooh that is a bit special
17:04 mst oh?
17:05 RabidGravy previously "if $val eq $uri && $key.match(/^xmlns(\:||$) <( .* )>/) {  return $/ }"  worked (the $/ was set in the inner block), but now it isn't
17:05 brillenfux joined #perl6
17:05 RabidGravy the fix is just explicit pointy on the block, but hey
17:06 mst I still don't really understand how .match() and $/ and etc. interact
17:06 RabidGravy I'm quite relaxed about the way it is now, after all there is less magic
17:07 mst I've read all of the docs.perl6.org stuff about them but it feels like completely usable reference docs that could really do with a tutorial or at least a conceptual overview
17:08 RabidGravy yeah I suspect the regex stuff could do with a nice tutorial
17:10 viki https://xkcd.com/1171/
17:10 lizmat mst: the scope in which you call .match, is where $/ gets set
17:11 lizmat same for .subst
17:12 mst lizmat: and an inner scope in a block doesn't?
17:12 lizmat hmmm...
17:12 lizmat indeed:
17:12 lizmat m: $/ = 42; { $/ = 666; say $/ }; say $/
17:12 camelia rakudo-moar fc47bb: OUTPUT«666␤666␤»
17:13 lizmat m: $/ = 42; sub { $/ = 666; say $/ }(); say $/
17:13 camelia rakudo-moar fc47bb: OUTPUT«666␤42␤»
17:16 bartolin bisect: my int $a = -10; say $a % 12
17:16 bisectable6 bartolin, Bisecting by output (old=2015.12 new=fc47bbf) because on both starting points the exit code is 0
17:16 bisectable6 bartolin, bisect log: https://gist.github.com/ec7f648235960ddeccbd4e535d9e3094
17:16 bisectable6 bartolin, (2016-06-04) https://github.com/rakudo/rakudo/commit/986891f7ea9d7fa6cbdc316127e9cc8302d621e1
17:17 lizmat I guess there's no slow fix for RT #128318 yet  :-(
17:17 FROGGS_ joined #perl6
17:20 bartolin lizmat: ahh, I tried this because RT #127168 is still open, but seems to be fixed. seems to be the same underlying problem
17:21 bartolin any objections to merging both tickets?
17:21 lizmat not from me  :-)
17:21 bartolin ok, will merge them. thanks :-)
17:22 lizmat thank you for your relentless bug squashing!  :-)
17:22 RabidGravy it was more
17:23 RabidGravy m: my $a = "foobar";   if $a.match(/foo/) { say $/ }
17:23 camelia rakudo-moar fc47bb: OUTPUT«「foo」␤»
17:24 RabidGravy which *doesn't* appear to work on 2016.10-107-gfc47bbf
17:24 viki committable6: fc47bbf my $a = "foobar";   if $a.match(/foo/) { say $/ }
17:24 committable6 viki, ¦«fc47bbf»: 「foo」
17:24 viki works
17:25 RabidGravy Hmm
17:25 lizmat it could well be I borked something in the refactor
17:25 lizmat specifically, I recall using a different nqp:: op for finding the $/ to set
17:25 lizmat perhaps that's the reason
17:26 RabidGravy well the code in XML (as above) wasn't working
17:26 MasterDuke bisectable6: my $a = "foobar";   if $a.match(/foo/) { say $/ }
17:26 bisectable6 MasterDuke, On both starting points (old=2015.12 new=fc47bbf) the exit code is 0 and the output is identical as well
17:26 bisectable6 MasterDuke, Output on both points: 「foo」
17:27 RabidGravy well this is all as maybe but the code I posted above *doesn't*
17:27 RabidGravy and it did before
17:27 viki Does it actually have "say $/"? I thought originally you showed a return
17:27 bartolin lizmat: on a related note: it looks like you put an additional bandaid for RT #128318 into src/core/Date.pm here: https://github.com/rakudo/rakudo/commit/d80c728e25
17:27 MasterDuke committable6: v6c my $a = "foobar";   if $a.match(/foo/) { say $/ }
17:27 committable6 MasterDuke, ¦«2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,2016.09,2016.10,HEAD»: 「foo」
17:28 viki committable6: fc47bbf sub foo { my $a = "foobar";   if $a.match(/foo/) { return $/ } }; dd foo.caps
17:28 bartolin lizmat: it looks like that one could be removed (got a clean spectest on MoarVM without it)
17:28 committable6 viki, ¦«fc47bbf»: ()
17:28 viki committable6: fc47bbf sub foo { my $a = "foobar";   if $a.match(/foo/) { return $/ } }; dd foo.Str
17:28 committable6 viki, ¦«fc47bbf»: "foo"
17:28 viki ¯\_(ツ)_/¯
17:29 lizmat bartolin: but doesn't that break on the JVM then ?
17:32 lizmat RabidGravy viki: ok, seems I'm using nqp::getlexdyn in the new code, whereas the old code used nqp::getlexcaller
17:32 RabidGravy ah, okay
17:32 lizmat RabidGravy viki: going to change that and run a spectest: if clean, I'll commit
17:32 RabidGravy no biggy, I've fixed XML now
17:33 lizmat RabidGravy: could you add a test for it ?
17:33 RabidGravy I'm actually confused as to what it is that needs testing
17:33 bartolin lizmat: hmm, a quick test with the examples from RT #127161 looked good on JVM. I'll run a spectest and make a PR to revert d80c728e25 if everything looks good
17:34 lizmat bartolin++
17:34 RabidGravy I've changed this code to return the .Str of the match and all is fine
17:38 lizmat RabidGravy: but still, could you provide a piece of code that shows the difference in behaviour ?
17:42 djbkd joined #perl6
17:44 RabidGravy right, I've got it now
17:46 rurban joined #perl6
17:46 RabidGravy m: sub foo { for <foobar bazbar> -> $a { if $a.match(/foo/) { return $/; } } }; say foo();
17:46 camelia rakudo-moar fc47bb: OUTPUT«Nil␤»
17:47 RabidGravy that works different in 2016.09-53-gbb52f81 (which is the only other one I have to test with)
17:48 lizmat RabidGravy: thanks!
17:48 RabidGravy m: sub foo { for <foobar bazbar> -> $a { if $a.match(/foo/) -> $p { return $/; } } }; say foo();
17:48 camelia rakudo-moar fc47bb: OUTPUT«Nil␤»
17:48 RabidGravy m: sub foo { for <foobar bazbar> -> $a { if $a.match(/foo/) -> $p { return $p; } } }; say foo();
17:48 camelia rakudo-moar fc47bb: OUTPUT«「foo」␤»
17:48 RabidGravy is how I worked round it
17:49 lizmat changing the nqp op doesn't fix it
17:50 domidumont joined #perl6
17:51 lizmat hmmm,...
17:51 RabidGravy is it possible the scope of the for block is actually the one afflicting it?
17:52 lizmat m: if "foo".match(/foo/) { say $/ }
17:52 camelia rakudo-moar fc47bb: OUTPUT«「foo」␤»
17:52 RabidGravy yeah, it doesn't kick in until the for is introduced
17:54 RabidGravy FROGGS++ # making with the merging ;-)
17:54 lizmat m: for "foo" { if .match(/foo/) -> \m { say m } }  # works
17:54 camelia rakudo-moar fc47bb: OUTPUT«「foo」␤»
17:54 lizmat m: for "foo" { if .match(/foo/) { say $/ } }  # works
17:54 camelia rakudo-moar fc47bb: OUTPUT«Nil␤»
17:54 lizmat no, doesn't work
17:55 domidumont joined #perl6
17:57 lizmat well, it doesn't seem optimize related
17:57 lizmat star: for "foo" { if .match(/foo/) { say $/ } }
17:57 camelia star-m 2016.04: OUTPUT«「foo」␤»
17:59 lizmat and it did break after the release...
18:01 RabidGravy well, the fix I put in to XML works fine with older versions too, so I'm quite relaxed about it
18:01 lizmat well, but I'm worried about further, subtle ecosystem fallout  :-(
18:02 mst and it just seems like a weird and counterproductive behaviour change
18:02 mst feels like there should be a 6.c test for whatever's correct
18:03 dwarring joined #perl6
18:03 lizmat mst: agree
18:03 lizmat it is definitely not an intended change
18:03 bartolin bisect: sub foo { loop (my $i = 0; $i < 5; ++$i) { say $i; } }; foo  # RT #127238
18:04 bisectable6 bartolin, Bisecting by exit code (old=2015.12 new=fc47bbf). Old exit code: 1
18:04 bisectable6 bartolin, bisect log: https://gist.github.com/ac94a5e1e9adc0c83e5e84d83c7f7156
18:04 bisectable6 bartolin, (2015-12-30) https://github.com/rakudo/rakudo/commit/37e742f0bb6f36f1a9d9a5f947c5c0de15d236c2
18:04 CIAvash joined #perl6
18:05 lizmat well, it is defintely b7201a8f22338a906f2d8027a that broke it  :-(
18:08 RabidGravy I'm just testing all of my modules with 'latest'
18:09 lizmat arggh, it works in my debug /augment class Str file  :-(
18:09 RabidGravy seeing how it is actually provoked I would say that it probably does want to be fixed thogh
18:09 lizmat RabidGravy: yeah. no argument there
18:11 lizmat argh, I hate it when identical code works differently when inside the setting
18:11 rurban joined #perl6
18:11 RabidGravy gah, Audio::Liquidsoap has gone broken for some other reason - yet again
18:13 lizmat :-(
18:13 lizmat please make sure this breakage creates a test  :-)
18:14 RabidGravy It's usually something to do with my rebuilding 'liquidsoap' in such a way that it breaks the tests
18:14 BenGoldberg joined #perl6
18:15 RabidGravy and you don't want to be building liquidsoap for fun unless you love lots and lots of funny unexpected dependencies
18:16 lizmat m: for 42 { say "foo".match(/foo/); say $/ }
18:16 camelia rakudo-moar fc47bb: OUTPUT«「foo」␤Nil␤»
18:16 lizmat ^^^ weirder still
18:17 leego joined #perl6
18:18 FROGGS_ m: for 42 { my $/; say "foo".match(/foo/); say $/ }
18:18 camelia rakudo-moar fc47bb: OUTPUT«「foo」␤「foo」␤»
18:18 FROGGS_ m: my $/; for 42 { say "foo".match(/foo/); say $/ }
18:18 camelia rakudo-moar fc47bb: OUTPUT«Potential difficulties:␤    Redeclaration of symbol '$/'␤    at <tmp>:1␤    ------> 3my $/7⏏5; for 42 { say "foo".match(/foo/); say $␤「foo」␤(Any)␤»
18:19 FROGGS_ m: $/ = 111; for 42 { say "foo".match(/foo/); say $/ }
18:19 camelia rakudo-moar fc47bb: OUTPUT«「foo」␤111␤»
18:20 lizmat hmmm... maybe I broke something during my map optimizations :-(
18:22 lizmat star: for 42 { say "foo".madch(/foo/); say $/ }
18:22 camelia star-m 2016.04: OUTPUT«Method 'madch' not found for invocant of class 'Str'␤  in block <unit> at <tmp> line 1␤␤»
18:22 lizmat star: for 42 { say "foo".match(/foo/); say $/ }
18:22 RabidGravy but think of all the memory it's saving ;-)
18:22 camelia star-m 2016.04: OUTPUT«「foo」␤「foo」␤»
18:23 lizmat star: say $*VM
18:23 camelia star-m 2016.04: OUTPUT«moar (2016.04)␤»
18:23 lizmat ah, ok, so not the latest star
18:23 notostraca joined #perl6
18:24 lizmat the weird thing is that I have the refactored match code living as an augment on Str (called madch), and that code runs ok  :-(
18:25 lizmat m: loop { say "foo".match(/foo/); die $/ }   # seems to be related to for only
18:25 camelia rakudo-moar fc47bb: OUTPUT«「foo」␤foo␤  in block <unit> at <tmp> line 1␤␤»
18:29 lizmat star: for 42 { say MY::.keys }
18:29 camelia star-m 2016.04: OUTPUT«($_)␤»
18:29 kjs_ joined #perl6
18:31 lizmat star: use nqp; say nqp::where($/); for 42 { say "foo".match(/foo/); say nqp::where($/); say $/ }
18:31 camelia star-m 2016.04: OUTPUT«24626848␤「foo」␤140458762181888␤「foo」␤»
18:31 lizmat m: use nqp; say nqp::where($/); for 42 { say "foo".match(/foo/); say nqp::where($/); say $/ }
18:31 camelia rakudo-moar fc47bb: OUTPUT«33348352␤「foo」␤33348352␤Nil␤»
18:32 lizmat so, before the scope had its own $/, and now it has the outer one
18:32 lizmat I assume the former is correct, no?
18:32 lizmat hmmm... maybe this should be taken to #perl6-dev
18:35 seatek joined #perl6
18:39 labster joined #perl6
18:43 RabidGravy so just tested 'latest' against all my modules, no other outfall
18:52 lizmat *phew*  :-)
19:06 kurahaupo__ joined #perl6
19:17 _KaLiF joined #perl6
19:19 rindolf Can anybody give me some guidance about how to optimise sprintf() in Rakudo?
19:19 yoleaux 19 Oct 2016 01:37Z <iBakeCake> rindolf: the code's at https://github.com/rakudo/rakudo/blob/eb6907e/src/core/Cool.pm#L319 You want to profile stuff with --profile argument to perl6; perl6.party's articles with "Hacking" in their title may or may not prove helpful vis-a-vis getting and building source
19:19 yoleaux 19 Oct 2016 01:38Z <iBakeCake> rindolf: the stuff that starts with nqp:: is nqp ops and generally would be in https://github.com/perl6/nqp (see docs/)
19:19 stmuk_ https://datafloq.com/read/perl-6-is-remarkably-robust-at-handling-big-data/2409
19:19 rindolf oh.
19:19 stmuk_ bit of an odd article but at least positive
19:20 mst "It's virtually unrecognizable from previous versions of the 15-year-old programming language."
19:20 mst fail
19:20 mst oh dear lord it's the http://p3rl.org/Net::FullAuto developer
19:21 rindolf .tell iBakeCake thanks for the info about rakudo and sprintf
19:21 yoleaux rindolf: I'll pass your message to iBakeCake.
19:21 kurahaupo__ joined #perl6
19:27 lizmat mst: Article Author: Annie Qureshi
19:27 lizmat that's not Brian Kelly, afaik
19:27 FROGGS_ yes, only the first and second quote is
19:28 mst yeah, sorry, it has a similar level of factual error to stuff written by him so my brain pattern matched
19:29 FROGGS_ aye
19:31 lizmat fwiw, I've always felt that Hadoop is overrated, and bad for the environment in general
19:31 lizmat it's not fast enough?  Just throw more metal at it!
19:47 mcmillhj joined #perl6
19:48 iBakeCake .
19:48 yoleaux 19:21Z <rindolf> iBakeCake: thanks for the info about rakudo and sprintf
19:49 rindolf viki: thanks again.
19:58 viki any time
20:01 mememan joined #perl6
20:01 mememan Does anyone have any idea about how to check for sdlevents with SDL2::Raw and check if the user used the scroll wheel
20:02 FROGGS_ mememan: you usually poll for events, and inspect the event object you get
20:02 mememan I've gotten that far but I don't know how to check if the user scrolled
20:03 mememan I need to know the amount scrolled too
20:03 cdg joined #perl6
20:03 mememan I've noticed in someone else's code that they check the event.type against different integers representing different events
20:03 mememan any idea about which number represents scroll wheel movement?
20:05 samcv is there a way i can define my own alias for a datatype? i need to alias curl_off_t to uint64
20:05 samcv obvieously curl_off_t is uint64 doesn't work :P
20:06 samcv but the size of curl_off_t changes depending on a 32 or 64 bit machine so i need to be able to define a datatype myself
20:07 FROGGS_ mememan: https://github.com/timo/SDL2_raw-p6/blob/master/lib/SDL2/Raw.pm#L287
20:08 FROGGS_ mememan: type should be equal to MOUSEWHEEL
20:09 FROGGS_ m: constant curl_off_t = uint64;
20:09 camelia rakudo-moar fc47bb: ( no output )
20:09 FROGGS_ samcv: ^^
20:09 mememan ah
20:09 FROGGS_ m: constant curl_off_t = uint64; my curl_off_t $foo = 42;
20:09 camelia rakudo-moar fc47bb: ( no output )
20:09 mememan thanks very much
20:09 FROGGS_ :o)
20:09 samcv nice :)))
20:10 kjs_ joined #perl6
20:10 AlexDaniel well, yeah… just don't rely on it in any way
20:11 FROGGS_ it is good enough to be used in nativecall signatures
20:12 zakharyas joined #perl6
20:13 mememan how do I get the direction/amount FROGGS_
20:13 samcv ahhh FROGGS_ CStruct representation only handles attributes of type:
20:13 samcv (u)int8, (u)int16, (u)int32, (u)int64, (u)long, (u)longlong, num16, num32, (s)size_t, bool, Str
20:13 FROGGS_ ewww
20:13 samcv is there a way around this?
20:14 FROGGS_ mememan: https://github.com/timo/SDL2_raw-p6/blob/master/lib/SDL2/Raw.pm#L347-L356
20:14 FROGGS_ mememan: looks like the Event struct ist not correctly implemented... maybe look at the SDL2 C lib, how the struct has to look like?
20:15 FROGGS_ mememan: then you'd be able to cast it to a correct struct implementation, until SDL2::Raw gets fixed
20:15 mememan oh
20:16 FROGGS_ m: use NativeCall; constant flubber = uint64; class Foo is repr<CStruct> { has flubber $.bar }
20:16 camelia rakudo-moar c9730a: ( no output )
20:16 FROGGS_ samcv: why don't I get an error?
20:18 FROGGS_ mememan: https://hg.libsdl.org/SDL/file/46cfe31e501a/include/SDL_events.h#l174
20:18 FROGGS_ mememan: try to get your hands at data1 and data2
20:19 FROGGS_ mememan: ohh, here: https://wiki.libsdl.org/SDL_MouseWheelEvent?highlight=%28%5CbCategoryStruct%5Cb%29%7C%28CategoryEvents%29
20:22 samcv hmm i got it working. it was somewhere else in the struct my bad
20:23 FROGGS_ phew :o)
20:23 samcv yeah it errored on a different line than the problem was on
20:36 bjz joined #perl6
20:36 rindolf Hi all! How do I create a static constant variable in NQP? I cannot find anything in this google search or the DDG search - https://encrypted.google.com/search?hl=en&amp;q=%2Bnqp%20static%20constant
20:37 moritz constant variable?
20:37 moritz nqp: constant $x := 42;
20:37 camelia nqp-moarvm: OUTPUT«Confused at line 2, near "constant $"␤   at gen/moar/stage2/NQPHLL.nqp:621  (/home/camelia/rakudo-m-inst-2/share/nqp/lib/NQPHLL.moarvm:panic)␤ from gen/moar/stage2/NQP.nqp:908  (/home/camelia/rakudo-m-inst-2/share/nqp/lib/nqp.moarvm:comp_unit)␤ from gen/moar…»
20:37 moritz not supported, I guess
20:40 TakinOver joined #perl6
20:40 lizmat rindolf: there is no assignment in nqp, everything is a constant  :-)
20:40 rindolf moritz: ah. :-(
20:41 lizmat you can only bind
20:41 rindolf lizmat: hmmm... I see mutability there.
20:41 lizmat where ?
20:41 rindolf like $exp := -$exp;
20:41 lizmat that's rebinding
20:41 rindolf lizmat: ah.
20:42 lizmat you still cannot assign to it, because there *is* no assignment in nqp
20:42 rindolf lizmat: anyway, how can I define a global or state/static variable.
20:42 lizmat nqp:: my $a = 42
20:42 zakharyas1 joined #perl6
20:42 rindolf s/\.$/?/
20:42 FROGGS_ nqp-m: my $a = 42
20:42 camelia nqp-moarvm: OUTPUT«Assignment ("=") not supported in NQP, use ":=" instead at line 2, near " 42"␤   at gen/moar/stage2/NQPHLL.nqp:621  (/home/camelia/rakudo-m-inst-2/share/nqp/lib/NQPHLL.moarvm:panic)␤ from <unknown>:1  (/home/camelia/rakudo-m-inst-2/share/nqp/lib/nqp.moarvm:inf…»
20:43 lizmat FROGGS_++
20:43 lizmat :-)
20:43 FROGGS_ rindolf: use a sub?
20:43 rindolf FROGGS_: what?
20:43 rindolf FROGGS_: it's already in a subroutine.
20:43 FROGGS_ rindolf: like in Perl 5... use a subroutine to fake constants...
20:45 mst sub a { 42 }
20:46 adeohluwa joined #perl6
20:46 rindolf FROGGS_: mst : thanks! Will it also evaluate functions and expressions?
20:47 FROGGS_ rindolf: yes, it will
20:48 rindolf FROGGS_: ok, thanks!
20:48 FROGGS_ rindolf: though, perhaps you might want to force evaluation.... like: my $THING := <expression here>; sub THING { $THING };
20:49 FROGGS_ (so that the expression will only be evaluated once)
20:49 rindolf FROGGS_: I want it to be evaluated only once.
20:49 FROGGS_ and you have to use the "constant" as THING() of course, because nqp has no listops
20:50 * RabidGravy finally gives in with trying to do anything clever with library versions with GD::Raw and just sticks a 'trusty' on travis
20:54 rindolf FROGGS_: is it preferable over using «$THING» directly?
21:00 FROGGS_ rindolf: no, I'd use $THING and just avoid rebinding :o)
21:01 rindolf FROGGS_: ok, thanks!
21:01 FROGGS_ rindolf: what are you up to, ooc?
21:02 bjz_ joined #perl6
21:02 rindolf FROGGS_: trying to optimise sprintf
21:03 FROGGS_ ahh, I see
21:13 FROGGS_ mememan: have you seen that already? https://github.com/timo/SDL2_raw-p6/blob/master/lib/SDL2/Raw.pm#L419
21:15 kjs_ joined #perl6
21:19 wamba joined #perl6
21:19 samcv hmm so i have nativecall working fine. but i get the output of the call printed to terminal (the function only 'returns' an int but is printing out all the data it gets)
21:19 samcv how do i capture this data? i'm not sure "where" to access it
21:19 geekosaur if it's going to the terminal then the function is writing to its standard output and/or standard error
21:20 samcv ah ok
21:20 RabidGravy which is kinda special
21:20 FROGGS_ samcv: what function are you calling?
21:20 samcv curl_easy_perform
21:21 samcv that makes sense it's writing to its stdout. but i'm unsure how to access it
21:22 geekosaur look at curl_easy_setopt
21:22 mohae_ joined #perl6
21:22 samcv well how do i access a programs stdout? i mean i've done file handles before and qx
21:23 samcv i would like to open a filehandle for its stdout but i'm not sure how to do that
21:23 geekosaur this is a function, not a program. perl 6 does not currently have fork, so you'd need to run another copy in a subprocess; I don't know offhand if rakudo exposes a way to redirect filehandles in a way that libuv understands
21:24 geekosaur you can't, it's a function, it's *your* stdout
21:24 geekosaur it's not a separate process
21:24 FROGGS_ samcv: I guess you have to register a callback: https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
21:24 samcv ahhhhh ok
21:24 geekosaur it's not even a separate thread, not that that would help because handles are process level not thread level
21:24 samcv ok that helps greatly geekosaur
21:24 samcv in me understanding what's going on :)
21:24 geekosaur yes, I pointed at curl_easy_setopt already
21:24 samcv i meant about it being in my process
21:25 samcv and that's why it's going to my stdout
21:25 geekosaur and you can't back up and read your own stdout
21:25 samcv yeah
21:25 geekosaur it's write only (except in one special case where the output is a terminal so can't be rewound anyway)
21:25 viki m: use NativeCall; sub fork is native {}; fork; say "a spoon, a spork, a..."
21:25 camelia rakudo-moar c9730a: OUTPUT«a spoon, a spork, a...␤a spoon, a spork, a...␤»
21:26 FROGGS_ if you are interested in the "verbose" output, look at that: https://curl.haxx.se/libcurl/c/CURLOPT_VERBOSE.html
21:26 viki m: use NativeCall; sub fork is native {}; fork; say $*PID
21:26 camelia rakudo-moar c9730a: OUTPUT«10216␤10217␤»
21:28 Hotkeys Why is it that there is not product function/method but there is one for sum?
21:28 Hotkeys I know you can just [*] but still
21:28 samcv ok so i fork it and then i get a PID. how to open a filehandle on a PID?
21:28 geekosaur you use the pipe syscall first
21:28 samcv or is that not possible/hard and i should use curlopt_writefunction
21:28 geekosaur pids don't have filehandles
21:29 viki Hotkeys: more common
21:29 geekosaur ...if you have to do this using nativecall to get at the posix pipe/fork/etc. then you will go insane fairly quickly :/
21:29 samcv :( thanks for the advice geekosaur
21:30 geekosaur meanwhile I don't understand why a curl "easy" interface doesn't have a "just write it to a file dammit"
21:30 geekosaur but requires you to register a data callback
21:32 RabidGravy samcv, for reference I think there is at least one binding to libcurl in the ecosystem already, you may want to check that out
21:32 samcv yeah maybe i will see how they do it
21:32 geekosaur I think if curl doesn't provide this already (and it didn't look to me like it does) then your easiest option is to use run to run a subsidiary perl6 that makes the curl calls
21:32 geekosaur and use :out with that
21:33 samcv heh :) that is one way to do it
21:33 viki curl as in the program? HTTP::Tinyish is a wrapper that shells out to it
21:33 samcv not the program as in the library
21:33 viki ah
21:33 geekosaur libcurl, yeh
21:33 samcv is there a way to launch a perl 6 script without incurring launching rakudo twice? or is that not possible.
21:33 samcv regarding startup time
21:34 RabidGravy no
21:34 samcv though i could make it long running
21:34 mst I believe the answer currently is "not really"
21:34 samcv ok that's what i thought
21:34 RabidGravy because it is a second process
21:35 mst that system probably needs replacing at some point, but I don't have a coherent idea of what a better replacement would look like
21:37 RabidGravy I've got tests that fire up second perl6 processes for "reasons"
21:38 samcv yeah perl6-net-curl uses a buffer
21:39 rindolf with my changes I am getting these test failures  - http://paste.debian.net/890995/
21:43 leego joined #perl6
21:48 rindolf ok, I am getting these exact ones without my changes as well.
21:55 seatek joined #perl6
21:57 MasterDuke but are you getting the exact same failures quicker with your changes?
21:59 leego joined #perl6
22:02 bjz joined #perl6
22:03 seatek joined #perl6
22:11 kurahaupo__ joined #perl6
22:11 kurahaupo__ joined #perl6
22:12 kurahaupo__ joined #perl6
22:14 rurban joined #perl6
22:15 rindolf MasterDuke: heh.
22:15 rindolf https://github.com/shlomif/nqp/tree/optimize-sprintf - here are my changes - they aren't much but it's start - now I need to benchmark them.
22:17 MasterDuke nice, making things faster is always appreciated
22:18 leego joined #perl6
22:20 rindolf MasterDuke: thanks!
22:20 leego joined #perl6
22:20 kaare_ joined #perl6
22:25 paulmr joined #perl6
22:29 nadim_ joined #perl6
22:36 samcv hmm i'm getting this error: write bytes requires an object with REPR MVMOSHandle
22:36 samcv calling write on a filehandle
22:36 samcv $filehandle.write($buf);
22:38 samcv fh created with $fh = IO::Handle.new
22:39 samcv this example shows same error: my $buf = Buf.new; my $fh = IO::Handle.new; $fh.write($buf); but in my code there's actually something in the buffer
22:39 ugexe did you open your handle or are you trying to write to a closed handle?
22:40 leego joined #perl6
22:42 samcv hmm yeah i think that's the issue.
22:43 samcv hmm is there a way to have a 'virtual' file handle, that doesn't get writen to any actual file?
22:44 samcv or do i want some other object
22:44 ugexe why not just use the buf then
22:44 samcv well i want to read from it while it's downloading the page
22:45 ugexe you cant read from a handle created in another thread
22:46 samcv yeah. what i want to do is read from a buffer but not wait for it to return first
22:46 ugexe i know
22:47 ugexe you need some form of IPC
22:48 ugexe maybe tell curl to write to a file and have a separate thread read that file as its being written to
22:49 ugexe otherwise you have to put your actions into the parsing logic: i.e. find end of http header then stop receiving data and decide to continue or not based on some values
22:50 ugexe io::socket::async might be able to but im assuming you'd need SSL so thats no good
22:51 Actualeyes joined #perl6
22:52 samcv curl will decode the ssl though
22:52 samcv i will look into io::socket::async
22:53 ugexe you'd want to look at Proc::Async then
23:05 llfourn joined #perl6
23:10 rurban joined #perl6
23:34 perturbation joined #perl6

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

Perl 6 | Reference Documentation | Rakudo