* Sam Roberts (Mar 15, 2005 13:00):
> > > My documentation for Regexp::quote(str) says that a copy of str is
> > > returned, yet if str doesn't contain any metacharacters, str itself
> > > is returned.

> > For efficiency, avoiding unnecessary copy is sought.  For
> > consistency, and safety (from in-place string modification), all
> > time copy is better.  I chose the former.  But I'm still open for
> > input.

> I think your choice is right. If people want to duplicate the string,
> they can do str.quote.copy, or something.

You mean Regexp.quote(str).dup

It's of course a problem having to decide whether the dup is necessary
or not.  What if there was a need for some quoting and the return-value
of Regexp::quote actually is freshly allocated?

> However, the docs are wrong, they strongly imply a new string will be
> returned.

Yes, this, at least, needs fixing.  I'm fine with the semantics of
Regexp::quote, just as long as the documentation agrees with it,
	nikolai

-- 
::: name: Nikolai Weibull    :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA    :: loc atm: Gothenburg, Sweden    :::
::: page: www.pcppopper.org  :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}