Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!zen!ucbvax!hplabs!cae780!tektronix!oresoft!randy From: randy@oresoft.UUCP (Randy Bush) Newsgroups: comp.lang.modula2 Subject: Re: some questions about modula2 Message-ID: <57@oresoft.UUCP> Date: Mon, 17-Aug-87 20:52:18 EDT Article-I.D.: oresoft.57 Posted: Mon Aug 17 20:52:18 1987 Date-Received: Wed, 19-Aug-87 03:59:25 EDT References: <13951@topaz.rutgers.edu> Reply-To: randy@oresoft.UUCP (Randy Bush) Distribution: na Organization: Oregon Software, Portland OR Lines: 54 Keywords: modula2, type, vars In article <13951@topaz.rutgers.edu> dalal@topaz.rutgers.edu (Mukesh Dalal) writes: >1. Is the type checking based on name equivalence or structure >equivalence? Name equivalence. E.g. TYPE t = [0..42]; VAR a : t; b : [0..42]; PROCEDURE f ( VAR p : t ); BEGIN END f; f(a) (*legal*); f(b) (*illegal*); > More specifically, Is the following construct allowed: > Type > P= Record > ... > End; > Q = P; Yes, as the two types are IDENTICAL, as Q is of type P. >2. Can a global module export an item which it has imported? DEFINITION MODULE m; FROM Foo IMPORT Bar; EXPORT QUALIFIED Bar, (* is not legal*) Feen; (* is legal *) TYPE Feen = Bar; END m. >3. Can the definition of a global-module M refer to a type P which is >neither declared there (either as opaque or transparent) nor is >imported from some other module but is defined/imported in the >corresponding implementation module of M? No. >4. Is the following construct allowed: > > Definition: > procedure abc (..); > Implementation: > var x: ...; > procedure abc (...); > ... > x := ...; > end; > ... Yes. -- Randy Bush, Compiler Group, Oregon Software, Portland Oregon (503) 245-2202 uucp: ..!tektronix!oresoft!randy Telemail: RBush Fidonet: 1:105/6