On Wed, 2002-07-10 at 06:29, David Alan Black wrote:
> I'm not sure what the disadvantage of allowing a string argument is.
> It's not mandatory -- you can always use a regex (or even
> Regexp.new(s) :-)  -- so allowing strings (without auto-conversion to
> regex) doesn't take away any functionality.

and, if implemented without regexps, could easily boost performance,
which IMHO is an important bonus considering speed is probably the
primary site against ruby in comparison to perl and python.

~transami


On Wed, 2002-07-10 at 06:29, David Alan Black wrote:
> Hi --
> 
> On Wed, 10 Jul 2002, Stepan Kasal wrote:
> 
> > Hallo,
> >
> > On Wed, 10 Jul 2002 09:01:11 GMT, Yukihiro Matsumoto <matz / ruby-lang.org> wrote:
> > >   Regexp.new_const(s) = Regexp.new(Regexp.quote(s))
> >
> > I've forgotten about this, sorry.
> >
> > So I vote for a-c, with an error message saying something like
> >
> > "use either Regexp.new(s) or Regexp.new(Regexp.quote(s)) to clarify"
> 
> Quick reminder, for reference :-)
> 
>   sub/gsub
> 
>    (a) prohibit string pattern
>    (b) string patterns as strings, without converting into regex.
> 
>   split
> 
>    (c) prohibit string pattern longer than 1.
>    (d) string patterns as strings, without converting into regex.
> 
> > How many times do people use "error.log" or "error\.log" instead of
> > "error\\.log" or /error\.log/ ?
> 
> Well... something a lot like that is what started this thread :-)
> It's partly a matter of documentation stating that String#split takes
> a string or a regex, without (anywhere I've seen) noting that the
> string has to be only one character long or else has to follow regex
> syntax (because it's really a regex).
> 
> I'm not sure what the disadvantage of allowing a string argument is.
> It's not mandatory -- you can always use a regex (or even
> Regexp.new(s) :-)  -- so allowing strings (without auto-conversion to
> regex) doesn't take away any functionality.
> 
> 
> David
> 
> -- 
> David Alan Black
> home: dblack / candle.superlink.net
> work: blackdav / shu.edu
> Web:  http://pirate.shu.edu/~blackdav
> 
> 
-- 
~transami

"They that can give up essential liberty to obtain a little
 temporary safety deserve neither liberty nor safety."
	-- Benjamin Franklin