Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!nysernic!rpicsb8!csv.rpi.edu!hiebeler From: hiebeler@csv.rpi.edu (David Hiebeler) Newsgroups: comp.lang.modula2 Subject: Re: some questions about modula2 Message-ID: <15@rpicsb8> Date: Thu, 13-Aug-87 17:52:00 EDT Article-I.D.: rpicsb8.15 Posted: Thu Aug 13 17:52:00 1987 Date-Received: Sat, 15-Aug-87 10:31:01 EDT Sender: nobody@rpicsb8 Reply-To: hiebeler@csv.rpi.edu (David Hiebeler) Organization: RPI CS Dept, Troy, New York Lines: 36 Keywords: modula2, type, vars 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!"