OK, let me see. I'm writing some code, I need to use some feature that I've heard is not available in some old versions. What do I do ... I basically have three options. First, I can investigate, find out what version introduced that thing and use The.Right.Version. How likely is that I do that? Second, I know my version does support that feature so I add use My.Version.Of.Perl. This means that for no good reason I've disallowed people running older Perls than mine using my script/module. This happens all too often! Third, I specify, in the code, that I want to use that feature. And do not have to know when was the feature introduced.

OK, the other side ... I want to use a module/script. Well ... I might be careful and read the code first, but most likely I'll just run it. In case of a module, I'll run the tests. If the author did the first thing, then either it runs or it tells me my perl is too old. If he did the second ... again it either runs or reports my perl is too old. The catch is I've got no chance knowing which of the two it was and whether the script/module really needs version X.Y or whether M.N would suffice, but the script/module author did not bother checking. In a perfect world use 5.14; means the script/module will not function properly in a lower version. In the real world it more often means the author had 5.14 and that's what he tested the code with.

If the author decided to do the third (actually for him even easier than just use His.Version), I get a compile time message telling me that the script/module uses feature X that was introduced in version X.Y. Pointless, huh?

So ... the only case in which this adds complexity is when someone reads the code, instead of attempting to run or compile-time-check it. And what a huge complexity that is! I see the line, I run "perldoc Syntax::Construct", get told that "this module ensures the specified feature is available in your perl and enables it's use. It reports the necessary perl version in case your perl doesn't support that feature. To test whether your perl supports the requested feture run perl -MSyntax::Construct=... -e 1 in your shell/command prompt."

Huge complexity indeed.

Update: s/\bpdoc\b/perldoc/g; # forgot, pdoc is just a local alias

<!-- Node text goes above. Div tags should contain sig only -- >

Jenda
Enoch was right!
Enjoy the last years of Rome.


In reply to Re^2: RFC: Syntax::Construct by Jenda
in thread RFC: Syntax::Construct by choroba

Title:
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, details, 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, summary, 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.