Path: bloom-beacon.mit.edu!hookup!swrinde!sdd.hp.com!decwrl!pa.dec.com!src.dec.com!src.dec.com!muller
From: Eric Muller <muller@src.dec.com>
Newsgroups: comp.lang.modula3,news.answers,comp.answers
Subject: Modula-3 Frequently Asked Questions (FAQ)
Followup-To: comp.lang.modula3
Date: 8 Apr 1994 15:42:38 GMT
Organization: DEC Systems Research Center
Lines: 562
Approved: news-answers-request@MIT.Edu
Expires: 15 May 1994 00:00:00 GMT
Message-ID: <2o3u1e$62j@src-news.pa.dec.com>
NNTP-Posting-Host: procope.pa.dec.com
Xref: bloom-beacon.mit.edu comp.lang.modula3:1049 news.answers:17832 comp.answers:4823

Archive-name: Modula-3-faq
Last-modified: Feb 3 1994


		 Modula-3 Frequently Asked Questions
		 ===================================


1. The language
	1.1 What is Modula-3?
	1.2 Is Modula-3 a superset of Modula-2?
2. The documentation
	2.1 Where can I get a description of Modula-3? 
	2.2 Where can I get other information on Modula-3?
3. The implementations
	3.1 Where can I get an implementation?
	3.2 What is SRC Modula-3?
	3.3 What is m3pc?
	3.4 What is GNU Modula-3?
4. Some specific questions
        4.1 Why is "Hello World" so large?
        4.2 Why objects and interfaces?
	4.3 What is the story with Trestle and OpenWindows?
        4.4 When is the next release of SRC Modula-3 ?
5. FTP
	5.1 What if I don't have ftp access?
6. Contributing
	6.1 Can I contribute Modula-3 software?




1.1. What is Modula-3?

   Modula-3 is a systems programming language that descends from Mesa,
   Modula-2, Cedar, and Modula-2+.  It also resembles its cousins
   Object Pascal, Oberon, and Euclid.

   The goal of Modula-3 is to be as simple and safe as it can be while
   meeting the needs of modern systems programmers.  Instead of
   exploring new features, we studied the features of the Modula
   family of languages that have proven themselves in practice and
   tried to simplify them into a harmonious language.  We found that
   most of the successful features were aimed at one of two main
   goals: greater robustness, and a simpler, more systematic type
   system.

   Modula-3 retains one of Modula-2's most successful features, the
   provision for explicit interfaces between modules.  It adds objects
   and classes, exception handling, garbage collection, lightweight
   processes (or threads), and the isolation of unsafe features.


1.2. Is Modula-3 a superset of Modula-2?

   No; valid Modula-2 programs are not valid Modula-3 programs.  However,
   there is a tool to help convert Modula-2 programs to Modula-3.


2.1. Where can I get a description of Modula-3? 
   
   The definition of Modula-3 is contained in:

        System Programming with Modula-3
        Edited by Greg Nelson
        Prentice Hall Series in Innovative Technology
        ISBN 0-13-590464-1
        L.C. QA76.66.S87 1991

   also known as SPwM3.  Here is the table of contents:

        1. Introduction
        2. Language Definition
        3. Standard Interfaces
        4. An Introduction to Programming with Threads
        5. Thread Synchronization: A Formal Specification
        6. I/O Streams: Abstract Types, Real Programs
        7. Trestle Window System Tutorial
        8. How the Language Got its Spots

   Chapters 2 and 3 have been reprinted in Sigplan Notices, Volume 27,
   Number 8, August 1992, pp 15-42.

   Sam Harbison has written a more tutorial book about Modula3:

        Modula-3
        Samuel P. Harbison
        Prentice Hall, 1992
        ISBN 0-13-596396-6

   The errata sheet is available via anonymous ftp from gatekeeper.dec.com 
   in pub/DEC/Modula-3/errata.


2.2. Where can I get other information on Modula-3?

   There is a Usenet newsgroup, comp.lang.modula3.  The archives of
   that group are available via anonymous ftp from gatekeeper.dec.com
   in pub/DEC/Modula-3/comp.lang.modula3.  If you do not have
   access to Usenet, there is a relay mailing list; send a message to
   m3-request@src.dec.com to be added to it.

   There are a couple high-level overview articles available:

       "Modula-3", Sam Harbison, Byte, Vol. 15, No. 12, November 1990,
       pp 385+.

       "Safe Programming with Modula-3", Sam Harbison, Dr. Dobb's Journal,
       Vol. 17, No. 10, October 1992, pp 88+.

   A description of the Modula-3 type system is in

       "The Modula-3 Type System", Luca Cardelli, Jim Donahue, Mick Jordan,
       Bill Kalsow, Greg Nelson, Conference Record of the Sixteenth Annual
       ACM Symposium on Principles of Programming Languages (POPL), Austin
       Texas, January 11-13 1989, pp 202-212.

   The Modula-3 treatment of floating-point values is described in

       "The Design of Floating-Point Data Types", David Goldberg,
       ACM Letters on Programming Languages and Systems (LOPLAS),
       June 1992, Vol 1, #2, pp 138-151

   The core library interfaces are described and indexed in

       "Some Useful Modula-3 Interfaces", Jim Horning, Bill Kalsow,
       Paul McJones, Greg Nelson, SRC Research Report 113.
       Available vi anonymous FTP from gatekeeper.dec.com in
       pub/DEC/SRC/research-reports/SRC-113.ps.Z 

   The Trestle window system toolkit, higher-level FormsVBT toolkit, and
   Zeus animation system available with Modula-3, are documented in the
   following reports:

       "Trestle Reference Manual", Mark S. Manasse and Greg Nelson,
       SRC Research Report 68, December 1991.

       "Trestle Tutorial", Mark S. Manasse and Greg Nelson, SRC Research
       Report 69, May 1, 1992.

       "VBTkit Reference Manual: A toolkit for Trestle", edited by
       Marc H. Brown and James R. Meehan.  (soon to be a SRC Research
       Report)  A draft version is available via anonymous FTP from
       gatekeeper.dec.com in pub/DEC/Modula-3/contrib/vbtkit.25Mar93.ps.Z.

       "The FormsVBT Reference Manual", Marc H. Brown and James R. Meehan,
       (soon to be a SRC Research Report).  A draft version is available
       via anonymous FTP from gatekeeper.dec.com in
       pub/DEC/Modula-3/contrib/formsvbt.25Mar93.ps.Z and
       pub/DEC/Modula-3/contrib/formsvbt.AppC.26Mar93.ps.Z.

       "Zeus: A System for Algorithm Animation and Multi-View Editing",
       Marc H. Brown, SRC Research Report 75, February 28, 1992.
       Available via anonymous FTP from gatekeeper.dec.com in
       pub/DEC/SRC/research-reports/SRC-075*.ps.Z.

       "Color and Sound in Algorithm Animation", Marc H. Brown and
       John Hershberger, SRC Research Report 76a, August 30, 1991.
       Available via anonymous FTP from gatekeeper.dec.com in
       pub/DEC/SRC/research-reports/SRC-076a*.ps.Z.

       "The 1992 SRC Algorithm Animation Festival", Marc H. Brown, 
       SRC Research Report 98, March 27, 1993.  Available via anonymous ftp
       from gatekeeper.dec.com in 
       pub/DEC/SRC/research-reports/SRC-098*.ps.Z.

   Hardcopy versions of these reports can be ordered by e-mail; send your
   request including a postal mail address to src-reports@src.dec.com.

   Sedgewick's classic text on computer algorithms is presented
   in Modula-3 in:

        Alogorithms in Modula-3
        Robert Sedgewick
        Addison-Wesley, 1993
        ISBN 0-201-53351-0

3.1. Where can I get an implementation?

   Two implementations are available, SRC Modula-3 and a
   PC version of it (m3pc).

   Apparently work on GNU Modula-3 has stopped.

   As far as we know, implementations are not available for VMS, Macintosh,
   or Alpha AXP/OSF.


3.2. What is SRC Modula-3?

   SRC Modula-3 was built by the DEC Systems Reseach Center
   and is available via anonymous ftp from gatekeeper.dec.com in
   pub/DEC/Modula-3/release.

   The current version, 2.11, implements the language defined in SPwM3.
   There are versions for the following machines:

        AIX386  IBM PC running AIX/PS2,
        AP3000  Apollo DN4500 running Domain/OS
        ARM     Acorn R260 running RISC iX 1.21
        DS3100  DECstation 3100 and 5000 running Ultrix 4.0 and 4.2
        HP300   HP 9000/300 running HP-UX 8.0
	HPPA    HP 700/800 running HP-UX 8.0
        IBMR2   IBM R6000 running AIX 3.1, 
        IBMRT   IBM RT running IBM/4.3, 
        NEXT    NeXT running ??
	OKI     Okidata 7300 (i860) running AT&T SVR4.0
        SPARC   SPARCstation running SunOS 4.1.x
        SUN3    SUN3 running SunOS
	SUN386  Sun 386i  running SunOS 4.0.1
        UMAX    Encore Multimax running UMAX 4.3 (R4.1.1)
        VAX     VAX running Ultrix 3.1

   SRC Modula-3 includes a user manual, compiler, runtime library,
   some libraries and a few other goodies (see below).

   The compiler generates C as an intermediate language and should be
   fairly easy to port.  Except for the very lowest levels of the
   thread implementation, the entire system is written in Modula-3.

3.3. What is m3pc?

   m3pc is available via anonymous ftp from gatekeeper.dec.com in
   pub/DEC/Modula-3/contrib/m3pc.

   ---------

   From: laszlo@post.ifi.uni-klu.ac.at (Prof.Dr.Laszlo BOESZOERMENYI)
   Subject: M3 pn PC

   The Modula-3 system ported by us on the PC and available on the
   gatekeeper, runs with MSDOS, gnu c compiler and djgpp memory
   manager (detailed description in the read me file).

   The first version was ported by Klaus Preschern. Carsten Weich rewrote
   the handling of long filenames for the second version.

   You may compile, link and run Modula-3 programs, without threads.
   From the library modules only those are tested which are used by
   the compiler.  We are using the actual version for our beginners-course
   and we are working on "student-friendly" programming environmnents and
   a simple windowing graphic-library.

   ---------

   From: carsten@post.ifi.uni-klu.ac.at (Carsten WEICH)
   Subject: New version of Modula-3/PC
   Date: 28 Jan 1994 13:25:28 GMT

   We have built a new version of Modula-3 running on a PC.
   You will need a PC:
     *  80486 or 80386 with floatingpoint-coprocessor,
     *  at least 4 but preferable 8 MByte of RAM,
     *  20 MByte discspace free at least.

   You can run a modified Modula-3 version 2.09 without thread-
   support. Our version features:
     *  support for Unix-like long filenames
     *  automatic compilation (to substitute the lack of m3make)
     *  library to access DOS-files and directories.

   We have built a little shell which translates the long filenames you
   type in into DOS-filenames. It has a unix-lookalike "ls"-command.
   There are commands to teach the system new long filenames.
   You can savely move such files around through DOS-directories
   (which was not possible with the first version).

   This version accesses DOS-files significantly faster than the first
   version. Especially linking large Modula-3 programs is much faster
   now. On a 50 MHz 80486 with 16 MByte of RAM we measured
   a turn-around time of 2 minutes for a 5 module, 500 lines program.
   If you want to compile only one module you will have to wait
   about one minute.

   The necessary files are available at "gatekeeper.dec.com" in
   /pub/DEC/Modula-3/contrib/m3pc:

	Install.txt	please read this first!
	djgpp.tar	the DJGPP-gnu-C-compiler
	m3.tar		compiler binaries
	m3src.tar	sources of the compiler (optional)
	tar.exe		program to unpack these files


3.4. What is GNU Modula-3?

   From: hudson@cs.umass.edu (Rick Hudson)
   Subject: Re: Where to start - GNU M3 status.
   Date: 02 Mar 1994 20:53:10 GMT

   I put in as much time as anyone on the GM3 project and have it wired up and
   sort of running on my desk well enough to do run experiments. Unfortunately,
   it is in no shape for prime time. No threads and 20% of the SRC libraries
   don't even compile. Work slowed in July due to me switching projects and
   pretty much halted when it became obvious that SRC was doing such a good job
   on their compiler.

   We are porting pieces of our backend and runtime into the SRC stuff but it
   is just for internal research use since that is all we really have time for.
   Cheers,

   ---------

   From: moss@cs.cmu.edu (Eliot Moss)
   Subject: GNU Modula-3 alpha release status
   Date: 25 Mar 93 17:53:12 GMT

   We said we'd try to get the initial (alpha) release of GNU
   Modula-3 out some time this month (March), and we're in the
   process of figuring out what to release and how to package it
   up. We expect to have something in roughly two weeks (watch
   this space for a notice).

   What would this be? First, it is a compiler for the VAX (only)
   under Ultrix (only), definitely without threads, and probably
   still failing a small number of the tests in the SRC test
   suite (which implies that not all of libm3 is likely to work
   either). The actual release information will detail more about
   what's working and what's not at that time. We DO currently
   pass all the compiler tests that the SRC compiler did when it
   was first released (i.e., the ones we fail are more obscure
   things that users uncovered over time).

   Second, the release itself will be a compressed tar file
   including sources and executables. The executables will
   probably work only if you put libraries, etc., in the expected
   places (otherwise, you'll need to rebuild from sources).The
   compiler is written in C and should be compiled with a recent
   version of gcc (so you'll need gcc installed). The system also
   uses gld (the GNU linker).

   This release should be most useful to people undertaking ports
   to other machines and operating systems, since it will give
   them a head start on understanding the compiler and getting
   the full system ready. It may be of some use for ordinary
   programming, but it really depends on whether you tend to use
   features that tickle the remaining bugs. We are indeed
   interested in alpha test reports, but only if they tell us
   something new (i.e., we'll provide a list of known
   deficiencies).

   When the release is made, we'll also start email discussions
   with the various parties who have indicated they might
   undertake ports, to help sort out who will do what.

   Regards, and thanks for your continued interest and
   encouragement -- EM

   ---------

   From: moss@cs.cmu.edu (Eliot Moss)
   Subject: GNU Modula-3 pre-release
   Date: Wed, 5 May 1993 23:49:33 GMT

   At long last, the GNU Modula-3 project has a pre-release ready, for
   the VAX/Ultrix platform ONLY. Various folks had notified us of
   their interest in doing ports or alpha testing, and they have
   already been sent email with particulars on how to obtain the tar
   file, etc. There are a number of known bugs; I'll see about making
   a list available by ftp or something, for interested parties.

   It is our opinion that the prerelease is not mature enough for
   general use, but we wished to give a head start to those folks
   attempting ports, and we will make periodic patches available. If
   you want to use this compiler for serious program development or
   need something solid with debugging support for classroom use, you
   should wait until we've fixed more of the problems. (But to give a
   sense of what we HAVE accomplished, as I recall, all but 3 of the
   SRC compiler tests compile (there are 137 of them).) We hope to do
   a more general release, and support more platforms, in the summer.

   If you're interested in helping and have not previously contacted
   us, please send email to me and/or Rick Hudson
   (hudson@cs.umass.edu).

   Thanks to Digital and SRC for supporting us, and to Rick Hudson, Amer Diwan,
   and Norm Walsh, the guys who do all the hard work!


4.1. Why is "Hello World" so large?

   Modula-3 programs are larger than C programs for the following reasons:

     1) The fixed runtime is substantially larger.  It contains a
        garbage collector, a thread runtime, and exception support.
        Note that "Hello World" is virtually all runtime.  For
        larger programs the runtime is not an issue.

     2) The generated code includes runtime checks for out-of-bound
        array references and NIL pointer.  Many of these checks could
        be removed by a better compiler.  The current compiler is
        only a research prototype.

     3) The compiler generates C code as its intermediate language
        consequently the final machine code suffers.  For example,
        the compiler is constantly storing single-precision floating
        point values into memory to get around C's predisposition
        for double precision.

4.2. Why objects and interfaces?

   Allan Heydon on comp.lang.modula3,  May 4th 1993:

   Modula-3 provides two separate mechanisms for data-hiding: one for 
   hiding details about how interfaces are implemented, and the other 
   for hiding details about how objects are implemented.

   The first data-hiding mechanism is realized by the distinction between 
   interfaces and modules. Clients can only import interfaces, so the 
   names declared in the modules implementing those interfaces are hidden 
   from clients. Note that this mechanism has only two levels; a name 
   is either declared in an interface, or it isn't. If a name is only 
   declared in a module, it can't be used by a client. 

   The second data-hiding mechanism is realized by opaque types and 
   revelations. A Modula-3 interface may declare an object type to be 
   opaque, in which case only a subset of the fields and methods of 
   that object are revealed to clients importing the interface. Furthermore, 
   the Modula-3 revelation mechanism allows a designer to reveal successively 
   more fields and methods of an object in a series of interfaces. The 
   fields and methods visible to a client then depends on which interfaces 
   the client imports. 

   The latter mechanism is quite flexible. As opposed to the interface/module 
   data-hiding mechanism, opaque types allow you to define an arbitrary 
   number of levels at which more and more information about the implementation 
   of your object is revealed. 

   See Sections 2.2.10, 2.4.6, and 2.4.7 of "Systems Programming with 
   Modula-3" for more information about opaque types and about partial 
   and complete revelations. 

4.3. What is the story with Trestle and OpenWindows?

   Mark Manasse says: 

   I think that the OpenWindows release should be enough (no need to 
   get the MIT X release], although there are a few things in Trestle
   that trigger devastating bugs in OpenWindows. But the only library
   we depend on is Xlib, R4 or later.

   The main thing I know that crashes OW 2.0 is the code where we call 
   GrabKey specifying AnyKey.  You can either loop over all of the 
   keys, or you can just comment out the call; programs won't run exactly 
   the same, but you probably won't notice the difference.


4.4 When is the next release of SRC Modula-3 ?

  The next release will be 3.1.  Here are some of the new things you will
  find in it:
  
  1. the compiler has a new internal interface between the front-end and
     the back-end, M3CG.  This interface is supposed to be easy to
     implement.
  
  2. the front-end can compute in the target arithmetic system; in particular
     it is possible to cross-compile to machines with larger integers than
     the host.
  
  3. one back-end has been implemented on top of gcc.  The implementation of
     M3CG interface generates the tree representation used internally in gcc.
     From the gcc point of view, this back-end looks like a new front-end.
     Using this back-end, we have cross-compiled solitaire for mips, alpha and
     386 processors; there is no reason to believe that there would be a
     problem for the other architectures supported by gcc.
  
  4. Dave Hanson wrote another implementation of the M3CG that is
     self-contained. He is currently working on the 386 code generation (he
     has done the mips code generation already).
  
  5. gdb has been modified to understand Modula-3 debugging information
     produced by the back-ends.  gdb can now parse Modula-3 expressions, print
     Modula-3 values and evaluate some of the Modula-3 built-in operations.
     There is also a little bit of support for multi-threaded programs (you
     can look at the stacks of other threads).
  
  6. there is a replacement for m3make, m3build, that does not rely on
     cpp/awk/sed/make and what not, and removes some of the limitations of
     m3make.  m3makefiles are very similar.
  
  7. libm3 has been significantly changed by the Interface Police, mostly in
     the area of OS interfaces and data structures.
  
  8. for the OS interfaces, we still have the U* interfaces, but applications
     are not supposed to use those.  Instead they should use a new set of
     interfaces that are os-independent; for example, there is a Pathname
     interface that manipulates file names; there is a Process interface that
     manipulate child processes.  These interfaces enabled a prototype port
     of the C based version to Windows NT machines.
  
  9. for the data structures, generics have been introduced and the various
     data structures are more consistent.
  
  10. because of 6 and 8, we can think about going to different os than Unix.
      In particular a Windows NT port will be available at some point (may not
      be in 3.0).
  
  11. the runtime has been improved quite a bit.
  
  12. new platforms: Alpha running OSF/1, 386 running Linux.  We will pay
      more attention to the porting instructions and support.
  
  13. I am not sure about all the changes in the libraries other than
      libm3.  I suspect that there will be few changes in trestle, but that
      mentor changed quite a bit. 
  
  14. The Windows NT port uses native threads.  This should be a good model
      for other implementations of Thread using native threads.

  The current status is:
  . the front-end is very stable
  . the gcc-based back-end has been stable for 4 months
  . the gdb extensions are brand new and need some test
  . the interface police work is very stable
  . we are working on bringing the system up on the machines we have in the
    building, and building the export machinery.
  
  We don't have a date for the 3.1 release.  Given the amount of changes
  introduced by 3.1, I suspect that the first few releases will not work out
  of the box for any machine but the ones for which we can test (decstations
  [mips and alpha], linux).  Consequently, I expect a high rate of releases
  for a while.  We will try to post accurate information about the status of
  each machine, but we can only rely what you tell us.
  
  At this point, I would not encourage anybody to start a new port.  If you
  have a new port, or are close to complete one, you can send us your bits,
  we will try to put them in 3.1.
  
  
5.1. What if I don't have ftp access?
  
   Unfortunately, we cannot deliver Modula-3 other than by 
   anonymous ftp.  

   Fortunately, Prime Time Freeware (PTF) includes Modula-3.  PTF is
   a set of two ISO-9660 CDroms filled with 3GB of freeware, issued
   semi-annually.  The latest issue, Volume 1, Number 2, July 1992,
   contains SRC Modula-3 2.07.  PTF is distributed via bookstores and
   mail.  You can reach PTF using:

	Email:  ptf@cfcl.com
        Fax:    [1] (408) 738 2050
        Voice:  [1] (408) 738 4832
        Mail:   Prime Time Freeware
 	        415-112 N. Mary Ave., Suite 50
		Sunnyvale, CA 94086
	        USA

6.1. Can I contribute Modula-3 software?

   Certainly.  Send us what you are willing to share, be it programs,
   libraries or other things.  We'll put them in the distribution.

   Right now, the pub/DEC/Modula-3/contrib directory contains:

      m3rpc   an rpc system from Xerox Parc
      M2toM3  a translator from Modula-2 to Modula-3
      m3pc    an implementation of Modula-3 for PCs.
   
----
Eric.
