Tom Christiansen wrote:
>
> Funny--I always think of them as function calls, and don't expect
> function calls to expand.
I doubt anyone's arguing that they're not function calls. What I find
"surprising" is that Perl doesn't DWIM here. It doesn't encourage data
encapsulation or try to make it easy:
my $weather = new Schwern::Example;
print "Today's weather will be $weather->{temp} degrees and sunny.";
print "And tomorrow we'll be expecting ", $weather->forecast;
If method calls interpolated, this would be easier. Instead, it
encourages you to provide direct hash access to your data since it's
much easier to use that way.
I find myself wanting to say:
print "Thanks, $cgi->param('name') for your order!";
print "It matched" if /$config->get_expression/;
Rather than:
print "Thanks, " . $cgi->param('name') . " for your order";
my($tmp_exp) = $config->get_expression;
print "It matched" if /$tmp_exp/;
So often it almost hurts. This proposal makes things easier. And to me
it remains quite consistent if we say:
-> is always special, even in qq//, just like $ and @
For hashrefs and arrayrefs, this already appears to be true anyways.
-Nate