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

From: "Conrad Schneiker" <schneiker@...>
Date: 2000-03-18 07:16:37 UTC
List: ruby-talk #2003
From: Yukihiro Matsumoto <matz@netlab.co.jp>

> In message "[ruby-talk:01954] Re: Ruby Syntax similar to other languages?"
>     on 00/03/17, "Conrad Schneiker" <schneiker@jump.net> writes:
>
> |This is one place where I would very much prefer a vi/sed/perl scheme!
> |
> |Is it possible to add something (standard) so that we could do:
> |
> |foo.s
> |foo.s!
> |
> |with an optional extra parameter string for perl-ish modifier characters
> |such as "g"?
>
> 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.

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.

Conrad

In This Thread