Re: RFC - Interpolation of method calls
[email protected] (Nick Ing-Simmons) Thu, 14 Sep 2000 17:52:37 +0100 (BST)
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Organization | via, but not speaking for : Texas Instruments Ltd. |
| Message-ID | <[email protected]> |
Michael G Schwern <[email protected]> writes: > > print "Today's weather will be $weather->temp degrees and sunny."; > >This does not DWIM. Instead of interpolating C<$weather->temp> as a method >call, it comes out as C<$weather.'->temp'> and is usually followed immediately >by the question "What does 'Weather=HASH(0x80d4174)->temp' mean??" Most >programmers learning OO Perl expect this to work and are surprised to find >that it does not. I think $xxxx-> is unlikely enough in a string that this is worth considering. > >Work arounds abound: print $weather->report; being the one I like best - avoids the un-meritted assumption it will be sunny ;-) -- Nick Ing-Simmons <[email protected]> Via, but not speaking for: Texas Instruments Ltd.