in reply to Re: XS design question
in thread XS design question
[write] your XS like you would write your Perl
My XS philosophy is "write XS code like C code, and provide a C-friendly interface". I'm not sure my philosophy actually conflicts with yours, even though it sounds somewhat opposite. I find that the more Perl-like code you put into XS, the more fragile the results are (in multiple ways).
So I'd write the wrapper functions in Perl and write one XS function that takes C-friendly arguments and returns C-friendly results and let the Perl code check for list vs. scalar context etc. That usually results in cleaner, simpler, easier to maintain and extend and more powerful code.
- tye
|
|---|