Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!pa.dec.com!src.dec.com!gnelson From: gnelson (Greg Nelson) Newsgroups: comp.lang.modula3 Subject: Re: Instance initialization in Modula-3? Message-ID: <9101242209.AA14639@jumbo.pa.dec.com> Date: 24 Jan 91 22:08:55 GMT Lines: 16 In-Reply-To: Message of 23 Jan 91 22:11:59 from janssen@parc.xerox.com (Bill Janssen) To: janssen@parc.xerox.com (Bill Janssen) Cc: m3 X-Folder-Carbon: sent The convention used in Trestle (the Modula-3 window toolkit) is that each object type has an "init" method that returns the object after initializing it. So you can type VAR v := NEW(T).init(args) to allocate and initialize an object of type T. If T has a supertype S, and S uses the same convention, then T.init typically contains the call EVAL(S.init(self)), to initialize the supertype. This style won't work with SRC Modula-3 1.6, which doesn't let you NEW an opaque type; but it will work soon. There is more discussion about this issue in the "twelve changes to Modula-3" message. Greg