After several half-bogus bug reports (sorry guys), I'm happy to say
that Mail::Folder::FastReader, which is included with my grepmail
script, is now Inline-based instead of XS-based. Once 0.41 becomes
official I'll release it, but in the meantime you can get it from
http://www.coppit.org/temp/grepmail-4.48.tar.gz.
Below are a few thoughts I had while porting FastReader to Inline. I'm
just getting to know Inline, so I apologize in advance if any issues I
discuss are moot.
I see the overall benefit of Inline as two separate aspects:
1) Being able to inline code from other languages with Perl. I like
this because I think of files as containing code with related
functionality, not code implemented in the same programming language.
2) Automation of the linkage necessary to call other languages from
Perl. The amount of automation is impressive, and I'm sure I don't
know the half of it.
It seems to me that inlining (benefit #1) isn't always warranted. For
example:
- I like to link my C implementation against a main.c so that I can
run gdb for debugging. (Anyone know how to get the Perl debugger to
step into C?) AFAIK, there's no easy way to recover a .c file from
inlined code that doesn't have the Perl linkage stuff in it.
- Inline_Stack_* are great, but they pollute otherwise straight C
code with Inline-specific constructs.
- Can Inline wrap a C library without modification?
We could de-emphasize inlining and focus on the automated linkage:
- Allow the "use Inline" to specify a file to read from instead of
requiring that the foreign code be embedded.
- Provide an alternative to Inline_Stack_* that doesn't impact the C
code. One idea is an ARGMAP which specifies how byref arguments to a
function map to multiple return values. Another is an inlined
function declaration which has additional syntax for specifying the
Perl argument mappings.
I realize that these suggestions may not be quite in line with the
goals implied by the name "Inline". However, doing this sort of thing
would allow Inline to automatically generate the linkage to unmodified
C code, allowing folks to do the kinds of things I described above.
This would also likely remove the last reason to use XS directly. :)
Unfortunately, my suggestions may increase the learning curve of
Inline back to the level of XS...
Regards,
David
_________________________________________________________________________
David Coppit - Ph.D. Candidate [EMAIL PROTECTED]
The University of Virginia http://coppit.org/
"Yes," said Piglet, "Rabbit has Brain." There was a long silence.
"I suppose," said Pooh, "that that's why he never understands anything."