Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Huffman coding in pure Perl

by w-ber (Hermit)
on Mar 04, 2007 at 17:47 UTC ( #603119=note: print w/ replies, xml ) Need Help??


in reply to Re: Huffman coding in pure Perl
in thread Huffman coding in pure Perl

Yes, thank you. That was a silly typo. Fixed now.

--
print "Just Another Perl Adept\n";


Comment on Re^2: Huffman coding in pure Perl
Re^3: Huffman coding in pure Perl (why?)
by tye (Cardinal) on Mar 04, 2007 at 19:51 UTC

    Why is that line even there at all? The meaning of that line is "This is guaranteed to not work in versions prior to 5.008". Why doesn't it work in those older versions? It certainly compiles fine (once that line is removed).

    So it appears that the purpose of that line may simply be to guarantee that the module won't work for versions prior to 5.008 ( do you dislike old Perl versions? :). You should at least comment the line so people know why you know your module is incompatible with pre-5.008 Perls. Or don't include such lines if you don't actually know that your module "requires 5.008".

    - tye        

      Hmm. To be frank, I didn't know the semantics of the line is "not guaranteed to work in previous versions". I thought it was more like "only tested with versions this and above", and since I only have Perl 5.8 (5.8.8 to be exact), it was a natural thing to do.

      I have nothing against older Perl versions, but I feel responsible if I don't clearly document it that I have only tested the module with Perl 5.8, and someone runs the module with an old version where it doesn't work.

      --
      print "Just Another Perl Adept\n";

        Then perhaps you need to think about what "use 5.008;" actually does. First, it is a compile-time equivalent of "require 5.008" (use, especially in this case, is mostly just a compile-time version of require). Does your module "require 5.008"? You don't know. And yet you want to "clearly document" that your module requires 5.008?

        If I have, for example, 5.6.1, what is the difference for me between you including "use 5.008" or not including it in your module? With "use 5.008", if I try to use your module I get told:

        Perl v5.8.0 required--this is only v5.6.1

        and things refuse to do anything else. How does that clearly document "I haven't tested this prior to 5.8" ? It doesn't. It simply prevents me from using your module as is. It "clearly documents" "This module is known to not work prior to 5.8, but as to why it doesn't work, we have nothing to say", which isn't very clear documentation.

        Without "use 5.008", I'll get told something useful if you use some feature that wasn't present in my version of Perl, or I'll see one of your unit tests fail in the unlikely situation that you wrote code that compiles in my old version of Perl but does something different in it -- much attention is paid to making sure that valid Perl code doesn't break (do something different) when Perl is upgraded, after all.

        What else does that imply? I means that any CPAN tester who does an automated test of your module will get a simple failure for versions of Perl prior to 5.8. So, if I wondered if your module worked on 5.6.1, I'd likely look at CPAN tester reports for 5.6.1 and your "use 5.008" prevents such tests from documenting anything about how your code would work in 5.6.1 except to document the fact that you included "use 5.008" in your source code.

        So please stop doing that. If you want to document that you haven't tested prior to 5.8, say that in your documentation. Don't prevent prior versions of Perl from even having a chance to try to compile your code.

        - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://603119]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-08-21 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (141 votes), past polls