From: Eric Hodel Date: 2006-09-29T17:29:05+09:00 Subject: Re: "" vs '' On Sep 25, 2006, at 12:09 PM, Rich Morin wrote: > At 3:10 AM +0900 9/26/06, James Edward Gray II wrote: >> On Sep 25, 2006, at 12:03 PM, Rich Morin wrote: >> >>> Use '' by default: >>> >>> - It's less work for the interpreter. >> >> What makes you say this? > > If the interpreter sees a single-quoted string, it knows > that it doesn't need to scan the string for things (such > as escape sequences) to expand. I agree that this effect > will be lost in the noise, in most cases, but why make the > interpreter do extra work? Incorrect. For identical string contents the interpreter does the same amount of work. The parser may do less work, but you only parse once. $ parse_tree_show -f ["foo", 'foo', "#{foo}", '#{foo}'] [[:array, [:str, "foo"], [:str, "foo"], [:dstr, "", [:vcall, :foo]], [:str, "\#{foo}"]]] -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com