OutputRange should be infinite?

Dmitry Olshansky dmitry.olsh at gmail.com
Sat Oct 6 01:39:04 PDT 2012


On 06-Oct-12 12:13, monarch_dodra wrote:
> On Saturday, 6 October 2012 at 08:00:42 UTC, Johannes Pfau wrote:
>> Am Fri, 05 Oct 2012 17:15:44 +0200
>> schrieb "monarch_dodra" <monarchdodra at gmail.com>:
>>
>>> [SNIP]
>>
>> Couldn't we just fix std.range.put to check for an 'empty' property?
>
> Well, the issue (imo) is not put's implementation: as Steven
> Schveighoffer said, cramming too big into too small is wrong (logic error).
>
> The problem (I think), is that once a range verifies the isOutputRange
> criteria, the user should be able to call "put" without (too much) worries.

Not possible. The only thing isOutputRange serves is that putting stuff 
into X is sensible in one of many ways (delegates, own put, input range 
with assignable elements).
Any run-time properties such as lengths and maximums are out of 
isOutputRange business. And in the end one can still run out of 
supposedly "infinite" things like RAM, disk space etc.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list