home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Information / Languages / Oberon / Oberon-FAQ⁄language < prev    next >
Encoding:
Text File  |  1994-12-03  |  11.6 KB  |  304 lines  |  [TEXT/R*ch]

  1. Newsgroups: comp.lang.oberon,comp.answers,news.answers
  2. Path: bloom-beacon.mit.edu!grapevine.lcs.mit.edu!olivea!charnel.ecst.csuchico.edu!psgrain!m2xenix!mikeg
  3. From: mikeg@psg.com (Mike Gallo)
  4. Subject: Comp.lang.oberon FAQ (monthly) 2/3
  5. Expires: Tue, 11 Oct 1994 00:00:00 GMT
  6. Reply-To: mikeg@psg.com
  7. Organization: PSGnet, Portland Oregon US
  8. Date: Mon, 12 Sep 1994 05:33:50 GMT
  9. Approved: news-answers-request@MIT.Edu
  10. Message-ID: <1994Sep12.053350.13532@psg.com>
  11. Followup-To: comp.lang.oberon
  12. Summary: This posting contains a list of Frequently Asked Questions (and their answers) about Oberon.  It should be read before posting to the Comp.lang.oberon newsgroup.
  13. Lines: 288
  14. Xref: bloom-beacon.mit.edu comp.lang.oberon:2871 comp.answers:7202 news.answers:25502
  15.  
  16. Archive-name: Oberon-FAQ/language
  17.  
  18. (*  * *  * *  * *  * *  * *  * *  * *  * *  * *  * *  * *  * *  * *  *)
  19.  
  20. Many FAQ lists, including this one, are available by anonymous ftp from
  21. rtfm.mit.edu in the /pub/usenet/news.answers directory.
  22.  
  23. Although I have aimed for accuracy, there is no guarantee that the
  24. information in this document is error-free.  Neither the FAQ maintainer nor
  25. anyone else associated with this document assume any liability for the
  26. content or use of this document.  If you find any errors, please report them
  27. to the address below.
  28.  
  29. Thanks to all who have contributed!  Further additions, corrections, and
  30. suggestions are welcome.
  31.  
  32. mikeg@psg.com
  33.  
  34. (*  * *  * *  * *  * *  * *  * *  * *  * *  * *  * *  * *  * *  * *  *)
  35.  
  36. Comp.lang.oberon Frequently Asked Questions: The Programming Language
  37.  
  38. Copyright 1994 Michael Gallo
  39. (c) 1994 Michael Gallo
  40.  
  41.  
  42. This is one of three documents that attempt to answer some frequently asked
  43. questions (FAQs) about Oberon.  This text concerns the Oberon languages,
  44. while the other two are about general topics and about Oberon the operating
  45. system.
  46.  
  47.  
  48. THE PROGRAMMING LANGUAGE OBERON 
  49.  
  50. >From "From Modula to Oberon"
  51.     The programming language Oberon is the result of aconcentrated effort to
  52. increase the power of Modula-2 andsimultaneously to reduce its complexity.
  53. Several features were eliminated, and a few were added in order to increase
  54. the expressive power and flexibility of the language. This paper describes
  55. and motivates the changes. The language is defined in a concise report.
  56.     Whereas modern languages, such as Modula, support the notion of
  57. extensibility in the procedural realm, the notion is less well established in
  58. the domain of data types. In particular, Modula does not allow the definition
  59. of new data types as extensions of other, programmer-defined types in an
  60. adequate manner. An additional feature was called for, thereby giving rise to
  61. an extension of Modula.
  62.     The evolution of a new language that is smaller, yet more powerful than its
  63. ancestor is contrary to common practices and trends, but has inestimable
  64. advantages. Apart from simpler compilers, it results in a concise defining
  65. document, an indispensable prerequisite for any tool that must serve in the
  66. construction of sophisticated and reliable systems.
  67.  
  68. Among the eliminations in the move from Modula-2 to Oberon are variant
  69. records, opaque types, enumeration types, subrange types, the basic type
  70. CARDINAL, local modules, and Modula's WITH statement.  The major addition to
  71. Oberon is the concept of type extension (i.e., single inheritance) for
  72. records.
  73.  
  74.  
  75. OBJECT ORIENTED PROGRAMMING IN OBERON
  76.  
  77. Oberon does not offer multiple inheritance.  However, it has been shown that
  78. multiple inheritance can be efficiently implemented in terms of single
  79. inheritance and been argued that MI is therefore syntactic sugar that is
  80. rarely used in practice.  For details, see Templ (1993) and Mssenbck
  81. (1993). 
  82.  
  83. The original Oberon language does not offer built in "methods" as do many
  84. other languages supporting OOP.  Instead, conventional virtual methods can
  85. easily be implemented as a pointer to a procedure table, or "messages" can be
  86. sent to procedures as extensible records.  
  87.  
  88. While some people complain about Oberon's minimalistic support of object
  89. oriented programming, others feel that this is one of Oberon's strengths,
  90. that the language does not institutionalize aparticular approach to OOP (see
  91. the Comp.object FAQ list for an examination of several variations on the
  92. object oriented paradigm).  For another discussion, see Oberon2.OOP by H.
  93. Mssenbck.  
  94.  
  95.  
  96. THE PROGRAMMING LANGUAGE OBERON-2
  97.  
  98. >From "Differences between Oberon and Oberon-2"
  99.     Oberon-2 is a true extension of Oberon. . . .
  100.     One important goal for Oberon-2 was to make object oriented programming
  101. easier without sacrificing the conceptual simplicity of Oberon. After three
  102. years of using Oberon and its experimental offspring Object Oberon we merged
  103. our experiences into a single refined version of Oberon.
  104.     The new features of Oberon-2 are type-bound procedures [i.e., virtual
  105. methods], read-only export of variables and record fields, open arrays as
  106. pointer base types, and a with statement with variants. The for statement is
  107. reintroduced after having been eliminated in the step from Modula-2 to
  108. Oberon.
  109.  
  110.  
  111. THE "OBERON FAMILY" OF LANGUAGES
  112.  
  113. Mona is an experimental dialect (but not a superset) of Oberon which provides
  114. recursive data types (trees) as a first class data-structure.  It attempts to
  115. reduce reliance on pointers and to offer a faster alternative to automatic
  116. garbage collection.  For details, see ETH technical report 102.
  117.  
  118. Oberon-V is an experimental dialect (but not a superset) of Oberon.  It is
  119. concerned with issues of numerical computing, array processing, and code
  120. verification.  It's primary new features are the ALL statement (much like a
  121. parallel version of the FOR loop) and array constructors for open array
  122. parameters.  Since it was originally aimed at vector architectures in general
  123. and the Cray Y-MP in particular, no Oberon-V compiler has been implemented
  124. for the Oberon System.  For details, see Griesemer (1993).
  125.  
  126.  
  127. COMMON PROBLEMS PROGRAMMING IN OBERON
  128.  
  129. On numerical programming:
  130.  
  131. whitney@christie.Meakins.McGill.CA (Whitney de Vries) writes:
  132.     The gist of the situation is that numeric expressions [can be] too complex
  133. for the backend of the Oberon for Windows compiler. . . .  Complex
  134. expressions ( particularly those with floating point operations ) quickly
  135. exhausts the short supply of registers on the Intel chips. At this point it
  136. is worth noting that the ETH supports Oberon for Windows but does not
  137. consider the Intel chips to be an intresting research topic ( the answer to
  138. the Intel problem is to have more registers ).  I think it is unlikely that
  139. Intel compiler will ever be as robust as the POWERoberon compiler.
  140.     At any rate you will probably get your code to work if you simplify the
  141. expressions.
  142. (* Before *)
  143.     VAR node : Node;
  144.     BEGIN
  145.         node.elem[x*5,y*2] := 1.0;
  146. (* After *)
  147.     VAR node : Node; elem : Element; x0, y0 : INTEGER;
  148.     BEGIN
  149.         elem := node.elem;
  150.         x0 := x*5; 
  151.         y0 := y*2;
  152.         elem[x0,y0] := 1.0;
  153.  
  154. The WITH statement:
  155.     "This [compiler error] has to be a bug, correct me if I'm wrong! (I'm going
  156. nuts over this)"
  157.  
  158. TYPE
  159.     Obj* = POINTER TO Empty;
  160.     Empty = RECORD (*nothing*) END;
  161.  
  162.     OpObj = POINTER TO OpNode;
  163.     OpNode = RECORD (Empty)
  164.         name : CHAR;
  165.         left, right : Obj;
  166.     END;
  167.  
  168. PROCEDURE doeval (ex: Obj): REAL;
  169.     BEGIN
  170.         WITH ex : OpObj DO
  171.             CASE ex.name OF
  172.                 "+" : RETURN doeval(ex.left (* err 113 *)) 
  173.                     + doeval(ex.right (* err 113 *));
  174.                 "-" : (* clever code here *)
  175.                 "*" : (* more clever code *)
  176.                 "/" : (* you get the idea *)
  177.             END;
  178.             (* et cetera *)
  179.         END;
  180.     END doeval;
  181.  
  182. Error #133 is an "incompatible assignment".  ex.left and ex.right certainly
  183. seem to be of type Obj.  Why won't doeval accept them?
  184.  
  185. As thutt@clark.net (Taylor Hutt) points out,
  186.     This is not a bug.  The WITH statement actually changes the static type of
  187. the WITHed variable for the entire duration of the WITH statement.  A
  188. workaround to this problem is to assign the parameter to a temporary variable
  189. and to use the WITH on the temp.  A type guard will not work properly in this
  190. case, do not attempt to use it.
  191.  
  192. Some people on Comp.lang.oberon think that the WITH statement should be
  193. avoided entirely because of its non-local effects.  They point out that a
  194. programmer can use individual type guards or, if a guarded variable is used
  195. very many times, can pass the variable to a procedure.
  196.  
  197.  
  198. BIBLIOGRAPHY
  199.  
  200. Sources cited in the FAQ list that are not listed in thebibliography are
  201. electronically available in PostScript and/or Oberon text formats from ETH
  202. Zrich.  They can be acquired by anonymous ftp from
  203. ftp.ethz.ch:/pub/Oberon/Docu.
  204.  
  205. "Type Extensions" by N. Wirth; ACM Transactions on Programming Languages and
  206. Systems; 10, 2 (April 1988) 204-214.
  207.  
  208. "From Modula to Oberon" by N. Wirth; Software: Practice and Experience; 18,7
  209. (July 1988) 661-670.
  210.  
  211. "The Programming Language Oberon" by N. Wirth; Software: Practice and
  212. Experience; 18,7 (July 1988) 671-690.
  213.  
  214. "Variations on the Role of Module Interfaces" by J. Gutknecht; Structured
  215. Programming; 10,1 (January 1989) 40-46.
  216.  
  217. "Object Oberon -- A Modest Object-Oriented Language" by H. Mssenbck and J.
  218. Templ; Structured Programming; 10,4 (April 1989) 199-207.
  219.  
  220. A New Approach to Formal Language Definition and Its Application to Oberon by
  221. M. Odersky; Verlag der Fachvereine Zrich; 1989.
  222.  
  223. "The Programming Language Oberon-2" by H. Mssenbck and N. Wirth; Structured
  224. Programming; 12,4 (April 1991).
  225.  
  226. Programming in Oberon: Steps Beyond Pascal and Modula-2 by M. Reiser and N.
  227. Wirth; ACM Press; 1992.
  228.  
  229. "A Systematic Approach to Multiple Inheritance Implementation" by J. Templ;
  230. ACM SIGPLAN Notices; Volume 28, Number 4 (April 1993).
  231.  
  232. Object Oriented Programming in Oberon-2 by H. Mssenbck; Springer Verlag;
  233. 1993.
  234.  
  235. "A Programming Language for Vector Computers" by R. Griesemer; Swiss Federal
  236. Institute of Technology (ETH Zrich); Dissertation Number 10277, 1993.
  237.  
  238.  
  239. OBERON COMPILERS
  240.  
  241. Please note that mention of a product or company does not necessarily imply a
  242. recommendation.  For Oberon compilers developed outside ETH Zrich contact:
  243.  
  244. VAX/VMS:
  245.     ModulaWare GmbH, Wilhelmstr. 17A, D-91054 Erlangen/F.R.Germany
  246.         Modula-2 & Oberon-2 Compiler Manufactur
  247.         Tel. +49 (9131) 208395, Fax +49 (9131) 28205.
  248.         E-mail/Internet:
  249.         100023.2527@compuserve.com
  250.         g_dotzel@ame.nbg.sub.org
  251.  
  252. MS-DOS and Windows:
  253.     ModulaWare GmbH, Wilhelmstr. 17A, D-91054 Erlangen/F.R.Germany
  254.         OM2 32 Bit Oberon-2 and Modula-2 Compiler for PC/DOS'386/'486 
  255.         native code for DOS with DPMI Driver/Host and for DOS sessions under
  256. Windows 3.1 and OS/2 2.1
  257.     COP2 (Oberon to C translator)
  258.         contact Taylor Hutt, e-mail: thutt@clark.net
  259.     Oberon-M
  260.         contact E. Videki, e-mail: erv@k2.everest.tandem.com
  261.     Extacy
  262.         Real Time Associates Ltd.
  263.         Canning House, 59 Canning Road
  264.         Croydon, Surrey, CRO 6QF
  265.         England
  266.         Tel.: 0044-81-656 7333
  267.         Fax: 0044-81-655 0401
  268.         E-mail: 71333.2346@compuserve.com
  269.         rta@rtal.demon.co.uk
  270.     Pow! (Programmers Oberon Workbench)
  271.         It works with MS-Windows and can be used to create native Windows
  272. applications (EXE's and DLL's).
  273.         Ftp: ftp.fim.uni-linz.ac.at:/pub/soft/pow-oberon2, or
  274.             galileo.meakins.mcgill.ca:/Oberon/CommercialDemos/POW
  275.         E-mail: pow@fim.uni-linz.ac.at
  276.         Mailing list: majordomo@fim.uni-linz.ac.at "subscribepow-list"
  277.  
  278. Amiga:
  279.     A+L AG
  280.         Daederiz 61
  281.         CH-2540 Grenchen
  282.         Tel.: +41 (65) 52 03 11
  283.     Oberon-A 
  284.         A freely-distributable, stand-alone Oberon-2 compiler for the Commodore
  285. Amiga.  
  286.         It can be obtained from AmiNetsites, including ftp.cdrom.com and
  287. ftp.wustl.edu.
  288.         E-mail: oberon@wossname.apana.org.au
  289.  
  290. DECstation (Ultrix, OSF/1), Intel386 (SVR4, OS2, Solaris), Sparc(Solaris):
  291.     Office of Commercial Services
  292.     Queensland University of Technology
  293.     GPO box 2434, Brisbane Q4001
  294.     Australia
  295.  
  296. Atari:
  297.     Martin Momberg
  298.     Hahlgartenstr. 13a
  299.     D-64331 Weiterstadt
  300.     Germany
  301.     E-Mail: Inet:momberg@dik.maschinenbau.th-darmstadt.de
  302.     Ftp: ftp.th-darmstadt.de:/pub/machines/atari/programming/stoberon
  303.  
  304.