Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Use Turbo Modula-2 Instead of Turbo Pascal Under CP/M? (2013) (techtinkering.com)
58 points by tomcam on March 29, 2018 | hide | past | favorite | 21 comments


This brings back fond memory of using Modula-2 on the Amiga. The local Modula implementation even produced faster and smaller code than the default C compiler. While Turbo Pascal basically retrofitted all important parts from Modula onto Pascal, it would have been nice to have a Turbo Modula-2 on the PC too. Actually I would like to have a modern version of that around still.

One of the aspects why I like Go is, that it included many of the good parts of Modula-2, giving them a more modern look by using the C-style syntax.



The mind behind Turbo Modula-2 was Martin Odersky from Scala fame.


It seems TM2 compilation was very slow and was producing faster but also bigger programs than TP. This looks like the main complaints about scala ;-).

At that time, memory was very tight (I was fighting to have all my code compile in less than 64kb) and compilation time was significant.


Never thought about it that way. :)


Some background on Turbo Modula-2: https://www.artima.com/scalazine/articles/origins_of_scala.h...

And Peter Sollich went to Microsoft after Borland.


Peter also largely implented the 32 bit Delphi compiler.


I had no idea!


While arguably Modula-2 two was an improvement upon Pascal, Turbo Pascal was an amazing implementation and fixed enough of Pascal issues that it won.

Turbo Pascal started life as BLS Pascal for Nascom 2 by Anders Heilsberg, published by Poly Data in 1981. In was quickly ported to CP/M and renamed COMPAS Pascal, brought into Borland and renamed Turbo Pascal, then ported to DOS ...

I worked professionally with the latter and worked on a large system which would have been impossible without the Unit module system that TP added.

If Modula-2 had existed with Anders started BLS Pascal, he'd almost certainly had based it on that and it would have been better. I don't think it would have mattered though. In the end C won and would still have won (even though it is a less safe language).

[I don't like Wirth's syntax, so I've been reskinning Oberon-07 to look more Nim-like].


Note the compilation times. Turbo Pascal was pretty awesome in that regard. On the other hand, this was TP 3, which Modula handily beats on, well, modularization. IIRC all you could do in those early days was literal preprocessor includes and that weird overlay thing.


One of the primary languages I was taught in college was Modula-3. At the time it was a huge improvement over both Pascal (which was also taught) but it had some of the same power as C++ but was much safer. I was always a bit sad it didn't catch on.


It is one of my favourite GC enabled system programming languages.

The most well known version, Critical Mass Modula-3, was made open source and some devs are still developing it.

https://github.com/modula3/cm3

Last commit 4 days ago.


I was taught Modula-2 in college as well... 5 years ago. I think they have removed it from the curriculum now though, and just use C that semester, sadly


It seems the difference in execution could be that modula interprets array of boolean as a tp set. I'd be curious to see the time of tp using set instead.

Edit: to clarify, the differece would be array access vs. bit mask of a variable.


Orders of magnitude difference in buid time is significant enough. Sample code also shows no tangible benefit in using Modula/2. No wonder it went away quickly.

Oberon, on the other hand, is an entirely different story.


There is no feature in the Modula language which makes it compilation fundamentally slower than the compilation of Pascal. Actually, Turbo Pascal later retrofitted the main Modula feature - seperate compilation of modules - onto the Pascal language in the form of units. The observed differences in the compile times should come from implementation differences of the compilers - the fact that the Modula compiler took longer to run but produced the faster executable hints towards the Modula compiler spending its time on code optimization.


I'll do my Cato part: Let's not forget Modula-3.

And yes, the sample code shows no benefit, but once your code grows, Units/Modules are pretty nice to have, even on constrained systems. And this version of Turbo Pascal didn't have this (nor Pascal in general, resulting in huge hodgepodge of incompatible dialects).

I never did much with coroutines in general and don't know how useful they'd be on a Z80 CP/M system…


> Let's not forget Modula-3.

https://github.com/modula3/cm3

Last commit 4 days ago. :)


Borland gave up on Turbo Modula-2 and decided to extend Turbo Pascal, with Modula-2 features.

In the MS-DOS golden days, Turbo Pascal was the best Pascal dialect, to the point it was more relevant if a Pascal compiler was compatible with Turbo Pascal dialect than with the ISO Pascal.

Also the reason why although ISO Extended Pascal was created as a means to solve the initial complains regarding ISO Pascal, almost no one cared about its existence.

Modula-2 had more commercial success on other systems.


It might be nice to have a standalone Z80 compiler for Modula-2 (or TP, for that matter) for retro game programming. Of course, you're going to have to emulate this compiler since it's also written in Z80 machine code...


There is Hochstrasser's Modula-2 (http://www.cpm.z80.de/develop.htm) and Turbo-M2 comes with Yaze (http://www.mathematik.uni-ulm.de/users/ag/yaze-ag).




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: