🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.modula2
1 messages
1 total messages Started by afd Mon, 02 Feb 1987 17:05
one pass, ADT initialization problems.
#3594
Author: afd
Date: Mon, 02 Feb 1987 17:05
28 lines
1991 bytes
(* This is reposted; my apologies to anyone who receives this twice. *)

   First, I recall from some time ago a discussion on forward references 
   in a one pass Modula-2 compiler being impossible.  Last semester we
   implemented Aho, Sethi, and Ullman's unification algorithm with type 
   variables (pg. 366, 376) and it worked quite well.  I see no problem in
   implementing forward references for types or procedures in a one pass
   Modula-2 compiler.

   Second, concerns the initialization problems with Modula-2 ADTs.
   When a procedure is called with an uninitialized ADT, a test for
   undefined is impossible, and a simple test for nil is obviously
   insufficient.  One solution is to maintain a list of pointers
   to initialized variables of an opaquely exported type.  A simple test 
   at the beginning of each procedure which accesses that type could
   generate an error message or provide automatic initialization.  One
   problem with this solution is Modula-2's inability to control assignment
   of ADTs.  Declaring ADT's as pointers to headers, and keeping a list of
   pointers to these headers would help, but I'm hoping someone will post
   a better solution (if anyone sees problems with this approach, please 
   let me know too). 

   Also, does anyone know of a method to provide automatic cleanup upon 
   termination of an ADT's environment?

				     Bob Hathaway
				     afd@k.cc.purdue.edu
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