[% setvar title Method calls should not suffer from the action on a distance %]
Note: these documents may be out of date. Do not use as reference! |
To see what is currently happening visit http://www.perl6.org/
Method calls should not suffer from the action on a distance
Maintainer: Ilya Zakharevich <ilya@math.ohio-state.edu> Date: 15 Sep 2000 Mailing List: perl6-language@perl.org Number: 244 Version: 1 Status: Developing
This RFC proposes to remove indirect object syntax, and modify the
semantic of the ->
operator.
Currently,
foo->bar($baz)
can be parsed either as <'foo'-
bar($baz)>>, or as <foo()-
bar($baz)>>
depending on how the symbol foo
was used on other places. The proposal
is to always choose the first meaning: make ->
autoquote the bareword
on the left.
This interpretation is more desirable on esthetical ground, since
'foo'->bar($baz)
looks visually clattered, but <foo()-
bar($baz)>> looks as if it expresses
its meaning. The default choice is done so that if you need other
choice, your code does not look artificial.
foo->bar($baz, $coon)
should be made synonymous with
foo->bar $baz, $coon
I can see no ambiguity in this call, but it not always works with Perl5.
Currently,
bar foo $baz
can be parsed either as <'foo'-
bar($baz)>>, or as &bar(&foo($baz))
,
depending on how the symbols foo
and bar
were used on other places.
There only way to avoid the action at a distance is to prohibit one of these
interpretations. Since the other way <foo-
bar $baz>> to write this
method call is as convenient as the indirect object syntax, the proposal
is to prohibit the indirect object method calls altogether.
Make the above syntax be interpreted as &bar(&foo($baz))
.
Translate Perl5 code as specified above.
Remove the DWIM logic from the parser.
None.