On 14 Aug 2000 23:29:38 -0000, Perl6 RFC Librarian wrote:
>Currently, attempting to use objects in a string context
>yields garbage:
>
> print "r is $r->func"; # "OBJ=HASH(0xef958)->func"
> print "r is ", $r->func; # works, but clumsy
I've not seen any comments on this RFC yet. But this idea has been lying
on my stomch ever since it's been proposed.
Does this expand to regexes?
/$foo->blah/
To be consequent, it should. I don't like it, because so far, "-" nor
">" are metacharacters.
As someone once wrote (I think it was in comp.lang.perl.misc): you have
to draw the line somewhere. Currently, the line is: variables, arrays,
hash and array items, idem ditto with references. that's it. No
functions, no class methods, no object mehods. To me, this limitation
feels natural, because methods and functions *are* basically the same
thing. Why interpolate "$obj->method" and not "Class->method"?
What I would like, is something equivalent to the "@{[...]}" hack but
with far fewer keystrokes, something almost as simple as opening and
closing parens. It should work both in doublequotish strings, and in
regexes.
--
Bart.