[% setvar title No overloading of f($arg) basing on ref($arg) %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/

TITLE

No overloading of f($arg) basing on ref($arg)

VERSION

  Maintainer: Ilya Zakharevich <ilya@math.ohio-state.edu>
  Date: 15 Sep 2000
  Mailing List: perl6-language@perl.org
  Number: 242
  Version: 1
  Status: Developing

ABSTRACT

This RFC proposes that the meaning of function calls and operators should not be subtly changed basing on whether the argument is a reference or not.

DESCRIPTION

There are several proposals to switch the meaning of f($arg) basing on the whether $arg is an array reference or not. For example, it is tempting to allow $array[[2,3]] denote the same as $array[2][3].

Unfortunately, this prohibits the usage of overloaded data in $arg. For example

  my $i23 = new Math::BigInt 23;
  print $array[$i23]

will not access $array[23], but $array[2][3] if the internal representation if $i23 is (blessed) [2,3].

Keeping in mind that overloaded objects can be made to behave as array references even if they are not (see the key '@{}' of overloading) makes things yet more confusing.

MIGRATION ISSUES

None.

IMPLEMENTATION

None.

REFERENCES

None.