Repository navigation
Conversation
|
for readability I prefer the longer version personally. |
Yeah I think I find the longer version more readable, too, actually... |
|
Fair enough, feel free to close then. I considered using the /x regex flag for introducing extra whitespace, so that the code reads more similarly to the old code; but I don't know if we're guaranteed to have a new enough Perl for that. Also considered using a hash to store the set of valid versions, but went with the regex instead. If either of these approaches would be preferred, I can change the PR to do those instead; otherwise, feel free to close |
|
I can't find what version of Perl started supporting |
|
I also agree that this is less legible. A hash could work (checking for existance of the value as a key), just need an efficient way to construct it (using a loop would make this less-efficient overall, though not that it is often-used often enough to matter). |
Yeah, I couldn't seem to find any info on when exactly the The hash version would look something like: my @versions = (
"5.foo" => 1,
"5.bar" => 1,
...);
return $versions{$]};All those " |
If performance is critical, then the regex version will be the fastest: all perl needs to do is parse the regex and apply it. (The ugliness of the current PR is because I've already done the regex optimization. Or rather, most of it: I left some shared prefixes, because even I couldn't stomach what it'd look like to combine them ;) For the hash version, I'd just give it as a literal, both for performance and for legibility (IMO having all the redundant " |
|
I don't think there is any argument that regex would be faster, but we need someplace in the middle. Otherwise future released will just make this harder and harder to add to and make it much much easier to mess it up. I don't believe a small overhead will make or break fink so readability and future updates will have a higher weight then pure speed here. |
|
Yeahno, just to be clear, my only concern here is about legibility and maintainability :) Although the elsif chain does have some performance issues (since it's essentially doing a linear scan through a list), fixing that is just a nice side benefit. Honestly, I'd be just as happy with an implementation like |
Simplify the conditional chain in
perlmod/Fink/Bootstrap.pm:is_perl_supportedfunction. The goal is to improve code legibility and maintainability, and should not cause any functional changes.