[RFC] replaceInto
Dmitry Olshansky
dmitry.olsh at gmail.com
Tue Mar 6 11:28:45 PST 2012
On 05.03.2012 12:28, Jonathan M Davis wrote:
> On Monday, March 05, 2012 11:41:52 Dmitry Olshansky wrote:
>> Yes, by the looks of it there is plenty of places to apply this. One
>> thing that I'm unclear on is should it be overloads?
>> The problem is that e.g. the fact that replace either returns new array
>> or nothing depending on the arguments is kind of unexpected for the
>> reader. Not to mention that overload space was pretty crumbled, that's
>> why I ended up with replaceInto name.
>
> It may be that it makes sense as overloads in some cases and not in others.
> But in general, if the difference is
>
> string func(string, args)
>
> becomes something like
>
> void func(string, outputRange, args)
Ah, a matter of taste...
But in my mind I envision it as either:
void func(outputRange, string, args);
or
void func(string, args, outputRange);
The first one going (noticed after the fact) as analogy to C
fprintf/fscanf/sprintf/sscanf vs printf/scanf.
that at least makes it consistent across all functions.
>
> then an overload is probably good enough, since the difference is clear -
> assuming that the output range parameter doesn't cause an ambiguities that is.
That's the hard part, the ambiguities. As implementation of functions
uses appender internally almost everywhere.
> But it's probably a case-by-case thing.
>
> - Jonathan M Davis
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list