[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01896] Ruby Syntax similar to other languages?

From: "David Douthitt" <DDouthitt@...>
Date: 2000-03-16 16:29:04 UTC
List: ruby-talk #1896
>>> <mengx@nielsenmedia.com> 03/16/00 10:16AM >>>
> I do not have problem with either of the spellings. But I always wonder 
> if Pythonic syntax 
> 
> def __init__
> 
> or 
> 
> def init   (I assume this syntax has been considered)
> 
> can be used as alternative to the current one
> since Ruby's tradition is to provide similar syntax to other
> languages in order to attract more users.
> 
> Thanks
> 
> -Ted

This leads into something I've noticed.  Perl follows this idea also; thus
as a veteran vi user (and sed user) it was nothing for me to adjust to

     foo = s/this/that/g;

but now with Ruby it seems this is

     foo.gsub!(/this/, "that")

what?  And if I don't want the "g" option, it's a completely different
function:

    foo.sub!(/this/, "that")

and if I don't want the original to be modified:

    foo.sub(/this/, "that")

Can someone explain why all this is?  There must be a method to this madness.... pun intended?

Enjoying my first OO scripting!

In This Thread

Prev Next