in reply to Re^9: Order of evaluation/interpolation of references
in thread Order of evaluation/interpolation of references
it's well defined that all arguments are evaluated before they are passed to a function.
If this is right:
C:\test>perl -E"$\"=''; {my@x; sub X{ push@x,'x';;\@x}}; say qq[@{X()} +@{X()}]" xxx
Then this is wrong:
C:\test>perl -E"{my$x; sub X{ $x.='x';\$x}}; say qq[${X()}${X()}]" xxxx
And vice versa.
From your other post:
it's a clear violation ...
Of what? Your sensibilities? Do you think the same about print "The price is: $obj->tostring()\n";?
Saying you don't like it, is not the same as it being illegal. And it has always been legal, so it should be consistent.
From my understanding, interpolating code references into strings is not just legal in Perl6, but further enhanced.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: Order of evaluation/interpolation of references
by LanX (Saint) on Mar 08, 2012 at 12:28 UTC | |
by BrowserUk (Patriarch) on Mar 08, 2012 at 14:19 UTC | |
by trwww (Priest) on Mar 08, 2012 at 16:51 UTC | |
by BrowserUk (Patriarch) on Mar 08, 2012 at 19:37 UTC | |
by JavaFan (Canon) on Mar 08, 2012 at 17:40 UTC |