Perl 6 - the future is here, just unevenly distributed

IRC log for #pdl, 2014-05-16

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

All times shown according to UTC.

Time Nick Message
03:44 jberger run4flat: o/
03:44 jberger long time, how ya been?
12:41 vicash joined #pdl
14:24 drrho joined #pdl
14:59 mohawk joined #pdl
15:02 mohawk thanks, Bender2
16:00 run4flat hey jberger, life is pretty good
16:00 run4flat I submitted grades on Wednesday! :-)
16:00 run4flat I've been picking up steam on my tcc work since I gave the final last Tuesday
16:00 run4flat Bender1, trust jberger
16:00 Bender1 OK, run4flat
16:33 mohawk run4flat, how's the tcc stuff going?
16:34 mohawk speaking (sort of) of XS, i had a bit of an XS nightmare yesterday
16:34 mohawk turns out eval_pv requires PUTBACK / SPAGAIN around it
16:37 run4flat yes, I read about it
16:37 run4flat I idle on #xs
16:37 mohawk oh, neat
16:37 run4flat I realized that I wasn't copying quite enough of the right data for the tcc symbol table; I've started working on a fix for that
16:38 run4flat I have believed for some time that I was close, but I'm clearing out a formerly dark corner
16:38 run4flat so now I believe I'm *really* close. :-)
16:38 mohawk what's your end-state? an XS module?
16:39 run4flat mostly
16:39 mohawk the first 90% of the project takes 90% of the time
16:39 run4flat it'll be an xs module with a keyword parser
16:39 mohawk the last 10% takes the other 90%
16:39 run4flat that allows you to embed blocks of C code
16:39 run4flat and *share* that C code with other c blocks
16:39 run4flat where the scope of that sharing is governed lexically
16:40 run4flat but yes, it'll be implemented as an XS module
16:40 mohawk so it will be a modularised C compiler, that will take as inputs not just text, but parse trees?
16:40 run4flat not parse trees, just text
16:40 run4flat but you'll be able to share symbol tables between compiler contexts/blocks
16:41 mohawk gotcha
16:41 run4flat If you want to call the same function in 10 different blocks, you'll only need to parse the function declaration once
16:41 run4flat this is a big deal with, say, the Perl API, since it's enormous
16:41 mohawk you say symbol table, i say parse tree ;)
16:41 run4flat hmm
16:41 run4flat not quite the same
16:42 run4flat the symbol table simply knows the layout of structs and typedefs, and the signatures for functions
16:42 run4flat it doesn't actually maintain the full parse info
16:42 run4flat make sense?
16:42 mohawk yes
16:42 run4flat so I can't copy a parse tree and tweak a small part (unfortunately)
16:42 run4flat actually, tcc doesn't build a parse tree. It's a single-pass compiler
16:43 run4flat that's why it compiles 9x faster than gcc -O0
16:43 mohawk ok
16:43 run4flat and 40x faster than gcc -O3
16:43 run4flat but the code runs a little slower. :-)
16:43 mohawk well, it's doing a lot less, so duh ;)
16:43 mohawk (i read the WP page on it last time we talked)
16:44 * run4flat has a vague suspicion he's ranting...
16:44 run4flat I get easily excited
16:46 mohawk grin
16:46 mohawk nothing wrong with that
16:49 sivoais this TCC work will be immediately useful for Leptonica. It has a C code genaration function that creates optimised image morphology routines
16:49 sivoais for a given structuring element
16:50 mohawk if you can do C parsing correctly, i could look to bring it into Inline
16:50 mohawk h2xs could be made to work in the 21st century, too
16:50 mohawk basically, if you can do C parsing right, it will be widely useful
16:54 mohawk "only C can parse C" ;)
16:59 run4flat mohawk, for better or worse, this will hopefully provide a better C interface than Inline itself
16:59 run4flat One of the functions takes a block of C builds a Perl OP, executing that op in-place
17:00 run4flat you can write your C code *really* inline
17:00 run4flat you'll see, it'll be great
17:00 run4flat sivoais, we'll have to check out applications with Leptonica
17:01 run4flat as is, you can already utilize tcc via C::TinyCompiler: http://search.cpan.org/~dcmertens/C-TinyCompiler-0.04/lib/C/TinyCompiler.pm
17:01 run4flat but calling C functions via C::TinyCompiler is quite slow
17:02 mohawk run4flat, i'd love to see some example code (even if not working yet)?
17:02 * run4flat digs up a link
17:03 run4flat https://github.com/run4flat/C-Blocks/blob/master/lib/C/Blocks.pm
17:03 run4flat You'll have to read the pod to see example code
17:04 run4flat I haven't pushed it in a couple of days
17:04 run4flat and it depends on a slight fork of tcc that I'm working on
17:04 run4flat but that'll give you a demo of what I hope to accomplish
17:05 mohawk on C::TinyCompiler, i see synopsis has "$context->code('Body') = q{" - lvalue return from sub? i disapprove
17:05 run4flat it's not a sub
17:06 run4flat it's a slot in the hashref
17:06 run4flat :-)
17:06 run4flat oh wait
17:06 run4flat ...
17:06 run4flat right.
17:06 * run4flat shrugs
17:06 run4flat it's meant to be useful
17:07 run4flat The block of code is meant to be manipulated like a string
17:07 run4flat rather than emulate a string interface, I simply made it return the string as an lvalue
17:07 mohawk ok
17:07 mohawk conceptuallly, i find that a bit mind-bending
17:07 mohawk can't it just take an arg instead?
17:08 run4flat too short-sighted
17:08 run4flat what if you want to modify the code?
17:08 mohawk generally, that C::TC looks quit shekshy
17:08 mohawk call the method again
17:08 run4flat there are some modules whose sole purpose is to perform a regex replace
17:08 mohawk $context->code('Body',  q{...});
17:08 * run4flat shakes head
17:09 run4flat why do that when I can just say $context->code('Body') =~ s/something/else/g
17:09 run4flat but that's not what C::Blocks is about
17:10 run4flat C::TC is my former work, not my latest stuff
17:10 mohawk the RE thing is interesting, fair enough
17:10 mohawk now to look at the C::B stuff...
17:13 mohawk i see your csub just says "oops, C-Perl stacks are tricky" - welcome to the graveyard of "i can do C-Perl interface really easily"? ;)
17:14 run4flat sorta
17:14 run4flat I saw bulk88's example and will likely borrow from that
17:14 run4flat the thing is, EU::ParseXS does some handy stuff converting XS code to C code
17:15 run4flat (oh, and Booking.com had an interesting blog entry about xsubs that I should look into...)
17:15 run4flat anyway, I'll likely write a module that'll provide some useful macros that can be cuse'd if a user wants them
17:16 run4flat to handle the fiddly bits at the beginning and end of a csub
17:16 run4flat or I'll just create an xsub keyword that calls out to EU::ParseXS
17:21 mohawk let's not reinvent wheels that don't need reinventing? ;)
17:23 run4flat Sure, but I think we have some crappy wheels out there...
17:24 mohawk sure
17:24 mohawk those ones need it
17:25 run4flat Really the goals of C::Blocks are to (1) provide a much cleaner interface between Perl and C and (2) to make it much, much easier to share C code in Perl programming
17:26 run4flat I think you've done some work on the latter
17:26 mohawk mostly around the edges
17:27 mohawk i saw ways of making it easier, i'm looking to make those ways work better together
17:27 mohawk closing gaps between them, if you will
17:27 run4flat sure
18:53 run4flat joined #pdl
19:16 mohawk gimp-perl dev release 2.30_03 now on CPAN
19:22 mohawk sivoais, i'd be very interested in your feedback
20:46 sivoais can't right now. cooking up a late lunch :-)
20:55 mohawk tsk
21:03 run4flat have a nice weekend!
21:03 run4flat o/
21:06 mohawk have a good one

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