[#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:02010] Re: Ruby Syntax similar to other languages?

From: matz@... (Yukihiro Matsumoto)
Date: 2000-03-18 16:23:24 UTC
List: ruby-talk #2010
Hi,

In message "[ruby-talk:02003] Re: Ruby Syntax similar to other languages?"
    on 00/03/18, "Conrad Schneiker" <schneiker@jump.net> writes:

|> What's the benefit of foo.s(/pat/, "repl", "g") over foo.gsub(/pat/,
|"repl")?
|
|In vi, sed, and perl, you don't thing of sub and gsub as being two different
|methods, but rather as a single method that is modulated by optional
|parameters--including g, i, s, m, o, e, and x in perl (IIRC), which I
|wouldn't want to see replaced by individual methods, since I (currently)
|think it is much more natural to regard all of these things as variations on
|a common theme.

Hmm, although I think options i, s, m, o, and x should belong to
regexp, I can understand your opinion.

|Since I also use vi (actually gvim, a vastly improved GUI-based extension of
|vi) all the time and have used perl a lot in the past, "s" seems like the
|simplest and most natural name for what also seems to be most naturally
|regarded as a single method. Actually, since awk always seemed awkward to me
|even before I discovered perl, maybe I should say that because I think "s"
|this is a more natural way to think of substitution, I happened to like the
|way that vi and perl do it.

Hmm, are you proposing new syntax to do that?

A method like Clemens suggested in [ruby-talk:01962] can be added
relatively easily, but introducing syntax like s/RE/STR/ is another
story, which I can hardly accept.

							matz.

In This Thread