std.array.array broken?

Peter Alexander peter.alexander.au at gmail.com
Sun Feb 2 03:29:32 PST 2014


On Sunday, 2 February 2014 at 01:03:25 UTC, Andrei Alexandrescu 
wrote:
> On 2/1/14, 3:07 PM, Andrej Mitrovic wrote:
>> In reference to this thread:
>> http://forum.dlang.org/thread/ouyuujnzzvfkvxbfzyak@forum.dlang.org#post-ouyuujnzzvfkvxbfzyak:40forum.dlang.org
>>
>>
>> Personally I think it was a mistake providing unsafe APIs by 
>> default. If
>> I would have had it my way, I would introduce:
>>
>> byLine -> safe, doesn't reuse a buffer
>> byLineBuffer -> reuses a buffer
>
> No. Too much breakage.
>
> Andrei

Agreed.

I wonder if the problem can be fixed another way:

1. Introduce a new function ("File.lines" perhaps) which is like 
byLine, but safe, and has an option to re-use a buffer (but isn't 
default).
2. After a while, remove documentation for byLine, but leave it 
in Phobos.

This way, newcomers will never see byLine and will get safe 
behaviour by default with "lines", and existing code will 
continue to work using the undocumented byLine.


More information about the Digitalmars-d mailing list