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

The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »

Price Scanner via MacPrices.net

Apple is offering significant discounts on 16...
Apple has a full line of 16″ M3 Pro and M3 Max MacBook Pros available, Certified Refurbished, starting at $2119 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free... Read more
Apple HomePods on sale for $30-$50 off MSRP t...
Best Buy is offering a $30-$50 discount on Apple HomePods this weekend on their online store. The HomePod mini is on sale for $69.99, $30 off MSRP, while Best Buy has the full-size HomePod on sale... Read more
Limited-time sale: 13-inch M3 MacBook Airs fo...
Amazon has the base 13″ M3 MacBook Air (8GB/256GB) in stock and on sale for a limited time for $989 shipped. That’s $110 off MSRP, and it’s the lowest price we’ve seen so far for an M3-powered... Read more
13-inch M2 MacBook Airs in stock today at App...
Apple has 13″ M2 MacBook Airs available for only $849 today in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty is included,... Read more
New today at Apple: Series 9 Watches availabl...
Apple is now offering Certified Refurbished Apple Watch Series 9 models on their online store for up to $80 off MSRP, starting at $339. Each Watch includes Apple’s standard one-year warranty, a new... Read more
The latest Apple iPhone deals from wireless c...
We’ve updated our iPhone Price Tracker with the latest carrier deals on Apple’s iPhone 15 family of smartphones as well as previous models including the iPhone 14, 13, 12, 11, and SE. Use our price... Read more
Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more

Jobs Board

DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying, Read more
Operating Room Assistant - *Apple* Hill Sur...
Operating Room Assistant - Apple Hill Surgical Center - Day Location: WellSpan Health, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying, Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.