Whither SmallScript? (was Re: Integer micro-benchmarks)
Frank Mitchell
frankm at bayarea.net
Tue May 1 06:43:05 EDT 2001
phil hunt wrote:
>
> On Mon, 30 Apr 2001 14:38:10 -0000, Andrew Hunt <andy at toolshed.com> wrote:
> > The @-prefix on instance variables [in Ruby] might,
>
> Yuk. It's $one $of $the $things $I $dislike $about $Perl.
The '@' and '$' prefixes indicate instance variables and global
variables, respectively. This differes from Perl in that:
1. The prefixes indicate scope, not type. (I still get weirded out that
in Perl it's %myhash but $myhash{key} ...)
2. The ugly line-noise aspect discourages you from using globals, and
from using raw instance variables instead of accessor methods. (In Ruby
you can define ivars and their accessors without using the @ at all.)
Globals are a big OO no-no, and generally you want only one routine
modifying an instance variable, and ideally only one routine accessing
it directly. So it all works out, kinda ...
--
Frank Mitchell (frankm at bayarea.net)
More information about the Python-list
mailing list