3 ms·
I wish they would show us some code.
by woah 11y ago
I 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.