Whither Tango?
Michel Fortin
michel.fortin at michelf.com
Sun Feb 21 04:10:56 PST 2010
On 2010-02-20 23:21:01 -0500, "Adam D. Ruppe" <destructionator at gmail.com> said:
> On Sat, Feb 20, 2010 at 09:11:32PM -0500, Michel Fortin wrote:
>> I'd say go with just "format". That'd make the fully qualified name is
>> "std.string.format", no need to repeat "string" a second time, even if
>> it's just an "s".
>
> There's already a format() function - it returns a dynamically allocated
> string for the result.
>
> The difference with sformat() is it takes a buffer in, instead of allocating
> its own. The only use for sformat that I can think of over regular format()
> is to boost performance in certain special cases; it wouldn't be used
> regularly.
Ah, I see. Normally, that'd be a great case for overloading, but format
being variadic and accepting any argument type makes this impractical.
I'd say "formatInBuffer" looks like a viable alternative. It's clear,
it's also longer but assuming its use is sparse a descriptive name
might be beneficial.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list