-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[doc] perl -c vs. "outside" #22143
Comments
"outside" is correct, the compilation is considered outside the execution, though this may better be replaced with "before". Syntax cannot be checked without executing these blocks and use statements, because these things can and commonly do modify the parser (the simplest example is "use strict"). |
Conceptually, Perl programs have a compilation phase (where source code is parsed and translated to an internal representation) and a run-time phase (where the internal representation is executed). In practice,
The Not executing use Scalar::Util qw(looks_like_number);
if (looks_like_number "31.42-1") {
print "yay\n";
} This code just imports and calls a subroutine. But without executing the
|
Okay okay okay. So let's just concentrate on that word "outside". Seems like it's just checking the things outside the program and not the things inside or something. If we change it to "before" then where should we put the word "after" etc.? I think somebody needs to do a professional redo on that paragraph. Not some amateur like me. |
I think it's also worth nothing that you can't just "focus on this one word in a sentence", you need to look at 'em all, and form a kind of parse tree, and then extract the meaning from that. I'd like to propose that we just concentrate on "statements [that] are considered as occurring outside the execution of your program". If you include those other words into your reading it becomes clearer that it's not checking the parts "considered as occurring outside the execution of your program", it's executing the parts "considered as occurring outside the execution of your program". </@ mention> To me it seems like an explanation of why these blocks need to be run/skipped is more than one can readily boil down into a single sentence, so it might be worth not including it in a summary/usage message and just describing the behaviour direclty:
|
Hey that's a good idea. Just tell what it is going to do. No need to get into deep logic about it. OK, please make the edit. Thanks! |
man perlrun says
It seems the word "outside" needs to be changed to "inside", for the
above paragraph to make sense.
Anyway, some people would just like to check the syntax of the single file in
front of them, without needing to comment out any "use", or providing
paths.
Just like if their program said
open(my $fh, "<", "input.txt")
, when not having such a input.txt ready yet. It shouldn't affect the syntax check.So maybe an option could be added for that.
The text was updated successfully, but these errors were encountered: