|There's more than one way to do things|
Re^2: RFC: Syntax::Constructby Jenda (Abbot)
|on Dec 25, 2013 at 01:04 UTC||Need Help??|
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 -- >