TweetFollow Us on Twitter

About Modula-2
Volume Number:1
Issue Number:5
Column Tag:Modula-2

Modula-2

By John Bogan

Abstract: MODULA Corporation of Provo, Utah has shipped a $90.00 Beta site version of Modula-2 which runs reasonably well on a single disk 128K Macintosh. This paper attempts to make the case that Modula-2 deserves a thorough analysis to determine if it is the ideal standalone development language for serious commercial software on the Apple Macintosh. The conclusion of this paper is that Modula-2 will soon become the language of choice for farsighted software developers through the rest of the 1980’s and it is through the efforts of enlightened companies such as MODULA Corp. that this joyous result will come about.

A Short History of Modula-2

The history of Modula-2 is the history of its designer, Dr. Niklaus Wirth. We pick up the story in the late 1960’s when Dr. Wirth was a member of a large committee whose task was to design a successor to the language ALGOL-60, a highly popular language in Europe. ALGOL-60 is widely regarded as the inspiration for the discipline of Structured Programming which is the most significant breakthrough in software engineering in the past two decades. The result of this committee’s efforts was ALGOL-68, a kludge. No coherent design philosophy guided this effort resulting in a chaotic collection of features reminiscent of PL/I. In short, failure.

At this point Dr. Wirth abandoned the committee approach and decided to design his own language. Influenced by the structured programming theories of Dijkstra, Hoare and Dahl, Dr. Wirth set out to construct a language he could use to teach his own students the fundamentals of good programming. He began with some modest goals.

[“The development of the language Pascal is based on two principal aims. The first is to make available a language suitable to teach programming as a systematic discipline based on certain fundamental concepts clearly and naturally reflected by the language. The second is to develop implementations of this language which are both reliable and efficient on presently available computers.”] Pascal Report, page 1, 1974, Niklaus Wirth

The rest is history. As anyone who follows the computer industry well knows Pascal is one of the major influences on the software world today, particularly in the microcomputer world. To cite only one example the second largest manufacturer of personal computers in 1984 appears to have adopted Pascal as its standard design language. That company is, of course, Apple Computer, Inc. As I understand it most of the algorithms, data structures and techniques designed into the LISA and the Mac began life as Pascal programs.

But Pascal has significant flaws. Volumes have been written disparaging Pascal as a systems programming language and as a vehicle for writing applications of all stripes and colors. (Never mind that the language was never intended to do any of these things.) Further, and more disturbing, Pascal has been repeatly bastardized by its implementors with a wide variety of (incompatible) extensions. After a decade in the field there is no such thing as Standard Pascal any more than there is a tooth fairy. Nevertheless, many talented software people believe that even with its flaws Pascal is still the best practical general purpose language we have at our disposal. I believe this situation is about to change.

On with Wirth’s story. After largely washing his hands of Pascal Dr. Wirth turned his attention to multitasking and the problems of building large commercial programs using teams of programmers. As it happens Pascal is utterly unsuited for both of these activities. So Wirth designed himself a new, very simple language he called Modula. This language was never particularly practical it was more like a “hack” from one of the more gifted computer scientists around. However, it laid the groundwork for the concepts of seperate compilation, modularity and libraries.

In 1976 Dr. Wirth took a sabbatical from his mountain hideaway, Eidgenössische Technische Hochschule, Instut für Informatik, better known as ETH in Zürich, Switzerland and visited that fount of inspiration - Xerox PARC. As Mac enthusiasts we all know what that means. Personal workstations, high resolution bit maps, mice, windows, icons, Smalltalk etc. Less well known is the Xerox systems implementation language MESA. This language is a derivative of Pascal suitable for team implementation of low-level systems programs. The pieces were falling into place. Like many visitors to PARC Dr. Wirth came away with an inspiration.

Dr. Wirth was tired of the bitching and moaning surrounding Pascal.

[“If a language proves to be only marginally suitable for some application that was obviously not envisaged by its originator, we should muster the courage to build a new, truly adequate tool, instead of just grafting a fix onto the existing one.”] Byte, April 1983, pg. 386, Niklaus Wirth

Dr. Wirth’s inspiration was to build a new computer system from the ground up. A machine which would be programmed in one language from soup to nuts. From OS to text editor to graphics editor to who-knows-what, databases, spreadsheets, adventure games, what- ever. Recognizing that a one language machine would require the use of dangerous low-level facilities as well as the safety, convenience and productivity of the high level structured features he sifted through his encyclopedic knowledge of Pascal, Modula and MESA and in 1978 he defined his new language. To quote:

[“Modula [1], a small language ...featured a facility to partition programs into modules with explicitly specified interfaces. This was precisely the facility needed to allow the introduction of so-called low-level facilities in the high-level language, because it allowed you to encapsulate them and to constrain their danger- ousness to clearly delineated parts of a program. Hence, the choice for the new language was Pascal, augmented by the module and a few other facilites, and regularized by a more systematic syntax. Thus was born Modula-2.”] Byte, August 1984, pg. 146, Niklaus Wirth

Dr. Wirth had his ideal language. He then sat down with a couple of hardware types and some graduate students and built a bit-slice (AM2901) single-user high resolution graphic workstation with windows, mouse and multiple font editor with laser printer long before the Macintosh ever saw the light of day! He called his machine Lilith. The sole American distributor for the Lilith and the Modula-2 compiler which this machine is built around is MODULA Corporation of Provo, Ut., makers of Modula for Mac.

Modula Benchmark

The following program is an imple- mentation of the Sieve of Eratosthenes expressed in Modula Corporation’s version of Modula-2 for the Apple Macintosh 128K. The following results were obtained when this program was compiled and executed.

The source (Prime.MOD) = 1,617 bytes.

Compile time was -1:45

The M-code (Prime.REL) = 324 bytes.

Link time was -1:20

The execution module = 4,348 bytes.

Execution time was -1:11 or 71 seconds.

Modula-2 Compiler,Interpreter Ver. 1.0.

MODULE Prime;  (* Sieve of Eratos. *)
(* $R-  disable subrange and type conv *)
(* $T-  disable index checking *)
FROM InOut IMPORT WriteLn, WriteCard, WriteString;
FROM Terminal IMPORT ClearScreen;
CONST Size = 8190;
VAR i, prime, k, count, iter : CARDINAL;
      Flags : ARRAY[0..Size] OF BOOLEAN;
BEGIN
      ClearScreen;
      WriteLn; WriteString(“10 Iterations”);
      FOR iter := 1 TO 10 DO
           count := 0;
         FOR i := 0 TO Size DO Flags[i] :=                           
                        TRUE END;
           FOR i := 0 TO Size DO
                IF Flags[i] THEN
                     prime := i + i + 3;
                     k := i + prime;
                    WHILE k <= Size DO
                           Flags[k] := FALSE;
                           INC(k,prime)
                    END;
                  INC(count)
            END;
       END;
   END;
   WriteLn; WriteCard(count,6); WriteString(‘ Primes’)
END Prime.

Modula-2 Benchmarks

A Comparison between versions and machines

LEGEND

Code System Seconds

1. Lilith 4.24

2. Hamburg Vax 11/750 4.64

3. Logitech Eagle 6.90

4. ETH LSI-11 8.78

5. Logitech IBM PC 15.80

6. Volition Sage 66.14

7. Modula Macintosh 71.00

8. MRI Eagle 90.70

9. MRI IBM PC 203.60

10. Volition IBM PC 209.50

11. Volition Apple II 377.00

Source: “Seven Modula-2 Compilers Reviewed” by Terry L. Anderson Journal of Pascal, Ada & Modula-2 Vol.3 No.2

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.