🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.modula2
1 messages
1 total messages Started by David Hiebeler Thu, 13 Aug 1987 21:52
Re: some questions about modula2
#3738
Author: David Hiebeler
Date: Thu, 13 Aug 1987 21:52
39 lines
2106 bytes
References:


I will answer what I can in no order whatsoever.
4.  Exported procedures may reference variables which are 'hidden' in that
module, i.e. not exported.  I have a random # generator with a procedure
which looks something like this.
PROCEDURE Rndom():CARDINAL;
(* Return a CARDINAL between 0 and 999 *)
BEGIN
  Seed := sqrt(Seed);
  IF Seed<10 THEN Seed := (Seed+2)*Seed*Seed*Seed (* keep Seed from *)
						   (* getting too small *)
  END; (* IF *)
  RETURN TRUNC((Seed-TRUNC(Seed))*1000) (* or something like that, I forget *)
				      (* to get the first 3 decimal places *)
END Rndom;
-- Note this will update the Seed, which is invisible to the calling
module.  (I also have a procedure InitSeed
PROCEDURE InitSeed(NewSeed:REAL);
BEGIN
  Seed := NewSeed;
  IF Seed<10 THEN Seed := (Seed+11)*(Seed+1)*(Seed+1)*(Seed+1)
  END;  (* IF *)                 (* or something like this *)
END InitSeed;


2.  (Was it 2?)  A definition module referencing a type declared in the
implementation module.  -- Why would you want to do this?  It must be
a 'hidden' type, or you would declare it to be exported in the definition
module.  The only reason you need mention it in the definition is if
say, a procedure needs a var of that type as a parameter, in which
case, the type would have to be exported anyways.

                             -D.H.
----
David Hiebeler       hiebeler@csv.rpi.edu
Chatham, NY         "Illusions, Richard!  Every
(also Troy, NY)      bit of it illusions!"
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads