Mark S. Miller (2015-01-28T14:53:57.000Z)
On Wed, Jan 28, 2015 at 5:44 AM, Andreas Rossberg <rossberg at google.com>
wrote:

> On 28 January 2015 at 13:14, Claude Pache <claude.pache at gmail.com> wrote:
>
>> To me, "finite" is just to be taken in the common mathematical sense of
>> the term; in particular you could have theoretically a string of length
>> 10^10000. But yes, it would be reasonable to restrict oneself to strings of
>> length at most 2^52, so that `string.length` could always return an exact
>> answer.
>>
>
> To me it would be reasonable to restrict oneself to much shorter strings,
> since no existing machine has the memory to represent a string of length
> 2^52, nor will any in the foreseeable future. ;)
>

That's just four petabytes. If present trends...


>
> VMs can always run into out-of-memory conditions. In general, there is no
> way to predict those. Even strings with less then the hard-coded length
> limit might cause you to go OOM. So providing reflection on a constant like
> that might do little but giving a false sense of safety.
>

Yes, OOM is always possible earlier and we can't set any limits on that. I
agree that we shouldn't provide anything like String.MAX_LENGTH. But I also
don't see how we could pleasantly support strings above 2^53. Array indexes
are limited to 2^31 or so, and many integer operations truncate to that
(<<,|), and strings support [] indexing, so it may make sense to agree on
one of those as an *upper bound* -- you may not support strings longer than
that.


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150128/3cb87824/attachment.html>
d at domenic.me (2015-02-13T23:29:57.078Z)
On Wed, Jan 28, 2015 at 5:44 AM, Andreas Rossberg <rossberg at google.com> wrote:

> To me it would be reasonable to restrict oneself to much shorter strings,
> since no existing machine has the memory to represent a string of length
> 2^52, nor will any in the foreseeable future. ;)

That's just four petabytes. If present trends...


> VMs can always run into out-of-memory conditions. In general, there is no
> way to predict those. Even strings with less then the hard-coded length
> limit might cause you to go OOM. So providing reflection on a constant like
> that might do little but giving a false sense of safety.

Yes, OOM is always possible earlier and we can't set any limits on that. I
agree that we shouldn't provide anything like String.MAX_LENGTH. But I also
don't see how we could pleasantly support strings above 2^53. Array indexes
are limited to 2^31 or so, and many integer operations truncate to that
(<<,|), and strings support [] indexing, so it may make sense to agree on
one of those as an *upper bound* -- you may not support strings longer than
that.