Objective Modula-2 is a superset of the Modula-2 programming language (ModulaTwo) adding an OOP layer that supports reflection, dynamic message dispatch (late binding) and both static and dynamic typing. Its object system is based on the object model of Smalltalk and it uses the runtime library of Objective-C to support the Cocoa and GNUstep APIs natively. Objective Modula-2 is developed and maintained by the non-profit open source Objective Modula-2 project.
Differences to Modula-2
Objective Modula-2 is a dialect of Modula-2 based on the PIM4 language report in Wirth's fourth edition of "Programming in Modula-2" with some features omitted and some other features added.
- Omitted features
- No local modules
- No subrange types
- No EXPORT statement
- No WITH DO statement
- Replaced features
- Binary literals use radix 2 instead of radix 8
- Character code literals use radix 16 instead of radix 8
- Variant records are replaced by Oberon-style extensible records
- Pragma delimiters (*$ and *) are replaced by <* and *> as in ISO Modula-2
- Type conversion functions are replaced by a new type conversion operator ::
- Restricted features
- Array indices always start with zero
- Variables are always exported read-only
- Set and enumeration types cannot be anonymous
- Named elements of sets and enumerations must be qualified, fixing a design flaw of Modula-2
- Added features
- Conditional compilation <*IF ... *>, <*ELSIF ... *>, <*ELSE ... *> and <*ENDIF*>
- Structured literals like ISO Modula-2
- Enumeration types are extensible
- New type UNICHAR for unicode characters
- IMMUTABLE pointer types, function and procedure parameters
- String literal concatenation like ISO Modula-2
- CHAR is assignment compatible with ARRAY OF CHAR
- A typesafe foreign function interface to C including typesafe variadic functions and procedures
- FROM ... IMPORT * for unqualified import of entire Cocoa and GNUstep frameworks
- Postfix ++ and --, some backslash escaped character codes in strings, and // and /* */ comments
- Object oriented extensions
- CLASS and METHOD declaration syntax for Objective-C compatible classes
- PROTOCOL modules for Objective-C compatible protocols
- Method invocation syntax as in Objective-C
- CRITICAL block for Objective-C compatible critical sections
- TRY block for Objective-C compatible exceptions
- OBJECT, SUPER, YES, NO, BYREF, BYCOPY, INOUT, OUT
- Additional pragmas <*FRAMEWORK*>, <*IBAction*>, <*IBOutlet*>
Official Website
The official website of the Objective Modula-2 project is at
CategoryProgrammingLanguage CategoryPascal ModulaLanguage