News for hackers. Stuff that matters.
Re:Modula-2 Reloaded – A Modern Typesafe and Literate Progra... by woah on Monday December 28, 2015 @09:32AM (#10801203)
I wish they would show us some code.
Re:Modula-2 Reloaded – A Modern Typesafe and Literate Progra... by jksmith on Monday December 28, 2015 @10:42AM (#10801569)
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.

Re:Modula-2 Reloaded – A Modern Typesafe and Literate Progra... by ksherlock on Monday December 28, 2015 @10:34AM (#10801532)
The bootstrap compiler source code (at least what there is of it) is here:

https://bitbucket.org/trijezdci/m2r10/src/tip/bootstrap/m2bs...

That should either whet your appetite or make you throw up in your mouth.

Re:Modula-2 Reloaded – A Modern Typesafe and Literate Progra... by said on Monday December 28, 2015 @09:42AM (#10801256)
They have some examples tucked away behind the Examples link on the left:

http://modula-2.info/m2r10/pmwiki.php/Examples/ObjectOriente...

Re:Modula-2 Reloaded – A Modern Typesafe and Literate Progra... by jksmith on Monday December 28, 2015 @11:01AM (#10801706)
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.