Re: RFC - Interpolation of method calls
[email protected] (Nathan Wiger) Thu, 14 Sep 2000 07:49:32 -0700
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Message-ID | <[email protected]> |
> This topic is actually covered, albeit far less in-depth and lumped with an > unrelated change, by Nathan Wiger's RFC 103, just in case you weren't aware. Yeah, I've got to split those up. I was trying cut down on the flood of RFC's that poor Larry has to sift through :-(, but they are both complex issues. Schwern, if you want to take this one over, it's all yours. There has already been some discussion on this here: http://www.mail-archive.com/[email protected]/msg02169.html I would encourage people to read the thread. In particular, to be truly consistent we should interpolate class as well as instance methods, i.e.: "Hello, Class->name"; But there's a lot of problems with this and I'm not sure it's a good idea. > > print 'Today\'s weather will be '.join($", $weather->temp()). > > ' degrees and sunny.'; > > > > However if temp() calls wantarray(), the result will be FALSE (scalar). > > Ok, this is very confusing. I think what he's trying to get at is that these should all work the same: print "Here's some @stuff"; print "Here's some $h->{stuff}"; print "Here's some $r->stuff"; > > print 'There is '.$obj->foo(this => $yar, that => 2 + 2). ' in my head."; > > Now perl is parsing full statements within strings. This already happens with: print "Here's some $h->{$stuff}"; print "Here's some $a->[$stuff + $MIN]"; So it's not that confusing, and quite consistent. > I'd say keep it simple, allow only simple, non-parenthetical method calls. No, this makes it impossible to do this: print "Your name is $cgi->param('name')"; And it's also inconsistent with how hashrefs and arrayrefs work already. -Nate