xsawyerx / guacamole

Guacamole is a parser toolkit for Standard Perl. It provides fully static BNF-based parsing capability to a reasonable subset of Perl.
https://metacpan.org/pod/Guacamole
20 stars 8 forks source link

underscore filehandle is useful … why unsupported? #105

Closed FGasper closed 3 years ago

FGasper commented 3 years ago

Accessing the result of the last stat() operation is often useful, I find, to avoid unneeded disk I/O. What is the intended replacement? Always use stat(), never using -X?

xsawyerx commented 3 years ago
  1. stat(_) is unreadable to a new developer, because _ only exists when you use stat.
  2. It's also confusing because it only exists if you have already done a stat which can lead to confusion in A. Using stat(_) without a prior stat call and B. using stat(_) by mistake without realizing there already was a previous stat call.
  3. More importantly, _ is a bareword identifier, which Standard Perl does not support. When you look at something, you need to always know what this is. When using _ in other contexts (print _), perl doesn't read it the same way, making _ ambiguous, which Standard Perl refuses to be.