Is it called "Duck Typing" when Ruby figures out the variables as it goes along?

That totally rocks.  I only declare things as I need them in my scripts, and if my tests didn't run sequentially I would be totally screwed.  =)


On 01/09/06, Chris McMahon <[EMAIL PROTECTED]> wrote:

Perl forces you to understand scope of variables fairly early (unless you write bad Perl using package variables, not lexical variables, and don't use warnings and don't use strictures, in which case you can ignore everything that follows):  unless you declare variables' scope the first time the variable is used, the compiler gives you a warning.  Variables declared within a routine with "my $var" are available only to that routine; variables declared outside routines with "my $var" are available to all subroutines declared in that scope. 

Global variables are designated by "our", not "my".  "our $var" is available to all routines in the program. 

Managing this sometimes gets tricky.  One of the most popular Perl FAQs of all time is "Coping with Scoping":  http://perl.plover.com/FAQs/Namespaces.html

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to