(Pierre Chambart)
Turn Stream.data into a GADT to ensure that streams built with the
Sbuffio constructor are char streams.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16470 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Pierre Chambart)
Stream used to modify blocks allocated as immutable. This Get rid of
most Obj module invocations in this module.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16469 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
As I learned the hard way, it is essentially impossible to get
a satisfying behavior in presence of a mix of updates, concatenations
and counts. The best thing to do is thus to not change anything
(a good way to preserve compatibility), and only fix the
Stream.of_string function to assume nothing of the count passed to the
[from] function.
I also modified the mli documentation of [Stream.from] to warn other
users of this potential pitfall.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13915 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
There is a bug in the way concatenating operations work when combined
with `Sgen`-defined stream (Stream.from, Stream.of_string): the
concatenation functions reset the `count` field to 0, which disturbs
the Sgen producer.
While the fix in the Scons case is easy (instead of 0, set
the count to `original_count - 1`), fixing the Sapp case is more
delicate (we can't predict the size of the prepended stream). Our
technique is to change the stored left-hand-side to not the stream
data only, but the whole stream, count included.
Once we detect the prepended stream was completely consumed, we can
then restore the count to its previous value, so that Sgen's function
can be provided correct count information. This required a change in
the internal `get_data` implementation.
Slazy-constructed streams have the exact same issue: we don't know
their count before forcin them. Again, `get_data` is changed to
dynamically update the count at forcing time.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12682 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
of the Slazy data constructor.
Affected files: stdlib/{stream.ml,.depend,Makefile}
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8893 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Implement with Obj.set_field instead of mutable to accept polymorphic empty
streams (worked before because of a bug in type checking).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@439 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02