Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

This question hasn't seen any responses after almost a day. Maybe the following will get the debate rolling. :)

  1. I like the notion of having the XS module separate. It's Ok for the PP module to use the XS module if it's available, and to gracefully fall back to PP if not (or if an ENV variable or 'use' flag specifically disallows upgrade to XS). If you don't have creative control over the PP version, you could always create an "any" module to handle the upgrade/fallback logic for users. One good reason for putting the XS version in its own module is that it's generally more of a "sure thing" getting a pure-Perl module installed, so some users may appreciate that they're not prohibited from using the pure-Perl version just because they can't get the XS version to compile (this has become a less problematic issue nowadays, but still may be a consideration).
  2. _XS: I've seen people mention that it's most useful when the _XS name distinguishes the module from a PP version. If there is not pure-Perl version, the _XS name is less useful. There are plenty of examples of XS modules that aren't named with XS, and of XS modules that are. I don't always expect or need to see it in the name. I usually look at the source to see if XS is in play anyway.
  3. Regarding stand-alone: It depends on how much of the pure-Perl version you're re-implementing. If you're only overriding one function, it seems silly to cut-and-paste all the rest of the functions when you could simply inherit instead.
  4. The pure-Perl module needs tests! But the XS module does too. It's possible there is a lot of overlap in what tests make sense for both modules. If the same tests are being run against both the pure-Perl and the XS version, that's great. But there are probably many considerations that only apply to the XS version, and that may not make any sense for the pure-Perl version. XS code is a lot harder to get right. More problematic needs more tests.

I hope some of this has been helpful. Hopefully others will dive in now.


In reply to Re: On naming of XS extension modules by davido
in thread On naming of XS extension modules by aufflick

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (13)
    As of 2015-11-30 17:44 GMT
    Find Nodes?
      Voting Booth?

      What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

      Results (778 votes), past polls