|XP is just a number|
Re: Follow the Interface?by ViceRaid (Chaplain)
|on Jul 24, 2003 at 15:04 UTC||Need Help??|
I'd come to a similar opinion as tye above, though perhaps for a slightly different reason. I know no C or C++, and very little about the specifics of XS. I know a good deal of Perl. I'm probably not unusual: if the intended audience for your new Perl interface module is Perl developers, you're guaranteed that everyone in that audience is going to know something about Perl - at least how to download, install and use a module - whilst you can't say anything with confidence about how much C they know.
The most important thing is to supply those Perl developers with a library-centric interface and enough documentation to get started using it. They may well hate the interface as "un-Perlish". If they loathe it enough, and have enough Perl to understand packages and modules, they can sweeten the interface to taste. Well, they don't even need to understand packages: if they can write a function, they can hide the nastiness of your library-centric module all they want.
As an example, take a look at the HTML parser modules on CPAN. Many of them derive from the c-based parser in HTML::Parser. The interface of HTML::Parser probably isn't to the taste of most people (a few years ago, I tried and failed several times to understand it), but it doesn't matter, because there's lots of people willing to step in and provide more "perlish" interfaces (whatever that means to them). Hence HTML::PullParser, HTML::TokeParser, HTML::TreeBuilder, HTML::TokeParser::Simple, and so on.
Recently, I wanted to use the library version of HTML Tidy. Without disrespect to the author, what's provided for Perl is a pretty bare (SWIG-ified) interface to the underlying C calls. To me it's ugly to do:
The underlying C-constants are exposed ($tidy->TidyBodyOnly) and there's steps that are meaningless in Perl ($tidy->Create()). And I don't like the method naming convention. But it's simple for me as a Perl developer to make a functional interface I like, such as:
That hides all the C messiness. The point being: I could never have written the C interface; I simply don't know how. But I - or any other competent Perlista - can wrap your generously-provided C-interface just as they wish.
Let a thousand interfaces bloom