Article View: comp.lang.modula2
Article #4164Re: Anyone seen a good Amiga Pascal lately ? Why not Modula-2?
From: John Schultz
Date: Sat, 02 Apr 1988 21:54
Date: Sat, 02 Apr 1988 21:54
83 lines
3016 bytes
3016 bytes
In article <764@ndsuvax.UUCP> ncreed@ndsuvax.UUCP (Walter Reed) writes:
>There are two major beefs I have with modula-2.
>1. Modula does not allow a variable number of parameters in function calls.
>2. Bitwise operators are not available (at least not standard.)
>Minor beef:
> Begin end's required even when only one statment used.
Addressing 1: Register oriented AOT stack oriented as in C
(although I heard that Lattice now has register optimization). This
is much faster runtime, although more verbose for the user.
Benchmark has C routines such as printf, etc., but you must first
initialize the parameter array before calling printf (still pretty
nice though).
2. Modula-2 has *ALWAYS* had bitwise operators. They are:
+ : inclusive OR
* : AND
/ : exclusive OR
These operators have special meaning only when applied to BITSET
types. For example:
CONST
mask = BITSET(15);
VAR
rotation : CARDINAL;
BEGIN
rotation := 0;
...
rotation := CARDINAL(BITSET(rotation+1)*mask);
...
Here we can increment a value from 0 to 15 and back again without
any bounds checking. In C we could do:
rotation = (rotation + 1) & 0xf; or maybe
rotation = ++rotation & 0xf; or maybe
++rotation &= 0xf;
Much less typing, but the same result.
The *only* time BEGINs are used in Modula-2 are for the start of
program code for PROCEDUREs or main MODULES. Everything terminates
with an END. This is an improvement over Pascal and C, as it stops
possible errors before they can start.
>Here is an example of why these things bother me.
>
>Pascal:
> If (x = True) Then
> WriteLn('Error #',e,' in line #',l,' detected.');
Why not:
IF x THEN printf(); END;
>M2 is too verbose.
Yeah, well, everything you want is available in C. Now, if you
want the MODULE construct, etc. native to M2, the 10000-30000 lines
per minute compilation times, "instant" linking, then take another
look at M2.
> Shifting...
FROM SYSTEM IMPORT SHIFT (* example code *)
SHIFT(x,1) x is unsgned, logical SL
SHIFT(x,1) x is sgned, artihmetic SL
SHIFT(x,-1) ... SR
It's all there. Remember M2 was created for the development of
large, system level software (like operating systems).
Other than for personal taste, and/or development
speed/portability, you can do anything on the Amiga with any of the
popular compiled languages available today.
John
Technical Details
Message-ID:
<833@sdcc8.ucsd.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!pacbell!ames!ucsd!sdcc6!sdcc8!cs178abuReferences:
<764@ndsuvax.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!pacbell!ames!ucsd!sdcc6!sdcc8!cs178abu From: cs178abu@sdcc8.ucsd.EDU (John Schultz) Newsgroups: comp.lang.modula2 Subject: Re: Anyone seen a good Amiga Pascal lately ? Why not Modula-2? Message-ID: <833@sdcc8.ucsd.EDU> Date: 2 Apr 88 21:54:52 GMT References: <764@ndsuvax.UUCP> Reply-To: cs178abu@sdcc8.ucsd.edu.UUCP (John Schultz) Organization: University of California, San Diego Lines: 83