Re: RFC 222 (v1) Interpolation of method calls
[email protected] (Michael Fowler) Thu, 14 Sep 2000 16:25:42 -0800
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Sep 14, 2000 at 06:37:22PM -0500, David L. Nicol wrote:
> A possibility that does not appear in RFC222.1 is to put tho whole
> accessor expression inside curlies:
>
> print "Today's weather will be ${weather->temp} degrees and sunny.";
>
> which would follow the "You want something funny in your interpolated
> scalar's name or reference, you put it in curlies" rule. Since the contents
> of that expression is not strictly \w+ it does not get interpreted as
> the symbol table lookup ${'weather->temp'}, so that is not a problem, nor
> are the whitespace situations listed in the CAVEATS section.
Currently, ${weather->temp} means dereference the return value of the method
'temp' in the 'weather' class as a scalar reference (or a symbolic
reference, if it's not a scalar reference and you're not using strict). Do
you intend for this meaning to be taken away entirely, or to be
special-cased within interpolated strings? If either I would have to
heartily disagree with you; it's inconsistent, and while special cases can
be a good thing when it comes to DWIM, I think we should DWIM on the side of
interpolating method calls, rather than taking away existing syntax.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--