[ABE.pm] Ruby Q

Ricardo SIGNES rjbs-perl-abe at lists.manxome.org
Sun Apr 16 19:11:00 PDT 2006


* Faber Fedor <faber at linuxnj.com> [2006-04-16T22:02:24]
> I finally started playing with Ruby.  So far, so good.  However, in my
> readings, there's one important (IMO) thing I haven't come across: what
> is Ruby's equivalent to Perl's "my" declaration?  
> 
> I *really* hate creating variables by mistyping.

Tough luck.  Ruby's variables are created by assignment.  Using a symbol as
an rvalue in an expression before it's been assigned a value throws a
NameError, just like Python.  Ruby's scoping is more sane than Python's, but
you can still shoot your foot more easily than in Perl, with regard to
undeclared variables and typos.

I'm with you: it's one of the few places where, as a language, Perl 5 beats
Ruby.

-- 
rjbs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060416/fd194019/attachment.bin 


More information about the ABE-pm mailing list