Liste des Groupes | Revenir à cl prolog |
Hi,
Java had a grace period where it still supported
sharing through a command line option, but later
it was ditched completely:
Restriction: This system property is supported only on Java™ 8. String sharing cannot be enabled on Java 11 and later.
Start of content that applies only to Java 8 (LTS) Setting this property to true avoids sharing a String object when substring() is used to subset a String beginning from offset zero. Avoiding sharing is compatible with the Oracle HotSpot VM.
https://www.ibm.com/docs/en/sdk-java-technology/8?topic=options-djavalangstringsubstringnocopy Unfortunately I don't find a document detailing
the decision. Like some JEP or so. Still searching.
With substring sharing it was very easy to provoke
an out of memory error. You could allocate large
strings. Share a UTF-16 character, i.e. substring of
length 1, in the middle of the string, and the string
was not garbage collected anymore. I do not exclude
that under the hood sharing could be used. But it
possibly needs to some compilation technique including
some dedicated analysis that determines that the parent
string stays reachable, so that the child sharing doesn't
make the parent string solely reachable, since
since the parent string is already reachable.
Bye
Mild Shock schrieb:Hi,
>
I do not exclude a turn-around possibility
for Scryer Prolog. But with errors like this,
that are at the core of some ideas behind
>
Scryer Prolog, like the glorious char based
double quoted lists, which have special data
structure support:
>
?- [X,Y] = [e,foo], Z is X.
X = e, Y = foo, Z = 2.718281828459045.
>
?- [X,Y] = [e,f], Z is X.
error(type_error(evaluable,e),(is)/2).
>
But I doubt that any such list/array ideas,
especially when they try to share subarrays
are even a good idea. Trealla Prolog tries
>
something similar. But initial Java had for
example a sharing substring() method. But they
abandoned that over the time. So their
>
strings are not sharing anymore, and code that
relied on sharing got broken. You can have
sharing through other interfaces, but Strings
>
are not anymore sharing. Any idea why?
>
Bye
Les messages affichés proviennent d'usenet.