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

=head1 TITLE

Global dynamic variables should remain the default

=head1 VERSION

  Maintainer: Nathan Wiger <[EMAIL PROTECTED]>
  Date: 28 Sep 2000
  Last Modified: 30 Sep 2000
  Mailing List: [EMAIL PROTECTED]
  Number: 330
  Version: 2
  Status: Frozen

=head1 ABSTRACT

Several proposals try to automatically lexicalize variables by default.
While this is a nice idea, it defeats the primary purpose of lexical
variables: forced declaration and explicit scoping.

Another proposal suggests that users should be forced to declare all
variables with C<my> explicitly. Blech. That doesn't make anything easy.
Perl is not a B&D language (by default, at least :).

This proposal simply says that variable scoping rules should be the same
in Perl 6 as they are currently.

=head1 DESCRIPTION

Dynamics are bad in many circumstances. However, standardizing on
anything else defeats one of the key purposes of Perl: quick and easy
scripting. For fast scripts, lexical variables are a big burden.

B<RFC 106> makes a good attempt at trying to make lexical variables the
default, but unfortunately the only way to get them to work as flexibly
as dynamics is to essentially make them into dynamics, as the "liberal
approach" to scoping shows. For this reason, dynamics should remain the
default and users can explicitly declare lexicals if they so desire.
They could also use a pragma, such as C<use scope> (B<RFC 64>), to
change the default scoping rules.

One possibility that the author is willing to entertain is making
variables dynamic, yet only accessible within a given package. However,
Python, PHP, Tcl, and other languages have terrible, terrible problems
with stuff like this, so it would have to be implemented B<extremely>
carefully. The fact that other languages are broken does not necessarily
mean that Perl's implementation would have to be, however.

=head1 IMPLEMENTATION

None. Things should stay the same.

=head1 MIGRATION

See above.

=head1 REFERENCES

RFC 106: Yet another lexical variable proposal: lexical variables made default without 
requiring strict 'vars'

RFC 16: Keep default Perl free of constraints such as warnings and strict.

RFC 28: Perl should stay Perl.

RFC 64: New pragma 'scope' to change Perl's default scoping

RFC 6: Lexical variables made default

Reply via email to