7 ms·
Modula-2 Reloaded – A Modern Typesafe and Literate Programming Language
- mhd 11y agoCan 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".
- incepted 11y agoWhenever I read a Modula 2 source, I get the feeling the programmer is yelling at me.
- Animats 11y agoThe 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.
- woah 11y agoI wish they would show us some code.
- said 11y agoThey have some examples tucked away behind the Examples link on the left: http://modula-2.info/m2r10/pmwiki.php/Examples/ObjectOrientedProgramming http://modula-2.info/m2r10/pmwiki.php/Examples/ObjectOriente...
- ksherlock 11y agoThe bootstrap compiler source code (at least what there is of it) is here: https://bitbucket.org/trijezdci/m2r10/src/tip/bootstrap/m2bst/ https://bitbucket.org/trijezdci/m2r10/src/tip/bootstrap/m2bs... That should either whet your appetite or make you throw up in your mouth.
- jksmith 11y agoVery 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.
- jksmith 11y agoFrom 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.
- brakmic 11y agoDon'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/ https://modula3.elegosoft.com/cm3/ They've also moved their sources to GitHub: https://github.com/modula3/cm3 https://github.com/modula3/cm3
- jk4930 11y agoPlease 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://libre.adacore.com/ http://www.ada2012.org/ http://www.ada2012.org/ http://spark-2014.org/ http://spark-2014.org/
- mhd 11y agoThey still have the runtime under the GPL, right? So you'd have to pay for the Pro version to distribute non-libre binaries.
- pekk 11y agoYou 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.
- zokier 11y agoThe 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?
- MrRage 11y agoI 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.
- pjmlp 11y ago> 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.
- frik 11y agoWhat'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.
- clouddrover 11y agoI don't think Pascal is almost forgotten. Free Pascal (http://www.freepascal.org http://www.freepascal.org) and Delphi (http://www.embarcadero.com/products/delphi http://www.embarcadero.com/products/delphi) are both strong Object Pascal implementations. There's also Lazarus (http://www.lazarus-ide.org/ http://www.lazarus-ide.org/) which is a Delphi-like IDE and libraries for Free Pascal.
- eukgoekoko 11y ago> http://modula-2.info 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?
- 11thEarlOfMar 11y agoDr. Dobb's Modula-2 article, ca. 1991 (I worked for Multiscope at the time): http://www.drdobbs.com/whats-new-with-modula-2/184408565 http://www.drdobbs.com/whats-new-with-modula-2/184408565
- Animats 11y agoIt'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.
- cbd1984 11y ago> 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.