First let me say I much prefer developing in ruby that perl. Ive been
developing in both for about three months (maintaining old perl
scripts and doing new stuff in ruby).
I am however not totaly sure why ruby does not have something like
perls 'use strict'. It seems that use strict is safer and can help
you spot errors qucker. I also have to confess that I prefer strong
predefined typing for the same reason but understand this may not be
as OO.
Ruby's defaults are in some cases closer to "use strict" than perl's; for
instance, you can't accidentally create a global variable when you meant
to create a local variable. In other cases, the looseness is a central
theme of the language's design.
Duck typing is a philosophical choice; an option to remove it would be
ridiculous. It's like asking for a C variant where you can't address
memory using pointers.
-s
···
In message <32b873ff0707130654v26b3dcd2ycecd30c500276b0a@mail.gmail.com>, "Ben Edwards" writes:
I am however not totaly sure why ruby does not have something like
perls 'use strict'. It seems that use strict is safer and can help
you spot errors qucker. I also have to confess that I prefer strong
predefined typing for the same reason but understand this may not be
as OO.
The strict pragma does three things in Perl. Two of the items are to forbid the use of symbolic references and "barewords." Ruby doesn't support these features, so it's not an issue.
The other feature of the strict pragma is to avoid creating random global variables every time one is mentioned. In Ruby, globals look different from other variables (the leading $), so this is not really a problem. Local variables need to be assigned to before use, since that's Ruby's method of declaration. That solves the same problem the strict pragma handles for Perl.
James Edward Gray II
···
On Jul 13, 2007, at 8:54 AM, Ben Edwards wrote:
I am however not totaly sure why ruby does not have something like
perls 'use strict'.
On 7/13/07, Peter Seebach <seebs@seebs.net> wrote:
Duck typing is a philosophical choice; an option to remove it would be
ridiculous. It's like asking for a C variant where you can't address
memory using pointers.