Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: RFC: Syntax::Construct

by Jenda (Abbot)
on Dec 25, 2013 at 01:04 UTC ( [id://1068341]=note: print w/replies, xml ) Need Help??


in reply to Re: RFC: Syntax::Construct
in thread RFC: Syntax::Construct

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.

Replies are listed 'Best First'.
Re^3: RFC: Syntax::Construct
by Anonymous Monk on Dec 25, 2013 at 01:45 UTC

    ... investigate ...

    perlver does the investigation

    ... Jenda ...

    :)

Re^3: RFC: Syntax::Construct
by BrowserUk (Patriarch) on Dec 25, 2013 at 06:33 UTC
    C:\test>pdoc 'pdoc' is not recognized as an internal or external command, operable program or batch file.

    Okay. Two people.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-26 08:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found