Author Topic: What are Modula2 And Oberon?  (Read 24374 times)

Joanna

  • Hero Member
  • *****
  • Posts: 1464
What are Modula2 And Oberon?
« on: July 23, 2023, 11:26:37 pm »
I saw something recently in chat wherein someone was raving about modula2 being better than pascal. Both Oberon and modula2 were created by mr. wirth After pascal but never seemed to have gained the popularity of pascal. Can anyone tell me why and/or how similar they are to pascal?

Handoko

  • Hero Member
  • *****
  • Posts: 5559
  • My goal: build my own game engine using Lazarus
Re: What are Modula2 And Oberon?
« Reply #1 on: July 24, 2023, 05:02:23 am »
Niklaus Wirth is a computer scientist, the chief designer of many programming languages including Pascal, Modula and Oberon.

If you use Pascal a lot, you will know Pascal's structure has many inconsistency. Modula and Oberon are successors of Pascal, in theory they have more features and fix the problem of Pascal.

But why very few or no one uses Modula or Oberon?

Simple, the answer is programmers do not choose the language just because the language itself is better than others. There are many things in the consideration. For me, these are important:

1. Not the problem of the language itself, but does it have a good IDE? I personally like FreeBASIC. But I do not use it because the IDEs available for FreeBASIC do not have many features I need.

2. Also not the problem of the language itself. Can it do wide range of things? Graphics, sound, GUI, database, network, printer, etc. Not just the ability to do that but it should be easy. I can write a pong game in 133 lines of code using Lazarus, can I do the similar thing easily in Modula or Oberon?

3. Libraries available. Recently I am working on a real project. It needs to store data and can be accessed by several users from network. I use Firebird. Can Modula or Oberon use Firebird? And what about OpenGL?

4. Documentation and tutorial. Lazarus/Pascal already has good documentation and tutorials, but often people can't find it. I tried to google "how to load jpeg in Lazarus", I got the answer. Doing the same but Oberon, I found nothing.

5. Community and forum. If I have problem when using Modula or Oberon, where should I ask to?

6. I need to write program that can run on both Windows and Linux. Maybe in the future Android and MacOs. Can Modula and Oberon generate programs that can be run on Android?

Also, will the tool I use be maintained in the future? Many said Pascal is dying, but it has been proved: Pascal is undying. If I study and use Oberon seriously and build commercial projects using it, what should I do if someday Mr. Wirth says he is working on a new fancy language and stops developing Oberon?

It won't be a serious problem if I use Lazarus/Pascal (as the name 'Lazarus' suggests, it has been resurrected). If someday the core developers of Lazarus say they're going to be retired, won't work on Pascal anymore. Not a big problem. Someone sure will continue developing or fork it. Because many users are using and depends on it.

Programming language and the tools are 2 different things. The programming language is important but what the tools can offer is more important. I don't mind learning or using a new language if the tools are definitely better than what I'm currently using.
« Last Edit: July 24, 2023, 06:13:52 am by Handoko »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12984
  • FPC developer.
Re: What are Modula2 And Oberon?
« Reply #2 on: July 24, 2023, 08:56:21 am »
There is also Modula-3.

Modula-2 was progress on original, seventies Pascal. Some of the progress (like a unit/module system) have been backported to later Pascals.

The most important change is in the base block layout.  BEGIN's that are not the start of a function are omitted, and blocks are mandatorily ended with END. (no single/multi line block difference).

There are also problems. It is case sensitive, some features (END 'functionname') are annoying without a refactoring IDE and the string handling is old fashioned (by 1990 standards) and cumbersome. Maybe newer compilers fix some of those.

The target of Modula2 was primarily systems programming.

M3 and Oberon are more object oriented versions, lauded in design and minimalism (Oberon is a direct precursor to Java), but from what I've seen of it unusable otherwise :-)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8579
Re: What are Modula2 And Oberon?
« Reply #3 on: July 24, 2023, 08:59:15 am »
Simple, the answer is programmers do not choose the language just because the language itself is better than others. There are many things in the consideration. For me, these are important:

I'm surprised that Joanna didn't start off by reading the Wikipedia articles, and concerned that this is going to turn into another of those "threads from Hell". But I'm not really here any more, so can just mark everything read if that happens.

I've written quite a lot in the past about the problems in Pascal's design: Wirth rushed it after ill-advisedly resigning from the ALGOL-68 committee, but was possibly maneuvered into that position by McCarthy. He based it on his ALGOL-W compiler which used recursive ascent, and as such while he was able to modify the syntax to a sufficient extent to break compatibility with ALGOL there were some things he couldn't manage in the timescale he thought available, e.g. if-then-else expressions. His later implementations used recursive descent, which is much more maintainable.

Apart from that I agree fully with Handoko but would throw in a little more history.

First, it's important to distinguish between Modula, which leaves few surviving traces, and Modula-2.

Turbo Pascal was rapidly and unexpectedly popular, but modifications to Pascal by UCSD and Borland messed up the language in various ways. Perhaps in recognition of this, Borland found themselves with an 8-bit Modula-2 that they preferred not to distribute. My understanding is that they licensed it to Echelon- Steve Ciarcia's company- in the 1980s, but he found it unsellable because they wouldn't license the manuals.

Niels Jensen, possibly with others, bought themselves out of Borland and founded JPI, which sold TopSpeed Modula-2 for DOS. Their George Barwood then did a binary patch on that to prevent segment registers being used for temporary storage, and used that to bootstrap v2 which supported OS/2 (in competition with Logitech's compiler etc.). In fairly short order they expanded that to v3 which also supported Pascal, C, C++ and the Clarion language- although the last of those wasn't really public- which targeted DOS, OS/2 and Windows. They attempted to expand to the USA, something went badly wrong (I believe I know what, but can't discuss it since if I'm wrong it will be libellous) and were bought by Clarion whereupon the JPI range vanished.

The perceptive reader will obviously see the parallel to the way that Embarcadero bought Codegear (nee Borland) for the sake of a development tool they used heavily in-house.

Modula-2 was used fairly heavily for embedded work since Ada was considered unworkable on account of its requirement for a "big" development system, there were various derivatives. I introduced it to Jim Cooling who wrote a couple of books and had a string of Saudi students using it.

Wirth had by then moved on to Oberon (the language) and Oberon (the operating system). But Hell, that's what academics do: once there's no more scope for paper publication they've got to find something new.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 8579
Re: What are Modula2 And Oberon?
« Reply #4 on: July 24, 2023, 09:07:19 am »
The most important change is in the base block layout.  BEGIN's that are not the start of a function are omitted, and blocks are mandatorily ended with END. (no single/multi line block difference).

The "dangling else" issue. Quite frankly I think that Wirth's ignoring this was inexcusable, since it had been identified as a problem and fixed in the ALGOL-68 definition: of which he was fully aware.

It could possibly be blamed on the fact that he was still stuck modifying a recursive-ascent compiler: the changes (and testing) were possibly beyond what he thought he could do during the timescale available.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

PierceNg

  • Sr. Member
  • ****
  • Posts: 443
    • SamadhiWeb
Re: What are Modula2 And Oberon?
« Reply #5 on: July 24, 2023, 09:44:53 am »
Also, will the tool I use be maintained in the future? Many said Pascal is dying, but it has been proved: Pascal is undying. If I study and use Oberon seriously and build commercial projects using it, what should I do if someday Mr. Wirth says he is working on a new fancy language and stops developing Oberon?

There are quite a few recent-ish Oberon implementations. Here's a non-exhaustive list of language implementations. Most of them are on Github, for the rest ask your favourite search engine.

- Component Pascal a.k.a Blackbox Component Builder
- Rochus Keller Oberon-07, implemented in C++ with Qt IDE, transpiles to C++, also generates LuaJIT bytecodes
- Rochus Keller Oberon+, implements union of Oberon-2 and Oberon-07 language features
- AntKrotov Oberon-7, a self-hosting compiler
- Oberon A2
- kekcleader Free Oberon, a cross-platform CUI IDE a la Turbo Pascal
- lboasso oberonc, self-hosting compiler targeting JVM
- obnc, transpiles to C
- ofront, transpiles to C
- Vishap Oberon

There are also several Oberon operating system implementations. 

People seem to like implementing Oberon. Not sure whether they implement stuff in Oberon though.

Handoko

  • Hero Member
  • *****
  • Posts: 5559
  • My goal: build my own game engine using Lazarus
Re: What are Modula2 And Oberon?
« Reply #6 on: July 24, 2023, 09:59:14 am »
Interesting.

When Oberon tools have matured and have larger userbase, I may give it a try.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8579
Re: What are Modula2 And Oberon?
« Reply #7 on: July 24, 2023, 10:13:52 am »
I'm not convinced that Oberon is really workable, but I have- so far at least- put very limited time into it.

I think more significant are the criticisms that the Pastel developers made of Pascal (see https://en.wikipedia.org/wiki/Pastel_(programming_language) ) and what Ken Thompson said about it ( https://www.lysator.liu.se/c/bwk-on-pascal.html ).

I'm left with the conviction that deep inside "Pascal as we know it" is a really nice core language, struggling to get out.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12984
  • FPC developer.
Re: What are Modula2 And Oberon?
« Reply #8 on: July 24, 2023, 10:59:17 am »
I of course also agree with Handoko (can you actually do something with it), and like Mark, I never saw much Oberon practical use either. Always studying and glossing over design details (like minimalistic grammar and unforgiving extreme everything-is-an object)

I never really bothered because IIRC they were both garbage collected (and if I go that way, I'd probably pick a Java or C#)

The biggest Modula3 application that I knew was FreeBSD's CVSUP.

Thaddy

  • Hero Member
  • *****
  • Posts: 19626
  • Glad to be alive.
Re: What are Modula2 And Oberon?
« Reply #9 on: July 24, 2023, 11:23:00 am »
The second link is an article by Brian Kernighan, not Ken Thomson, and from 1981.
Let's rebuke it:
Quote
To close, let me summarize the main points in the case against Pascal.

Since the size of an array is part of its type, it is not possible to write general-purpose routines, that is, to deal with arrays of different sizes.  In particular, string handling is very difficult.
Long since possible, dynamic arrays. And AnsiString/UnicodeString
Quote
The lack of static variables, initialization and a way to communicate non-hierarchically combine to destroy the ``locality'' of a program - variables require much more scope than they ought to.
Also long since added to modern dialects: Assignable typed consts.Also scoped local  initilization on declaration.
Quote
The one-pass nature of the language forces procedures and functions to be presented in an unnatural order; the enforced separation of various declarations scatters program components that logically belong together.
Modern Pascal is not strictly one pass anymore.
And separation of declaration and use can be seen as a blessing instead.[
Quote
The lack of separate compilation impedes the development of large programs and makes the use of libraries impossible.
Long since solved...And in a more elegant way than in C.
Quote
The order of logical expression evaluation cannot be controlled, which leads to convoluted code and extraneous variables.
It should not be controlled in the first place
Quote
The 'case' statement is emasculated because there is no default clause.
yes there is: it is called else.
Quote
The standard I/O is defective.  There is no sensible provision for dealing with files or program arguments as part of the standard language, and no extension mechanism.
Since long not true anymore.
Quote
The language lacks most of the tools needed for assembling large programs, most notably file inclusion.
Lacked. Not true anymore for modern Pascal dialects
Quote
There is no escape.
Of course there is, nowadays.

It is rather worrying that people tend to cite that article every so often, where every argument except maybe one, which I consider good instead of bad. None of the arguments hold for modern Pascal dialects.
« Last Edit: July 24, 2023, 12:24:12 pm by Thaddy »
Any "programmer" that knows only one programming language is not a programmer

Joanna

  • Hero Member
  • *****
  • Posts: 1464
Re: What are Modula2 And Oberon?
« Reply #10 on: July 24, 2023, 03:07:41 pm »
I didn't even know oberon existed if it were not for someone i know who wrote a bot with it. He once told me something like ... oberon eliminates bloated pascal features that aren't needed. I'm not sure what that means exactly..
Maybe people just were content with pascal and even if oberon or modula2 were better , they didn't think that switching to them was worth the effort.
Any language that doesn't have good gui support definitely isn't interesting for me.
its a vicious cycle of nobody wants to use because it wasn't popular enough for people to create enough useful libraries.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: What are Modula2 And Oberon?
« Reply #11 on: July 24, 2023, 04:07:11 pm »
Oberon as a language is very usable, especially the -07 and Active variant. Libraries, however, still stands as the biggest barrier, added with the lack of demonstration of real world programs, keeping the language in the dark despite from living POV, it's pretty much alive. BlackBox Component Builder has a great protential for marketing, but I don't like their modeless dialog design decision. In short, Oberon needs more than what Free Pascal needs to break the market. We are helped by the popularity of Turbo Pascal which is continued by Delphi, Oberon simply doesn't have such a luxury.

Kays

  • Hero Member
  • *****
  • Posts: 632
  • Whasup!?
    • KaiBurghardt.de
Re: What are Modula2 And Oberon?
« Reply #12 on: July 24, 2023, 06:16:28 pm »
[…] If you use Pascal a lot, you will know Pascal's structure has many inconsistency. […]
Which inconsistencies? Pascal is consistent, yet some implementations weren’t that consistent.

[…] Simple, the answer is programmers do not choose the language just because the language itself is better than others. There are many things in the consideration. For me, these are important: […]
A language has to gain traction in the first place so all these things get developed by people with the proper expertise. This usually meant a commercial company adopting it (e. g. like Borland did).

[…] If I have problem when using Modula or Oberon, where should I ask to? […]
If you are a fluent user of that internetwork thing, you will know about comp.lang.oberon (and comp.lang.modula2), sites such as Stackexchange, or simply write an email to the people providing the implementation you’re using.

PS: I do not endorse the use of any services offered by Stack Exchange Inc.
« Last Edit: July 28, 2023, 03:36:48 pm by Kays »
Yours Sincerely
Kai Burghardt

Handoko

  • Hero Member
  • *****
  • Posts: 5559
  • My goal: build my own game engine using Lazarus
Re: What are Modula2 And Oberon?
« Reply #13 on: July 24, 2023, 07:08:22 pm »
Which inconsistencies? Pascal is consistent, yet some implementations weren’t that consistent.

I care less about the inconsistencies, as I already said, to me the tools are more important than the language itself. But I can see from what you said, it was inconsistent.

A language has to gain traction in the first place so all these things get developed by people with the proper expertise. This usually meant a commercial company adopting it (e. g. like Borland did).

I agree with you. That's why I said when they (the tools) are matured and have larger userbase, I may give it a try.

If you are a fluent user of that internetwork thing, you will know about comp.lang.oberon (and comp.lang.modula2), sites such as Stackexchange, or simply write an email to the people providing the implementation you’re using.

Well, thank you. Apparently I am not a fluent internetwork user. See the attached screenshots.

Now I wonder if Modula or Oberon is really that good, why no one care to build a forum for them. Some less popular BASIC implementations even have their own forum, like SpiderBasic, PureBasic, etc.
« Last Edit: July 24, 2023, 07:27:19 pm by Handoko »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12984
  • FPC developer.
Re: What are Modula2 And Oberon?
« Reply #14 on: July 24, 2023, 09:23:30 pm »
comp.lang.modula2 was reasonably busy in the late nineties and early 2000s.

 

TinyPortal © 2005-2018