home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / oberon-faq / language < prev    next >
Encoding:
Text File  |  1995-07-25  |  11.0 KB  |  295 lines

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