in reply to What is an ordinary statement?
For item 1, I think what it's trying to convey is that a declaration statement is just like what it calls "Simple Statements" a couple lines on (e.g. my $foo; is of a kind with say "Fnord."). It may be setting that up to contrast with "Compound Statements" (those which create a new scope with a block), but I'm not sure.
You're pretty much close on your guesses WRT item the second. A declaration has the compile time effect of adding to the symbol table (which affects the subsequent parsing with things like strict). The runtime effect depends on the declaration type (e.g. local $foo = q{bar} would generate opcodes which save off the existing value in the package variable $foo then initialize it to the new value). You can use something like B::Concise to peek under the hood at the generated opcodes.
As for the last question my gut answer is "they're probably about the same, but it depends". A C++ compiler especially is going to be doing a bit more work for things like type checking, but with things like attributes perl could be doing "more" work.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What is an ordinary statement?
by ntj (Novice) on Jun 05, 2019 at 12:15 UTC |