[an error occurred while processing this directive] Objective Modula-2 · News [an error occurred while processing this directive]

Objective Modula-2

Latest Update: July 24, 2010


Frequently Asked Questions

The Modula-2 Webring

Visitor Map

Visitor Map - Click to view visits

Latest News

Recent website updates

[July 24, 2010] The Objective Modula-2 FAQ has been updated.

[June 24, 2010] The Objective Modula-2 Overview document has been updated following recent updates to the Modula-2 R10 language description.

[June 6, 2010] The Modula-2 R10 language description (the core language of Objective Modula-2) has been updated. The Objective Modula-2 in Brief section has been updated accordingly.

[May 30, 2010] The Objective Modula-2 grammar page has been updated.

[May 24, 2010] The Objective Modula-2 Overview document and the Objective Modula-2 ANTLR Grammar have been updated following updates to the Modula-2 R10 language description.

[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.

[September 21, 2009] New files objm2_tokenset_literals.h and objm2_tokenset_literals.c added. Files objm2_tokenset.h and objm2_tokenset.c updated.

[September 20, 2009] New files gen_first_and_follow_sets.c (utility), objm2_first_follow.h, objm2_production_table.h, objm2_productions.h and objm2_productions.c added.

[August 30, 2009] Files objm2_lexer.h and objm2_lexer.c updated to new grammar.

[August 20, 2009] Files objm2_filename.h and objm2_filename.c replaced. File objm2_build_params.h updated. New files objm2c.c, objm2_errmsg.h and objm2_errmsg.c added.

[August 18, 2009] New files objm2_filename.h, objm2_filename.c, objm2_tokenset.h and objm2_tokenset.c added.

[August 2, 2009] New file objm2_pragma_ident_table.h added.

[July 31, 2009] The first set of compiler sources has been updated to the new syntax: objm2_reserved_word_table.h, objm2_token_table.h and objm2_builtin_ident_table.h.

[July 30, 2009] The Objective Modula-2 Grammar PDF document has been updated to the new class-is-a-record syntax.

This concludes the updating of documentation to the new syntax. Compiler source code will be updated in the coming weeks.

[July 28, 2009] The Objective Modula-2 Overview document has been updated to the new class-is-a-record syntax.

[July 25, 2009] The grammar page has been updated with an HTML version of the new class-is-a-record based grammar.

[July 24, 2009] The Objective Modula-2 ANTLR grammar has been revised and updated to the new class-is-a-record syntax.

[July 23, 2009] Section Objective Modula-2 in Brief and all code samples have been updated to the new class-is-a-record syntax.

[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.

Wirth was right: Classes are Records!

[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 *)



    Foo = CLASS ( NSObject )
        bar  : INTEGER;

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 *)



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 *)


FROM Cocoa IMPORT NSObject, NSPrinting, NSCopying;

    Bar = CLASS ( NSObject, NSPrinting, NSCopying )
        (* instance variable declarations *)

(* 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 OPTIONAL directive is only useful and permitted within protocols.


(* declaration of a required method *)

METHOD ( self : * ) foo;

(* declaration of an optional method *)

OPTIONAL METHOD ( self : * ) bar;

END Foobaring.

New Domain and Website

[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.

List all sites | Previous site | Next site | Random site | Join this webring