Michael Fowler wrote:
>
> Then say stat()->{'mode'} and stat::->mode, if it makes you feel better. Or
> better yet, always say stat()->anything when you mean the function call.
Either way is fine by me, but making Perl do one one place and the other
the other place makes no sense.
> Honestly, if you're using both a stat class and a stat function in your
> code it's up to you to keep it straight
Exactly my point. So why is this
stat->mode
Any different? It's not.
> The solutions are:
>
> stat->{'mode'}; # call stat(), access the mode key
> stat->mode; # call the mode method in the class 'stat'
>
> The last seems more DWIMish to me.
I like DWIM. DWIM is good. But if -> is going to be two distinct,
completely different operators in two separate contexts, then we need a
new operator. It is confusing and misleading otherwise.
> > We need to step back and fix the *problem*: barewords vs. functions are
> > ambiguous. In *all* contexts. Always. You can screw yourself with any of
> > these equally:
> >
> > $SIG{TERM} = IGNORE; # "IGNORE" or IGNORE()?
> >
> > print output @stuff; # print(output(@stuff))
> > # or output->print(@stuff)?
> >
> > $r = new CGI; # new(CGI) or CGI->new?
> > $q = CGI->new; # "CGI"->new or CGI()->new?
> >
> > $name = first . middle; # "firstmiddle" or
> > # first() . middle()?
> >
> > $total = number + 42; # number() + 42 or
> > # "number" + 42?
>
> I only see two action-at-a-distance potentials in the above, the two class
> method calls.
WHAT???!!
Try this code:
print header . "\n";
use CGI qw/:standard/;
print header . "\n";
So you're claiming that's not action at a distance? You're completely
wrong. The same exact mechanism causes 'Class' to become Class() -
modules exporting functions into your namespace.
-Nate