»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
seatek FROGGS: Thank you for linking that video by PM - just finished watching it. 00:02
timotimo i removed a duplicate ticket on perl6/doc, so i'm +1/-1 00:10
AlexDaniel timotimo: yeah, well… yeah… I have a problem with this ratio 00:21
in fact, I'm surprised nobody is beating me with a stick saying that I should get some stuff done 00:22
… right now I am only turning my complaints into tickets, but I should be turning my complaints into code, I guess 00:23
timotimo don't worry about it 00:41
viki beats AlexDaniel with a stick. 00:58
Write some code, dammit! 00:59
AlexDaniel ouch!
SmokeMachine____ viki: thanks! 02:02
viki ¯\_(ツ)_/¯ 02:14
SmokeMachine____ Is there any way to from some code compile another file of code and get its $=pod? 03:01
SmokeMachine____ viki: (I was talking about the link that you fixed... the rakudo for mac download link) 03:06
viki ah 03:40
viki Adding to earlier talks about importing specific functions from a module... Neat idea worth stealing: doc.rust-lang.org/book/crates-and-...ex-imports 04:57
module Foo { sub some_awful_snake_case {... } }; import Foo (&awful_snake_case as &awesome-kebob-case); or whatever :) 04:58
viki s/&awful/&some_/; 05:01
bah...
you know what I meant :D
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␤»
viki close enough (•_•) ( •_•)>⌐■-■ (⌐■_■)
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
next to try and do something useful
RabidGravy harr! 09:27
moritz++ # I was just going to suggest that :)
moritz suggest what? giving you a commit bit? 09:29
moritz a bit context deprived
RabidGravy yes 09:30
I am determined to have all the modules that are thus configured to be passing in Travis :) 09:32
RabidGravy I am right in recalling MONKEY-SEE-NO-EVAL is lexical in its effect? 10:01
lizmat RabidGravy: should be 10:03
m: { use MONKEY-SEE-NO-EVAL }; EVAL "42"
camelia ( no output )
lizmat hmmmm...
lizmat m: EVAL "42" 10:03
camelia ( no output )
lizmat m: say EVAL "42" 10:04
camelia rakudo-moar db61aa: OUTPUT«42␤»
RabidGravy it doesn't do anything when it's just a literal
lizmat ah
m: { use MONKEY-SEE-NO-EVAL }; EVAL "my $a = 42"
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"␤»
RabidGravy my $f = 42; say EVAL $f;
m: my $f = 42; say EVAL $f;
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; …»
lizmat m: { use MONKEY-SEE-NO-EVAL }; EVAL 'my $a = 42'
camelia ( no output )
lizmat ah, ok
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…»
lizmat m: { use MONKEY-SEE-NO-EVAL; my $f = 42; EVAL $f }
camelia ( no output )
lizmat so yes, lexical
RabidGravy cool, I proceeded on that assumption :) 10:08
samcv anybody know if i can asynchronously run nativecall functions? 10:43
run a nativecall function processing the data but can terminate before it returns depending on the output of it
should work with promises? 10:44
nine Does an introduction into web programming in Perl 6 exist? Any pointer at what to use? 10:54
lizmat perhaps tbrowder has an idea ? 10:55
dalek osystem: 1813d2f | (Pawel Pabian)++ | META.list:
Rename META.info to META6.json to be more compatible with S22 spec.
10:56
RabidGravy samcv, well you can definitely run them asynchronously, but the terminating behaviour is dependent on the function itself 11:23
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:24
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
but if you want the module to deal with the templating and everything else then maybe something else
Bailador is coming on and I fixed Hiker the other dayd 11:27
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:30
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:31
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
samcv, ^ rather
nine, I think it can be summarised as "the fundamentals are getting there, but there isn't a high level of abstraction yet" :) 11:33
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:34
RabidGravy nine, only example in the wild that I have is Lumberjack::Application 11:43
which uses Crust/Template6/Websockets ....
RabidGravy also Audio::StreamThing which isn't a traditional web application however 11:51
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"
not a quote but that was the gist ;) 12:02
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:10
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:14
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:27
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:30
nine OTOH Mojolicous and Catalyst were both started by sri 12:38
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
RabidGravy I think there needs to be a "Perl 6 Web Framework Hackathon" in a place with loads of booze 12:48
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:15
nine Like you wouldn't do the same as Catalyst because in Perl 6 you have real, introspectable method signatures 13:19
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:20
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␤␤»
BenGoldberg m: use Test;
camelia ( no output )
BenGoldberg m: say do use Test; 13:26
camelia rakudo-moar fc47bb: OUTPUT«Nil␤»
RabidGravy nine, I quite liked how DrForr was going with Prancer using multi-dispatch to find the routes 13:27
RabidGravy there's a sweet spot around multi-dispatch, traits and introspection - I'll get there at some point 13:34
RabidGravy maybe I'll do a provocative talk on this at the LPW to chivvy along some discussion 13:38
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: twitter.com/acruiz/status/792726277912395776 13:58
I wouldn't be too surprised if there's a shorter version, but... just show it to me dude :P
nine RabidGravy: though I wonder if that's where a web programmer's actual problems are.
viki Probably not :) routes are like 0.0005% of all of my apps code more often than not :) 13:59
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
And *::Utils packages
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:02
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" ;-)
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:04
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.
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:06
nine masak: maybe it's just my own lack of knowledge. 14:07
masak nine: no, I was genuinely curious what's currently holding things back. you're most likely right that there is something. 14:08
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
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.
RabidGravy Moose being lovely like that (and indeed Perl 6) 14:10
RabidGravy right, that's GD::Raw fixed - what's up next :) 14:23
RabidGravy but only 16 pull requests in October that's a bit slack 14:27
viki masak: I don't consider "let me google it for you" going well. 14:34
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.
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:36
And if there were a way, I don't know how to maintain the simplicity of accessing related objects for example. 14:37
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:38
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:39
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
Which will lead people to treat those objects as DBIx::Class::Row objects anyway.
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.
mst I don't entirely understand the 'auto-apply a role' part 14:42
what I was more thinking was that you'd have a factory object
with an inflate_result method that called the row class' inflate_result, and then passed the return of that to new()
and then set $rs->result_class($factory_object)
nine What I meant by "auto" was just that if the user needs to type code like [email@hidden.address] BusinessLogicFoo.new-from-row($_)' we've lost already 14:43
mst what 14:44
I already told you how to not do that
result_class :(
nine Ah, only read that after finishing typing.
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
but, yeah
sub inflate_result { my ($self, @args) = @_; $self->logic_class->new_from_row($self->dbic_row_class->inflate_result(@args)) }
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.
mst precisely
I'm about 98% sure it's been done in perl5 before now to get two-layer code 14:46
RabidGravy well if you can get someone at DB to liberate the code I did most that already :) 14:48
mst RabidGravy: of the two layer pattern thingy? 14:49
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
but yeah
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 });
mst oh, ew, that's not how you do it at all :( 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:51
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:52
mst generally, I'd have a :Chained part that stashes some subs called like foo_edit_uri and etc. 14:53
so I only have to write that once
then in the template [% foo_edit_uri(foo) %]
also, get_columns is massive encapsulation violation, use the accessors instead of poking into the object's guts like an animal 14:54
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
or even object aware 14:56
mst my $uri_for = $c->curry::weak::uri_for;
$c->stash(foo_edit_uri => sub { $uri_for->(...) }, foo_create_uri => sub { $uri_for->(...) }, ...); 14:57
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
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:58
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
RabidGravy if you may be doing both it's stck it in the template 15:00
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:11
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
catalyst + roles + chained makes it fairly easy to have the would-be-boilerplate parts composed in
RabidGravy yeah, chained and roles is a massive combo 15:16
RabidGravy especially if you have a lot of the same things under different parts of a rest interface 15:19
mst RabidGravy: another thing people often miss 15:23
if Controller/Foo.pm if you create a MyApp::Controller::Foo::Bar class catalyst'll register that as a controller too
so you can basically metamodel-up a set of nested namespaces in one go
RabidGravy aye 15:25
RabidGravy gah, that poxy cargo culted "perl6 -MPanda::Builder -e 'Panda::Builder.build($*CWD)'" is everywhere in the ecosystem 15:36
nine This is really scary. One can indeed pass a lexically scoped multi to Perl 5 like this: gist.github.com/niner/853be7c667b0...94738863b7 15:44
Now this makes me wonder: why is generating URIs a completely separated job from dispatch anyway? 15:45
mst it isn't 15:46
well, you're bypassing the dispatch-aware version
also I suspect creating a circular reference on $c
nine You mean because I don't pass action objects there?
mst correct.
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
you're just not currently using that :)
RabidGravy nine, do I take it that that is a Catalyst thing in Inline::Perl5 with the method attributes turned into traits?
nine RabidGravy: correct 15:49
RabidGravy that's quite cool
nine RabidGravy: I used my Catalyst demo project as test bed: github.com/niner/XStats/blob/maste...er/Root.pm
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.
RabidGravy: it's not even that magical: github.com/niner/XStats/blob/maste...ibutes.pm6
mst nine: hmm. will objects constructed in XS still DTRT? 15:52
nine have to check that 15:53
I think not :/ sv_bless is a very low level thing 15:55
leont Quite 15:56
Darn thing doesn't even take a package name but the stash itself (which can lend itself for fun-with-internals) 15:57
nine Unfortunately I don't know of any other general hook for creating objects of a specific class 15:58
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?
nine mst: so that I can create the corresponding Perl 6 object and run its constructor if necessary. 16:08
If it weren't for the part about the constructor, I could even get by with lazily creating the Perl 6 object 16:09
mst nine: corresponding Perl6 object? 16:10
nine package Foo; use Moose; has 'foo' => (is => 'rw'); use v6::inline; has $.bar; method baz() { } 16:11
A Perl 5 object with a Perl 6 extension. I need a place to store the attributes defined bye the Perl 6 extension.
leont has been thinking about adding a mop to p5 for years, that would make life so much easier… 16:12
I don't think steven is going to try again, and TBH I think he was always aiming too high
mst I thought as of last year he actually liked his current design 16:13
FROGGS .oO( avoid the angry mop ) 16:15
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
sub BUILD { my ($self, $args) = @_; BUILDALL_PERL6(__PACKAGE__, $self, $args) }
nine So just define a convention for when you actually need to run a Perl 6 constructor? Yes, could work. 16:18
Current implementation intercepts bless, checks if the result is one of the extended packages and runs the Perl 6 constructor if it is. 16:19
mst how can it even know what arguments to give to the perl6 constructor in that case? 16:21
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
do you think I can just point them at my github contributions and say "a shed load of Perl 6" ?
nine RabidGravy: I'd be fine with that ;) 16:23
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.
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?
RabidGravy :)
FROGGS RabidGravy: so yeah, show them that you are really interested in what you are doing
mst FROGGS: screenshot embedded in a PPT embedded in a word doc! 16:27
FROGGS enthusiasts are hard to find, they should know :o9
nine mst: sounds kinda elaborate. But then it's about making the impossible simple, so it's par for the course I guess :)
mst (bonus points if you get the screenshot via PrtScr+scanner)
FROGGS mst: ohh, yeah... we have a bunch of ppl that put screenshots in a .docx just to email it... -.-
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
most odd
mst BUILDALL_PERL6 (or whatever name) is the only 'real' thing
nine FROGGS: if they are not faxing those screenshots, consider yourself happy
mst then for convenience you build into the perl6 code auto-invoking that on demand if possible
RabidGravy or screenshots of terminal output
mst and for convenience you teach the perl5 OO systems to auto-invoke it as part of construction
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
AND THEN THEY SCAN IT AGAIN IN GREYSCALE JUST TO EMAIL IT ME AGAIN!!!111
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)
FROGGS some ppl just hate trees I guess 16:30
nine mst: that's what I feared most. Hence I haven't really committed myself to that path yet. 16:32
Thanks for showing a way out :)
mst hey, I want this to exist, and you're doing all the hard work of making it happen 16:34
RabidGravy Hmm the XML library is failing on 'latest' on travis, but not on a rakudo from about two weeks ago 16:40
that's special
RabidGravy goes 'latest' to test 16:41
some pesky optimisation I'd guess 16:45
TimToady sitting in hotel lobby soaking up free wifi for a bit... :) 16:56
RabidGravy Ooh that is a bit special 17:03
mst oh? 17:04
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
RabidGravy the fix is just explicit pointy on the block, but hey 17:05
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
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:07
RabidGravy yeah I suspect the regex stuff could do with a nice tutorial 17:08
viki xkcd.com/1171/ 17:10
lizmat mst: the scope in which you call .match, is where $/ gets set
same for .subst 17:11
mst lizmat: and an inner scope in a block doesn't? 17:12
lizmat hmmm...
indeed:
m: $/ = 42; { $/ = 666; say $/ }; say $/
camelia rakudo-moar fc47bb: OUTPUT«666␤666␤»
lizmat m: $/ = 42; sub { $/ = 666; say $/ }(); say $/ 17:13
camelia rakudo-moar fc47bb: OUTPUT«666␤42␤»
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
bartolin, bisect log: gist.github.com/ec7f648235960ddecc...535d9e3094
bartolin, (2016-06-04) github.com/rakudo/rakudo/commit/98...8302d621e1
lizmat I guess there's no slow fix for RT #128318 yet :-( 17:17
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:20
bartolin any objections to merging both tickets? 17:21
lizmat not from me :-)
bartolin ok, will merge them. thanks :-)
lizmat thank you for your relentless bug squashing! :-) 17:22
RabidGravy it was more
m: my $a = "foobar"; if $a.match(/foo/) { say $/ } 17:23
camelia rakudo-moar fc47bb: OUTPUT«「foo」␤»
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 $/ }
committable6 viki, ¦«fc47bbf»: 「foo」
viki works
RabidGravy Hmm 17:25
lizmat it could well be I borked something in the refactor
specifically, I recall using a different nqp:: op for finding the $/ to set
perhaps that's the reason
RabidGravy well the code in XML (as above) wasn't working 17:26
MasterDuke bisectable6: my $a = "foobar"; if $a.match(/foo/) { say $/ }
bisectable6 MasterDuke, On both starting points (old=2015.12 new=fc47bbf) the exit code is 0 and the output is identical as well
MasterDuke, Output on both points: 「foo」
RabidGravy well this is all as maybe but the code I posted above *doesn't* 17:27
and it did before
viki Does it actually have "say $/"? I thought originally you showed a return
bartolin lizmat: on a related note: it looks like you put an additional bandaid for RT #128318 into src/core/Date.pm here: github.com/rakudo/rakudo/commit/d80c728e25
MasterDuke committable6: v6c my $a = "foobar"; if $a.match(/foo/) { say $/ }
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」
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)
committable6 viki, ¦«fc47bbf»: ()
viki committable6: fc47bbf sub foo { my $a = "foobar"; if $a.match(/foo/) { return $/ } }; dd foo.Str
committable6 viki, ¦«fc47bbf»: "foo"
viki ¯\_(ツ)_/¯
lizmat bartolin: but doesn't that break on the JVM then ? 17:29
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
lizmat RabidGravy viki: going to change that and run a spectest: if clean, I'll commit
RabidGravy no biggy, I've fixed XML now
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
lizmat bartolin++ 17:34
RabidGravy I've changed this code to return the .Str of the match and all is fine
lizmat RabidGravy: but still, could you provide a piece of code that shows the difference in behaviour ? 17:38
RabidGravy right, I've got it now 17:44
RabidGravy m: sub foo { for <foobar bazbar> -> $a { if $a.match(/foo/) { return $/; } } }; say foo(); 17:46
camelia rakudo-moar fc47bb: OUTPUT«Nil␤»
RabidGravy that works different in 2016.09-53-gbb52f81 (which is the only other one I have to test with) 17:47
lizmat RabidGravy: thanks! 17:48
RabidGravy m: sub foo { for <foobar bazbar> -> $a { if $a.match(/foo/) -> $p { return $/; } } }; say foo();
camelia rakudo-moar fc47bb: OUTPUT«Nil␤»
RabidGravy m: sub foo { for <foobar bazbar> -> $a { if $a.match(/foo/) -> $p { return $p; } } }; say foo();
camelia rakudo-moar fc47bb: OUTPUT«「foo」␤»
RabidGravy is how I worked round it
lizmat changing the nqp op doesn't fix it 17:49
lizmat hmmm,... 17:51
RabidGravy is it possible the scope of the for block is actually the one afflicting it?
lizmat m: if "foo".match(/foo/) { say $/ } 17:52
camelia rakudo-moar fc47bb: OUTPUT«「foo」␤»
RabidGravy yeah, it doesn't kick in until the for is introduced
FROGGS++ # making with the merging ;-) 17:54
lizmat m: for "foo" { if .match(/foo/) -> \m { say m } } # works
camelia rakudo-moar fc47bb: OUTPUT«「foo」␤»
lizmat m: for "foo" { if .match(/foo/) { say $/ } } # works
camelia rakudo-moar fc47bb: OUTPUT«Nil␤»
lizmat no, doesn't work
lizmat well, it doesn't seem optimize related 17:57
star: for "foo" { if .match(/foo/) { say $/ } }
camelia star-m 2016.04: OUTPUT«「foo」␤»
lizmat and it did break after the release... 17:59
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 :-(
mst and it just seems like a weird and counterproductive behaviour change 18:02
feels like there should be a 6.c test for whatever's correct
lizmat mst: agree 18:03
it is definitely not an intended change
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
bartolin, bisect log: gist.github.com/ac94a5e1e9adc0c83e...d83c7f7156
bartolin, (2015-12-30) github.com/rakudo/rakudo/commit/37...de15d236c2
lizmat well, it is defintely b7201a8f22338a906f2d8027a that broke it :-( 18:05
RabidGravy I'm just testing all of my modules with 'latest' 18:08
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
lizmat RabidGravy: yeah. no argument there
argh, I hate it when identical code works differently when inside the setting 18:11
RabidGravy gah, Audio::Liquidsoap has gone broken for some other reason - yet again 18:11
lizmat :-( 18:13
please make sure this breakage creates a test :-)
RabidGravy It's usually something to do with my rebuilding 'liquidsoap' in such a way that it breaks the tests 18:14
RabidGravy and you don't want to be building liquidsoap for fun unless you love lots and lots of funny unexpected dependencies 18:15
lizmat m: for 42 { say "foo".match(/foo/); say $/ } 18:16
camelia rakudo-moar fc47bb: OUTPUT«「foo」␤Nil␤»
lizmat ^^^ weirder still
FROGGS_ m: for 42 { my $/; say "foo".match(/foo/); say $/ } 18:18
camelia rakudo-moar fc47bb: OUTPUT«「foo」␤「foo」␤»
FROGGS_ m: my $/; for 42 { say "foo".match(/foo/); say $/ }
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)␤»
FROGGS_ m: $/ = 111; for 42 { say "foo".match(/foo/); say $/ } 18:19
camelia rakudo-moar fc47bb: OUTPUT«「foo」␤111␤»
lizmat hmmm... maybe I broke something during my map optimizations :-( 18:20
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␤␤»
lizmat star: for 42 { say "foo".match(/foo/); say $/ }
RabidGravy but think of all the memory it's saving ;-)
camelia star-m 2016.04: OUTPUT«「foo」␤「foo」␤»
lizmat star: say $*VM 18:23
camelia star-m 2016.04: OUTPUT«moar (2016.04)␤»
lizmat ah, ok, so not the latest star
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:24
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␤␤»
lizmat star: for 42 { say MY::.keys } 18:29
camelia star-m 2016.04: OUTPUT«($_)␤»
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」␤»
lizmat m: use nqp; say nqp::where($/); for 42 { say "foo".match(/foo/); say nqp::where($/); say $/ }
camelia rakudo-moar fc47bb: OUTPUT«33348352␤「foo」␤33348352␤Nil␤»
lizmat so, before the scope had its own $/, and now it has the outer one 18:32
I assume the former is correct, no?
hmmm... maybe this should be taken to #perl6-dev
RabidGravy so just tested 'latest' against all my modules, no other outfall 18:43
lizmat *phew* :-) 18:52
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 github.com/rakudo/rakudo/blob/eb69...ol.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 Oct 2016 01:38Z <iBakeCake> rindolf: the stuff that starts with nqp:: is nqp ops and generally would be in github.com/perl6/nqp (see docs/)
stmuk_ datafloq.com/read/perl-6-is-remark...-data/2409
rindolf oh.
stmuk_ bit of an odd article but at least positive
mst "It's virtually unrecognizable from previous versions of the 15-year-old programming language." 19:20
fail
oh dear lord it's the p3rl.org/Net::FullAuto developer
rindolf .tell iBakeCake thanks for the info about rakudo and sprintf 19:21
yoleaux rindolf: I'll pass your message to iBakeCake.
lizmat mst: Article Author: Annie Qureshi 19:27
that's not Brian Kelly, afaik
FROGGS_ yes, only the first and second quote is
mst yeah, sorry, it has a similar level of factual error to stuff written by him so my brain pattern matched 19:28
FROGGS_ aye 19:29
lizmat fwiw, I've always felt that Hadoop is overrated, and bad for the environment in general 19:31
it's not fast enough? Just throw more metal at it!
iBakeCake . 19:48
yoleaux 19:21Z <rindolf> iBakeCake: thanks for the info about rakudo and sprintf
rindolf viki: thanks again. 19:49
viki any time 19:58
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:01
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:02
I need to know the amount scrolled too 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
any idea about which number represents scroll wheel movement? 20:04
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
obvieously curl_off_t is uint64 doesn't work :P
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:06
FROGGS_ mememan: github.com/timo/SDL2_raw-p6/blob/m...aw.pm#L287 20:07
mememan: type should be equal to MOUSEWHEEL 20:08
m: constant curl_off_t = uint64; 20:09
camelia ( no output )
FROGGS_ samcv: ^^
mememan ah
FROGGS_ m: constant curl_off_t = uint64; my curl_off_t $foo = 42;
camelia ( no output )
mememan thanks very much
FROGGS_ :o)
samcv nice :)))
AlexDaniel well, yeah… just don't rely on it in any way 20:10
FROGGS_ it is good enough to be used in nativecall signatures 20:11
mememan how do I get the direction/amount FROGGS_ 20:13
samcv ahhh FROGGS_ CStruct representation only handles attributes of type:
(u)int8, (u)int16, (u)int32, (u)int64, (u)long, (u)longlong, num16, num32, (s)size_t, bool, Str
FROGGS_ ewww
samcv is there a way around this?
FROGGS_ mememan: github.com/timo/SDL2_raw-p6/blob/m...#L347-L356 20:14
mememan: looks like the Event struct ist not correctly implemented... maybe look at the SDL2 C lib, how the struct has to look like?
mememan: then you'd be able to cast it to a correct struct implementation, until SDL2::Raw gets fixed 20:15
mememan oh
FROGGS_ m: use NativeCall; constant flubber = uint64; class Foo is repr<CStruct> { has flubber $.bar } 20:16
camelia ( no output )
FROGGS_ samcv: why don't I get an error?
FROGGS_ mememan: hg.libsdl.org/SDL/file/46cfe31e501...nts.h#l174 20:18
mememan: try to get your hands at data1 and data2
mememan: ohh, here: wiki.libsdl.org/SDL_MouseWheelEven...yEvents%29 20:19
samcv hmm i got it working. it was somewhere else in the struct my bad 20:22
FROGGS_ phew :o) 20:23
samcv yeah it errored on a different line than the problem was on
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 - encrypted.google.com/search?hl=en&...20constant 20:36
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…»
moritz not supported, I guess
lizmat rindolf: there is no assignment in nqp, everything is a constant :-) 20:40
rindolf moritz: ah. :-(
lizmat you can only bind 20:41
rindolf lizmat: hmmm... I see mutability there.
lizmat where ?
rindolf like $exp := -$exp;
lizmat that's rebinding
rindolf lizmat: ah.
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.
lizmat nqp:: my $a = 42
rindolf s/\.$/?/ 20:42
FROGGS_ nqp-m: my $a = 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…»
lizmat FROGGS_++ 20:43
:-)
FROGGS_ rindolf: use a sub?
rindolf FROGGS_: what?
FROGGS_: it's already in a subroutine.
FROGGS_ rindolf: like in Perl 5... use a subroutine to fake constants...
mst sub a { 42 } 20:45
rindolf FROGGS_: mst : thanks! Will it also evaluate functions and expressions? 20:46
FROGGS_ rindolf: yes, it will 20:47
rindolf FROGGS_: ok, thanks! 20:48
FROGGS_ rindolf: though, perhaps you might want to force evaluation.... like: my $THING := <expression here>; sub THING { $THING };
(so that the expression will only be evaluated once) 20:49
rindolf FROGGS_: I want it to be evaluated only once.
FROGGS_ and you have to use the "constant" as THING() of course, because nqp has no listops
RabidGravy finally gives in with trying to do anything clever with library versions with GD::Raw and just sticks a 'trusty' on travis 20:50
rindolf FROGGS_: is it preferable over using «$THING» directly? 20:54
FROGGS_ rindolf: no, I'd use $THING and just avoid rebinding :o) 21:00
rindolf FROGGS_: ok, thanks! 21:01
FROGGS_ rindolf: what are you up to, ooc?
rindolf FROGGS_: trying to optimise sprintf 21:02
FROGGS_ ahh, I see 21:03
FROGGS_ mememan: have you seen that already? github.com/timo/SDL2_raw-p6/blob/m...aw.pm#L419 21:13
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
how do i capture this data? i'm not sure "where" to access it
geekosaur if it's going to the terminal then the function is writing to its standard output and/or standard error
samcv ah ok 21:20
RabidGravy which is kinda special
FROGGS_ samcv: what function are you calling?
samcv curl_easy_perform
that makes sense it's writing to its stdout. but i'm unsure how to access it 21:21
geekosaur look at curl_easy_setopt 21:22
samcv well how do i access a programs stdout? i mean i've done file handles before and qx 21:22
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
you can't, it's a function, it's *your* stdout 21:24
it's not a separate process
FROGGS_ samcv: I guess you have to register a callback: curl.haxx.se/libcurl/c/curl_easy_setopt.html
samcv ahhhhh ok
geekosaur it's not even a separate thread, not that that would help because handles are process level not thread level
samcv ok that helps greatly geekosaur
in me understanding what's going on :)
geekosaur yes, I pointed at curl_easy_setopt already
samcv i meant about it being in my process
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
samcv yeah
geekosaur it's write only (except in one special case where the output is a terminal so can't be rewound anyway)
viki m: use NativeCall; sub fork is native {}; fork; say "a spoon, a spork, a..."
camelia rakudo-moar c9730a: OUTPUT«a spoon, a spork, a...␤a spoon, a spork, a...␤»
FROGGS_ if you are interested in the "verbose" output, look at that: curl.haxx.se/libcurl/c/CURLOPT_VERBOSE.html 21:26
viki m: use NativeCall; sub fork is native {}; fork; say $*PID
camelia rakudo-moar c9730a: OUTPUT«10216␤10217␤»
Hotkeys Why is it that there is not product function/method but there is one for sum? 21:28
I know you can just [*] but still
samcv ok so i fork it and then i get a PID. how to open a filehandle on a PID?
geekosaur you use the pipe syscall first
samcv or is that not possible/hard and i should use curlopt_writefunction
geekosaur pids don't have filehandles
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 :/
samcv :( thanks for the advice geekosaur
geekosaur meanwhile I don't understand why a curl "easy" interface doesn't have a "just write it to a file dammit" 21:30
but requires you to register a data callback
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
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
and use :out with that
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
samcv not the program as in the library
viki ah
geekosaur libcurl, yeh
samcv is there a way to launch a perl 6 script without incurring launching rakudo twice? or is that not possible.
regarding startup time
RabidGravy no 21:34
samcv though i could make it long running
mst I believe the answer currently is "not really"
samcv ok that's what i thought
RabidGravy because it is a second process
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:35
RabidGravy I've got tests that fire up second perl6 processes for "reasons" 21:37
samcv yeah perl6-net-curl uses a buffer 21:38
rindolf with my changes I am getting these test failures - paste.debian.net/890995/ 21:39
rindolf ok, I am getting these exact ones without my changes as well. 21:48
MasterDuke but are you getting the exact same failures quicker with your changes? 21:57
rindolf MasterDuke: heh. 22:15
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.
MasterDuke nice, making things faster is always appreciated 22:17
rindolf MasterDuke: thanks! 22:20
samcv hmm i'm getting this error: write bytes requires an object with REPR MVMOSHandle 22:36
calling write on a filehandle
$filehandle.write($buf);
fh created with $fh = IO::Handle.new 22:38
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:39
samcv hmm yeah i think that's the issue. 22:42
hmm is there a way to have a 'virtual' file handle, that doesn't get writen to any actual file? 22:43
or do i want some other object 22:44
ugexe why not just use the buf then
samcv well i want to read from it while it's downloading the page
ugexe you cant read from a handle created in another thread 22:45
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
you need some form of IPC 22:47
maybe tell curl to write to a file and have a separate thread read that file as its being written to 22:48
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:49
io::socket::async might be able to but im assuming you'd need SSL so thats no good 22:50
samcv curl will decode the ssl though 22:52
i will look into io::socket::async
ugexe you'd want to look at Proc::Async then 22:53