This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

No special UPPERCASE_NAME subroutines

=head1 VERSION

  Maintainer: Ilya Zakharevich <[EMAIL PROTECTED]>
  Date: 15 Sep 2000
  Mailing List: [EMAIL PROTECTED]
  Number: 243
  Version: 1
  Status: Developing

=head1 ABSTRACT

This RFC proposes that no subroutines with uppercased names should be
special in Perl.

=head1 DESCRIPTION

If some special action handler needs to be registered, this should be
done not by using a special name, but by a pragma.

  use tie STORE => sub { ... };

not

  sub STORE { ... }

This would make declarations of handlers visually distinctive,
would avoid prolifiration of hundreds of special names for handlers,
would avoid conflicts with interfaces to external libraries which define
a STORE() funcation etc.

=head1 MIGRATION ISSUES

Translate currently special names to the corresponding pragmas, as shown
above.  (BEGIN/END etc. are proposed to drop C<sub> in RFC68, so they are not
covered by this RFC.)

=head1 IMPLEMENTATION

This way to introduce the handlers is already used with overloading.  Keep
in mind that the overhead of calling an overloaded method is 4..5 times
lower than the overhead of calling the tie()d method (when the semantic
is the same, for example, when comparing a scalar FETCH with the overloaded
C<'~'>.)

Currently overloaded methods live in the symbol table, but are converted to
not-completely-alphanumeric names.  A similar way may be used for other
handlers introduced by pragmas, so they may continue to be inheritable if
needed.  For example, the above subroutine for STORE may live under the name
C<'tie/STORE'>.

=head1 REFERENCES

RFC 68 (v2): Eliminate the optional C<sub> for C<BEGIN> etc block declarations

Reply via email to