[Oberon] *****SPAM***** Re (2): Resetting a file rider without creating a new stream.

strohm at airmail.net strohm at airmail.net
Sun Apr 25 14:53:00 CEST 2021


There is another way to consider this.

A Stream has certain semantics.  It sources data items and it sinks data items.  That's all.  It doesn't store, it doesn't reposition, it doesn't read back what was previously written.

Those are not the semantics you want.

You appear to want File-like semantics.  In Oberon, a File is a random-access memory-like object.  It stores data objects, it repositions, it allows previously-written data objects to be read back.  It may or may not persist across multiple power cycles, depending on whether its name was registered with the filesystem.  (If it wasn't so registered, it will be garbage-collected at some time in the future.)

Where you are encountering difficulty is the conflict between Stream semantics and File-like semantics.


On Sat, 24 Apr 2021 11:30:50 -0700, peter at easthope.ca wrote:

From: strohm at ...mail.net
Date: Sat, 24 Apr 2021 00:52:13 -0400
> Assuming you're talking about Ulm's Streams module, described at
> http://www.mathematik.uni-ulm.de/oberon/0.5/lib/man/Streams.html, it looks like
> you want the third line to be something along the lines of:
> =C2=A0 =C2=A0 Streams.Seek(strm, msgs[no].pos, Streams.fromStart);

Thanks. That makes perfect sense.

ETH Oberon and the A2O here. Streams lacks a Seek procedure.

One further oddity: this Oberon has the procedure name OpenFileWriter
but returns a stream rather than a FileStream.

(** Opens a stream writing on file F starting at postion pos. *)
PROCEDURE OpenFileWriter*(F: Files.File; pos: SIGNED32): Stream;

Why not make it return a FileStream rather than a Stream? That would
allow changing the rider.

Thx, ... P. L.

VoIP: +1 604 670 0140 Bcc: peter at easthope. ca

Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20210425/cf440bc0/attachment.html>

More information about the Oberon mailing list