Hi, Background Studying Oberon.Mail.Mod in ETH Oberon and use of Streams therein. I wondered about the purpose and necessity of the Streams module. Didn't find an explanation in Oberon. The comment in A2 is helpful. MODULE Streams; (** AUTHOR "pjm/be"; PURPOSE "I/O buffering and formatted writing and reading"; *) In Oberon.Mail.Mod ... PROCEDURE AddMsgHead(pos: SIGNED32); ... S := Streams.OpenFileReader(msgsF, pos); That opens the messages file, msgsF. Appears that the file is not closed before "END AddMsgHead". Is that good practice? Shouldn't msgsF be closed by the end of the procedure? Opening the msgsF at each reading of the head of a message seems inefficient. Why not open the file when the module is loaded? Then set the rider when necessary. Ref. https://svn.inf.ethz.ch/svn/lecturers/a2/trunk/source/ userid infsvnh.anonymous password anonymous TIA, ... P. -- VoIP: +1 604 670 0140 Bcc: peter at easthope. ca
I was just wishing for streams in Project Oberon so this is timely for me. I observe that the AOS/A2/Bluebottle Oberon code appears self contained (relying only on SYSTEM) and well-factored but it does use A2 OBJECT definitions to implement the stream functionality. I wonder how much trouble it would be to convert those OBJECTS with PROCEDURES into RECORDS containing PROCEDURE variables. Best Regards, Chuck On Thu, Apr 22, 2021 at 8:36 AM <peter@easthope.ca> wrote:
Hi,
Background Studying Oberon.Mail.Mod in ETH Oberon and use of Streams therein.
I wondered about the purpose and necessity of the Streams module. Didn't find an explanation in Oberon. The comment in A2 is helpful.
MODULE Streams; (** AUTHOR "pjm/be"; PURPOSE "I/O buffering and formatted writing and reading"; *)
In Oberon.Mail.Mod ... PROCEDURE AddMsgHead(pos: SIGNED32); ... S := Streams.OpenFileReader(msgsF, pos);
That opens the messages file, msgsF. Appears that the file is not closed before "END AddMsgHead".
Is that good practice? Shouldn't msgsF be closed by the end of the procedure?
Opening the msgsF at each reading of the head of a message seems inefficient. Why not open the file when the module is loaded? Then set the rider when necessary.
Ref. https://svn.inf.ethz.ch/svn/lecturers/a2/trunk/source/ userid infsvnh.anonymous password anonymous
TIA, ... P.
-- VoIP: +1 604 670 0140 Bcc: peter at easthope. ca
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
participants (2)
-
Charles Perkins -
peter@easthope.ca