RFC 244 (v1) Method calls should not suffer from the action on a distance
[email protected] (Perl6 RFC Librarian) 16 Sep 2000 08:08:06 -0000
| Newsgroups | perl.perl6.announce.rfc,perl.perl6.language |
|---|---|
| Message-ID | <[email protected]> |
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Method calls should not suffer from the action on a distance =head1 VERSION Maintainer: Ilya Zakharevich <[email protected]> Date: 15 Sep 2000 Mailing List: [email protected] Number: 244 Version: 1 Status: Developing =head1 ABSTRACT This RFC proposes to remove indirect object syntax, and modify the semantic of the C<< -> >> operator. =head1 DESCRIPTION =head2 -> Currently, foo->bar($baz) can be parsed either as C<<'foo'->bar($baz)>>, or as C<<foo()->bar($baz)>> depending on how the symbol C<foo> was used on other places. The proposal is to always choose the first meaning: make C<< -> >> autoquote the bareword on the left. This interpretation is more desirable on esthetical ground, since 'foo'->bar($baz) looks visually clattered, but C<<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. =head2 Parentheses 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. =head2 Indirect object syntax Currently, bar foo $baz can be parsed either as C<<'foo'->bar($baz)>>, or as C<&bar(&foo($baz))>, depending on how the symbols C<foo> and C<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 C<<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 C<&bar(&foo($baz))>. =head1 MIGRATION ISSUES Translate Perl5 code as specified above. =head1 IMPLEMENTATION Remove the DWIM logic from the parser. =head1 REFERENCES None.