On 10/9/14, 8:57 AM, Dicebot wrote:
On Thursday, 9 October 2014 at 15:32:06 UTC, Andrei Alexandrescu wrote:
Unfortunately it doesn't. RC does. Lazy computation relies on escaping
ranges all over the place (i.e. as fields inside structs implementing
the lazy computation). If there's no way to track those many tidbits,
resources cannot be reclaimed timely.

Are you trying to tell me programs I work with do not exist? :)

In all likelihood it's a small misunderstanding.

Usage of output range is simply a generalization of out array parameter
used in both Tango and our code. It is _already_ proved to work for our
cases.

Got it. Output ranges work great with unstructured/linear outputs - preallocate an array, fill it with stuff, all's nice save for the occasional reallocation when things don't fit etc.

With structured outputs there are a lot more issues to address: one can think of a JSONObject as an output range with put() but that's only moving the real issues around. How would the JSONObject allocate memory internally, give it out to its own users, and dispose of it timely, all in good safety?

That's why JSON tokenization is relatively easy to do lazily/with output ranges, but full-blown parsing becomes a different proposition.


Andrei

Reply via email to