Why does std.string.munch take a string ref?

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 11 14:10:40 PDT 2014


On Wednesday, 11 June 2014 at 21:07:18 UTC, w0rp wrote:
> On Wednesday, 11 June 2014 at 20:27:41 UTC, Sean Kelly wrote:
>> It's the only function in std.string that takes a string by 
>> ref instead of by value, and this screws up call chaining.  
>> What's the reason for this?
>
> munch modifies the string you give it.

Yes, but why does it do this when it could leave the string as-is 
and return a modified slice instead, like all the other routines 
in std.string?


More information about the Digitalmars-d mailing list