[% setvar title Global dynamic variables should remain the default %]
Note: these documents may be out of date. Do not use as reference! |
To see what is currently happening visit http://www.perl6.org/
Global dynamic variables should remain the default
Maintainer: Nathan Wiger <nate@wiger.org> Date: 28 Sep 2000 Last Modified: 30 Sep 2000 Mailing List: perl6-language-strict@perl.org Number: 330 Version: 2 Status: Frozen
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 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.
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.
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 use scope
(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 extremely carefully. The fact that other languages are broken does not necessarily mean that Perl's implementation would have to be, however.
None. Things should stay the same.
See above.
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