[July 24, 2010] The Objective Modula-2 FAQ has been updated.
[May 30, 2010] The Objective Modula-2 grammar page has been updated.
[February 10, 2010] The Objective Modula-2 Overview document has been updated.
[February 4, 2010] The Objective Modula-2 grammar page has been updated. Qualified Import has been amended with an optional re-export qualifier. Pragmas ALIGN, FOREIGN, MAKE and VOLATILE have been added. Pervasives MIN(T), MAX(T) and SIZE(T) haved been renamed to TMIN(T), TMAX(T) and TSIZE(T).
[October 22, 2009] The Objective Modula-2 mailing list is now online at http://modula2.net/mailman/listinfo/objm2.
[October 10, 2009] Minor edits and corrections in Objective Modula-2 Overview.
[October 4, 2009] Refactored production variadicParams for LL(1).
[September 30, 2009] Objective Modula-2 Overview updated with section on variadic procedures. Grammar page, Objective Modula-2 Grammar in PDF format and Objective Modula-2 Grammar in ANTLR v3 format updated with finalised syntax for variadic procedures.
[August 2, 2009] New file objm2_pragma_ident_table.h added.
This concludes the updating of documentation to the new syntax. Compiler source code will be updated in the coming weeks.
[July 15, 2009] Minor updates to paragraph on licensing and to the FAQ, new links on resources page, change of IRC link in the navbar.
[July 5, 2009] This article outlines syntax changes to Objective Modula-2 during July 2009 and the rationale behind those changes.
Until early July 2009 the syntax for class declarations in Objective Modula-2 was based on the class is a module approach. Throughout July 2009 we will move (back again) to a class is a record based syntax.
The main reason for this change was to simplify the grammar and to improve the overall consistency in the language. The class is a module approach allowed mapping of Objective-C containers to Objective Modula-2 modules on a one-to-one basis but it led to a whopping eight different kinds of modules, each of which had different rules.
The now obsoleted Module Matrix makes the problem with the class is a module approach obvious: simplicity and orthogonality went overboard.
The class is a record approach eliminates class and category modules altogether and the only additional module needed is the protocol module, for which there is no implementation part.
This change also allows the bundling of classes into a class cluster with protected sharing of instance variables between classes belonging to the same cluster. No additional syntax is required.
We had tried the class is a record approach before and nobody had liked it because the placement of method declarations within record declarations made the code look cluttered. However, in Oberon 07, Niklaus Wirth showed how to avoid this problem. His solution is called type bound procedures: simply declare your methods outside of the record!
Following Wirth's concept and syntax, the new Objective Modula-2 syntax for class declarations looks like this:
(* This module shows the new syntax for declaring classes *) DEFINITION MODULE Foobar; FROM Cocoa IMPORT NSObject; TYPE Foo = CLASS ( NSObject ) foo, bar : INTEGER; END; CLASS METHOD ( self : Foo ) initWithFoo: ( foo : INTEGER ) andBar: ( bar : INTEGER ) : Foo; METHOD ( self : Foo ) setFoo: ( foo : INTEGER ); METHOD ( self : Foo ) foo : INTEGER; END Foobar.
More interestingly, Wirth's concept makes it possible to add new methods to classes or override existing methods anywhere in a library or program, there is no longer any need for a specific category container.
(* This module represents a category of class Foo *) DEFINITION MODULE AdditionsToFoobar; FROM Foobar IMPORT Foo; METHOD ( self : Foo ) setBar: ( bar : INTEGER ); METHOD ( self : Foo ) bar : INTEGER; END AdditionsToFoobar.
Adopting protocols is also very straightforward. Protocols to be adopted are simply listed after the super class in the header of the class declaration:
(* How to adopt protocols NSPrinting and NSCopying *) DEFINITION MODULE Barbaz; FROM Cocoa IMPORT NSObject, NSPrinting, NSCopying; TYPE Bar = CLASS ( NSObject, NSPrinting, NSCopying ) (* instance variable declarations *) END; (* method declarations *) END Barbaz.
Nevertheless, the concept of protocol is a module makes a lot of sense because protocols
consist only of method headers, no variables, no implementation and the
directive is only useful and permitted within protocols.
PROTOCOL MODULE Foobaring; (* declaration of a required method *) METHOD ( self : * ) foo; (* declaration of an optional method *) OPTIONAL METHOD ( self : * ) bar; END Foobaring.
[July 5, 2009] The Objective Modula-2 project is now available at its own domain and website at http://objective.modula2.net.
The old URL at sunrisetel.net is now being redirected to the new URL. Nevertheless, if you have any link to the project on your website, please change it to the new URL, thank you.
The original site content has been rarranged and a few links have been added. Further updates will be made in the coming weeks. The Objective Modula-2 mailing list has not been set up yet and the Join the Project page is still under construction. The background image for the site banner will also be changed. Updates will be posted on the Latest News page.
The Modula-2 Webring
Web sites and web pages related to the Modula-2 programming language.