http://qs321.pair.com?node_id=11119462


in reply to On Backwards Compatibility and Bareword Filehandles

The parser raises an error if the new I/O variable would shadow any other bareword known to the parser, so these filehandles cannot conflict with sub names or package names.

There are plenty of ways to get sub names or package names not known to the parser at the point where the parser encounters one of these barewords.

BAREWORD PACKAGE EXPR is a class method call on PACKAGE. Always; even if BAREWORD is "open".

I think the same problem applies here. How is the parser to know that BAREWORD will eventually become PACKAGE, when the package is defined later?

If we allow the precedent of removing features from the language because the pumpking thinks they are ugly...

I think you're being unfair with this characterization. The desire to reduce indirect object notation is not primarily aesthetic; it's primarily because it's too often statically undecidable and it's fragile with regard to the action at a distance of what other code has been parsed and when.

Put another way, if I name a bareword filehandle JSON or YAML because I'm going to read or write some structured data, I don't want my program to behave unpredictably depending on when the modules of the same name get loaded.