std.range's put on arrays needs to change

Sebastiaan Koppe mail at skoppe.eu
Sun Jun 26 13:25:42 UTC 2022


On Sunday, 26 June 2022 at 12:35:10 UTC, Paul Backus wrote:
> On Sunday, 26 June 2022 at 05:10:50 UTC, H. S. Teoh wrote:
>> On Sun, Jun 26, 2022 at 04:21:46AM +0000, Paul Backus via 
>> Digitalmars-d wrote:
>>> IMO `put` should be changed in `std.v2` to either throw an 
>>> exception or return `false` when attempting to insert an 
>>> element into a full output range.
>>
>> Why the needlessly complex workaround? Just introduce a .full 
>> method, the natural analogue of .empty for output ranges.
>
> How would you implement .full for, say, an output range that 
> writes to a file?

Yes, or a concurrent one.


More information about the Digitalmars-d mailing list