35 comments

[ 3.6 ms ] story [ 88.6 ms ] thread
I wish they would show us some code.
Very generally, think pascalish golang. Eschews heavy abstraction, lower keyword count, green threads built in, modules instead of packages, no implicit type casts, copious compile errors. It did not have garbage collection, but I'm sure M2R10 will offer something in that area.

Topspeed made an awesome compiler and libraries for M2 back in the DOS days. The package came with a cute traffic simulator demo showing off the multitasking capabilities of M2. Logitech (yes, the mouse and keyboard guys) was another vendor back in the day, along with Stonybrook (sweet optimizations) and XDS, a Russian company which I believe wrote some M2 code for the Russian space program.

From back in the day. DEF and IMP were two different files:

DEFINITION MODULE Bit; (* #data(packed=>on) ) ( hooks to lib *) PROCEDURE SetBit(target,bitnum: CARDINAL): CARDINAL;

PROCEDURE ClearBit(target,bitnum: CARDINAL): CARDINAL;

PROCEDURE TestBit(target,bitnum: CARDINAL): BOOLEAN;

PROCEDURE Not(target: CARDINAL): CARDINAL;

END Bits.

IMPLEMENTATION MODULE Bits;

PROCEDURE SetBit(target,bitnum: CARDINAL): CARDINAL;

VAR tempset: BITSET;

BEGIN

  tempset:= BITSET(target);

  INCL(tempset,bitnum MOD 16);

  RETURN CARDINAL(tempset);
END SetBit;

PROCEDURE ClearBit(target,bitnum: CARDINAL): CARDINAL;

VAR tempset: BITSET;

BEGIN

  tempset:= BITSET(target);

  EXCL(tempset,bitnum MOD 16);

  RETURN CARDINAL(tempset);
END ClearBit;

PROCEDURE TestBit(target,bitnum: CARDINAL): BOOLEAN;

VAR tempset: BITSET;

BEGIN

  RETURN (bitnum MOD 16) IN BITSET(target);
END TestBit;

PROCEDURE Not(target: CARDINAL): CARDINAL;

BEGIN

  RETURN CARDINAL({0..15} - BITSET(target));
END Not;

END Bits.

Don't want to be off-topic but just wanted to share the info about a Modula-3 project hosted at https://modula3.elegosoft.com/cm3/

They've also moved their sources to GitHub: https://github.com/modula3/cm3

Is there some actual longterm activity there (roadmap, more than 1-3 contributors)? Modula-3 was quite exciting in the 90s, but never quite took off and then Java practically ate its lunch. I'd love to see it resurrected, and moving to LLVM seems like the right step.
I would dearly love to see a full-blown Modula-3 revival. It's one of these old, moribund languages that I have a huge soft spot for, especially since I'm a Pythonista and large parts of Python were lifted directly from Modula-3.

I also kind of have a thing for innovative languages that never really took off. Not just M3, but I'm also deeply fascinated by Algol 68.

I'm currently trying to compile the Modula-3 sources from GitHub. It's been a long time since I have done this.

I'm fighting with the compiler because it refuses to compile under x64 arch.

Also, one must use an older m3-compiler to compile the newer sources. sigh

I think I should write a little tutorial for us, 80/90es kids (and older) ... you know, nostalgia, mid-life-crisis etc. ;)

Regards,

Please let me join this thread with an ad for Ada, which belongs to the same family:

While I appreciate work on Modula 2, I'd like to point out that Ada (and its subset Spark with a focus on verification) already fulfills the project's goals (correctness, safety, reliability and readability).

Plus it's battle-proven (literally) and ready to use. There exists an open source version with the GNAT compiler and it's part of the GCC (and AdaCore is really into FOSS). The literature is sparse but high quality. Programs are usually of good quality and require fewer developers (compared to C++). Real-time, embedded, systems, high-integrity, concurrent, distributed programming -- it's all there. It's suitable for large, long-lived projects.

http://libre.adacore.com/

http://www.ada2012.org/

http://spark-2014.org/

They still have the runtime under the GPL, right? So you'd have to pay for the Pro version to distribute non-libre binaries.
You probably know better, but I want to dispel some misunderstandings this post might unintentionally create. I am not a lawyer, nor am I associated with FSF, nor am I associated with AdaCore.

Using a compiler licensed GPL does not mean that you have to release your software under GPL or a compatible license.

As far as inclusion of runtimes into binaries, gcc has the "GCC runtime library exception" so that binaries compiled with its runtime don't have to be GPL-compatible.

And FSF versions of GNAT have something comparable, via the "GNAT-Modified GPL" which also has a runtime exception.

AdaCore is not FSF, it's a for-profit software company. If you are talking specifically about AdaCore compilers, it seems they intentionally removed their runtime exception as an incentive to buy AdaCore GNAT Pro, if you want to use their compiler to release commercial software.

So I guess if you insist on using AdaCore compilers, AND you want to make money on your products, you will have to pay the company whose product you are using to make money.

If AdaCore chose to release their teaser/free product under a proprietary license, I suspect nobody would be complaining about GPL here. They just happened to make the free product available under GPL.

I obviously don't know better, which is why I was asking a question. Not being a lawyer, all those exceptions and their conditions are a bit hard to parse…

And, well, they basically have to offer the GPL version, as they're based on GCC. Same as NeXt/Apple did with objective-c, same as Sencha did with ExtJs, if I don't mix legal terms up here, too.

And like the latter, it's aimed at enterprises, so there's quite often a huge jump between doing an app for free and paying for the compiler. Heck, there's not even a publicly available price, which puts this more into Oracle's territory…

Which is fine for corporate environments, where more figures on the bill is actually a bonus for managers (for lack of better knowledge, money == quality). Or when Ada is actually mandated. But for small-timers, it's a hard sell if other related languages would be available -- which this thread is all about.

It definitely seems more in the K/APL territory regarding the price structure than e.g. freemium 3D engines.

depends.

If you jump onto debian and do apt-get gnat you'll pull down the FSF distribution. The FSF standard library/runtime is under the GNAT-modified gpl which is basically the LGPL and you can use it commercially. I think it's usually about 18 months behind Adacore's version but the standard library is very mature so it's not actually an issue. Much like there's no real problem using an older C standard library on Debian Stable or RHEL.

It hasn't been updated for the recent gnat-5 release but more info here: https://people.debian.org/~lbrenta/debian-ada-policy.html

The problem with Pascal/Wirthian family of languages in my opinon is that they are really scattered and it is somewhat difficult for an outsider to discover what is the currently alive variation. It doesn't help that the languages have been called Pascal, Modula, and Oberon with various prefixes and (version) numbers. Of course there are also various implementations of the different languages that also kinda live their own lives.

Does anyone know some comperehensive and up to date resource illustrating the whole language family?

I can only partially answer your question for Pascal: Look at the Free Pascal compiler.

I learned (Turbo) Pascal many years ago. Recently I've revived my usage while writing a video game. I wanted a mature, compiled, no GC language that worked well on Windows but wasn't C/C++. For the most part I've been happy with it.

It's still an alive project (version 3.0 released this year). It supports a wide selection of platforms, and a few Pascal dialects including Delphi, although I've been sticking to the old school procedural style in my game. It easily interfaces with C libraries (I've tried SDL and Lua).

As for the language itself, it seems to have lackluster support for template / generic programming, so I avoid it. That's a little disappointing to me but I think I can live without it. It does support old scool C++ style OOP, but try to avoid it because OOP's not cool anymore :).

There's plenty of documentation on the Internet, but not the amount of some of the more hip languages of today (and the websites tend to look older).

The number of tools is lackluster. It has an IDE called Lazarus that I've never used. The IDE seems focused on GUI development, which doesn't interest me. It comes with Turbo Pascal like IDE that runs in a console window, which probably won't be appealing to most people. I mostly use Notepad++ and script building in PowerShell for my game. I do miss the features from Visual Studio, like Intellisense though.

> Does anyone know some comperehensive and up to date resource illustrating the whole language family?

I am not an expert, but as someone that started coding in the 80's I have some of the knowledge myself. Some of these facts might be wrong.

Pascal:

Wirth created Pascal, the educational version, which was the target of the famous rant from Kernigan.

All Pascal vendors extended the language, the most common extensions for professional coding became the ISO Extended Pascal standard.

UCSD Pascal, Turbo Pascal, MacPascal and Quick Pascal were the most famous dialects.

Wirth collaborated with Apple in the design of Object Pascal, the original systems programming language for Mac OS. Those extensions were later on adopted by Borland for Turbo Pascal.

Given the influence of Turbo Pascal in the PC world, most Pascal vendors ignored the ISO Extended Pascal and tried to follow Turbo Pascal instead.

Object Pascal eventually became a synonym with Delphi.

Modula-2:

Wirth spends some time at Xerox PARC and gets to learn Mesa. When he returns to Zurich, he creates a systems programing language based on Mesa, without the issues that plagued Pascal and writes the Lillith OS in it.

Oberon:

Wirth returns to Xerox PARC, meanwhile Mesa has evolved into Cedar, a systems programming language with RC/GC, interactive debugger (REPL) among other features.

Again, when returning to Zurich, he creates Oberon (the language) and Oberon (the OS), following the features of Cedar.

Oberon gets used as workstation environment at ETHZ and as a means to teach OS programming at several european universities.

Wirth collaborates in the design of Oberon-2.

Other ETHZ collaborators create a startup to explore Oberon commerically and extend Oberon-2 further, thus creating Component Pascal.

Meanwhile the OS projects at ETHZ evolve the Oberon OS into Oberon System 3 with its gadgets systems, and evolve Oberon-2 into Active Oberon, which uses active objects as construct for parallel/concurrency programming.

Wirth already retired, decides to pursue his goals for a minimalist type safe systems programming language and designs Oberon-07.

Modula-3

The Xerox PARC designers behind Mesa and Cedar eventually join DEC when all falls apart and start designing Modula-2+, based on Modula-2.

With their learnings, they eventually create Modula-3 and the SPIN OS.

Unfortunately DEC gets bought by Compaq and Modula-3 related projects get canned.

Good summary. It's worth pointing out that Borland's Pascal had already diverged from other dialects, including Apple's, and when they tacked on the OO extensions from Wirth's ObjectPascal/MacApp, they diverged further.

MacApp is interesting in itself, but I'm not sure how much involvement Wirth had in its development. Delphi certainly owes a lot of its design to it, but nailed the visual UI builder in ways that MacApp didn't (and in a way that Interface Builder never has). Apple actually kept supporting and updating MacApp as late as 2002 (Photoshop was famously written in it) [1]; it's one of those beautiful niche things that eventually die, but keep a lot of people magically productive for a while (just like Delphi, coincidentally).

[1] http://basalgangster.macgui.com/RetroMacComputing/The_Long_V...

Thank you very much for the historical viewpoint, much appreciated. It is kinda interesting that Delphi/FreePascal is the most live one while also being the one that splitted off from the family tree the earliest.
I'd say the currently alive variation is Object Pascal and the two major implementations of it are Free Pascal and Delphi. See Pascal's and Delphi's ranking on the TIOBE index (http://www.tiobe.com/index.php/content/paperinfo/tpci/). Free Pascal is fairly compatible with Delphi except for the newer language features.

Delphi's expensive but its Object Pascal implementation (http://docwiki.embarcadero.com/RADStudio/Seattle/en/Delphi_L...) is good and it has some nice libraries like FireDAC (http://docwiki.embarcadero.com/RADStudio/Seattle/en/FireDAC) and the parallel programming library (http://docwiki.embarcadero.com/RADStudio/Seattle/en/Using_th...).

Unfortunately, Wirth never seemed to be very cooperative in attempts to standardize his languages, and often inclined to tinker with the language whenever he wrote a new compiler.

My personal theory is that his participation in the Algol 68 design effort left him with enough unpleasant experiences in language standardization to stop him from ever trying this again (Though I never asked him personally).

I never cease to be amazed at the dedication Stroustrup has been bringing to the C++ standardization for several decades now.

What's about the recent wave of Wirth's almost forgotten languages on HN? Pascal, Modula and Oberon and its silbings/etc were pretty niche last time I checked and most of their maintainer moved on.
> http://modula-2.info

> Warning: include_once(/home/m2info/public_html/m2info/cookbook/rowspan55.php): failed to open stream: No such file or directory in /home/m2info/public_html/m2info/local/config.php on line 181

Looks really nice! Not to mention PASCAL-like semicolon-infected syntax with mindblowing features like dynamic memory allocation and CASE OF. Who would bother with this fossil crap?

Yeah, no generics either.
And no sense of humor either.
Can someone point me to the documentation for their cweb-equivalent (weave/tangle etc.)? Just interested if their definition of literate includes "macros", or just the semi-literate stuff you see more commonly these days (i.e. inverted comments, without restructuring).

Might also be just a fancy word for "we use begin/end, not braces".

Whenever I read a Modula 2 source, I get the feeling the programmer is yelling at me.
The upper case keyword thing is annoying. In ALGOL-60, the keywords were supposed to be in lower case bold type. When algorithms were published in Comm. ACM, they were, but computers printers and displays of the time couldn't do that.

Displaying keywords in bold, and string constants in italics, would be a nice editor feature today. It would look better than syntax coloring. If you had an editor with enough smarts to line up the comments, you could even use variable-width fonts.

It's a good idea, 20 years too late. We should have had this in 1995. At this point, just getting programmers to write BEGIN and END will be a struggle.

Memory allocation needs to be addressed better. There seems to be a NEW, but no mechanism for deletion. (Wirth did that in Pascal. It didn't work out well.) Is this language garbage-collected?

For memory allocation, these are the known options:

- Garbage collection (scripting languages, Go, LISP, etc.) - safe, but causes stalls.

- Reference counting - (Python) safe, but can leak if you have loops. Usually adds overhead. May need a GC as a backup.

- Single-ownership without borrow checking (C++11) - partially safe, errors can be detected at run time, but this is not guaranteed.

- Single-ownership with borrow checking (Rust) - safe, complicated at compile time, but works.

- Region allocation (Ada) - used in some real-time systems. Rare.

- Manual deletion (C) - unsafe, leads to many bugs.

The manual option is probably unacceptable at this late date.

> Region allocation (Ada) - used in some real-time systems. Rare.

Equivalent to solving the halting problem unless you're writing toy software with extremely well-defined inputs and outputs. Good for device drivers, maybe, but not in the general case.