On 26/09/02 12:37 -0400, Aaron J Mackey wrote:
> 
> On Wed, 25 Sep 2002, Brian Ingerson wrote:
> 
> > Did I miss anything major?
> 
> I think an expanded discussion of some of the Cookbook recipes (most
> notably the OO Soldier example) would be great; 

Implicit in this outline is that good Cookbook-like examples will be
throughout.

> and an echo of a previous poster's comments on typemaps - this it the
> last vestige of XS that an Inline::C author needs to fight with, and
> it's not trivially simple as perlxs and other documents seem to
> indicate.

Typemaps will be fully covered. 

I sometimes wish that typemaps could be improved upon. They are not
quite XS. They are just the little transformations that are so common
that you want to factor them out of your code and into a common place.

For instance, if every Inline function you wrote looked like:

    SV* foo(SV* x, SV* y) {

You wouldn't need any typemaps. You'd just disassemble and reassemble
all the SVs right in your function.

I actually like this approach better for small to medium projects. Even
if you start accumulating duplicate code, you can refactor the type
mapping stuff into internal static functions. The C compiler may very
well inline them anyway, so no performance worries. The nice thing about
avoiding typemaps is that your code stays in the Perl source file. That
is especially nice for CPAN modules, where any custom typemaps would be
tossed after build/installation.

Of course, I'm not advocating pitching out the standard typemaps like char*
and long, etc. Anything in the system typemap is going to be standard
everywhere. And the source is right in the module tree.

hmm. This would be good material for a book.

> Also, perhaps a redux of mjd's article on when *not* to write Perl in C.

Good point. Where is this published?


Cheers, Brian

Reply via email to