From: Calamitas Date: 2006-09-05T00:00:10+09:00 Subject: Re: Literal inconsistency On 9/4/06, Christian Neukirchen wrote: > I don't see the inconsistency. Regexps are immutable anyway, so this > optimization is useful. You probably wanted Regexp.new("hello")? Well, immutable is relative: 2.times do a = /hello/ puts a.instance_eval { @a } a.instance_eval { @a = 5 } end This prints nil, then 5. So only part of a regexp is really immutable. Also, note that Regexp.new("hello") compiles the regexp on each execution. Regexp.new(/hello/) probably doesn't, so that would work. Anyway, I agree there is a work-around, and inconsistent is relative too. It just bit me unexpectedly, and it seemed inconsistent to me. Peter