[RFC] replaceInto

Jonathan M Davis jmdavisProg at gmx.com
Mon Mar 5 00:28:19 PST 2012


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)

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. 
But it's probably a case-by-case thing.

- Jonathan M Davis


More information about the Digitalmars-d mailing list