From: Dave Thomas Date: 2008-12-20T06:30:10+09:00 Subject: [ruby-core:20707] Re: [Feature #905] Add String.new(fixnum) to preallocate large buffer On Dec 19, 2008, at 12:48 PM, Charles Oliver Nutter wrote: > Neither of those methods are polymorphic on anything. They're both > new methods that accept a Fixnum. .new is String.buffer is not a meaningful name for a constructor, in my opinion, whereas String.new has a pedigree. By adding a initial_size: n optional argument, you exactly express the meaning�you're asking for an initial allocation when String.new executes. Similarly, Array.new([1,2,3], initial_size: 100) lets you both initialize and allocation a new array. Right now, we have File.open("fred", "w"), rather than File.open_write("fred"). It seems like a good idea, particularly for an interface that's likely to grow over time (I can forsee String.new(initial_size: 1000, fill_with: " ", encoding: binary, etc: ...) Cheers Dave