classiccmp-digest V1 #690

From: R. D. Davis <rdd_at_smart.net>
Date: Fri Aug 17 12:15:48 2001

On Fri, 17 Aug 2001, Alan Pearson wrote:
> We were taught PASCAL and 6809 assembly in my first year at college, both
[...]
> Compare the possible pitfalls in here (what are INPUT, OUTPUT? why no
> semicolon after BEGIN and WHILE (TRUE)? why a full stop after the last END?
> what does 'while true' really mean anyway? etc)

It never made sense to me why they continued using Pascal after Modula-2
came out, as it's much more straightforward, and is great for writing
large programs. Ok, there's some additional work for programmers like
the FROM statements, but that's no worse than C's include statements.

For example, the following:

> PROGRAM SayHello(INPUT, OUTPUT)
> BEGIN
> WHILE (TRUE)
> BEGIN
> WRITELN('Hello World');
> END;
> END.

Would become something like:

MODULE Foo;
FROM InOut IMPORT WriteLine;
BEGIN
WHILE TRUE DO
   WriteLine("Hello World");
END;
END Foo.

On PCs running PC-DOS, the really neat thing about FST Modula-2 was that one
could write programs such as the following module. :-)

MODULE Sound;
FROM SYSTEM IMPORT ASSEMBLER;
BEGIN
ASM
            PUSH AX
            PUSH BX
            PUSH CX
            PUSH DX
            MOV DX, 1200
            IN AL, 61H
            AND AL, 0FEH
   AGAIN: OR AL, 2
            OUT 61H, AL
            MOV CX, 233
   WAIT1: LOOP WAIT1
            AND AL, 0FDH
            OUT 61H, AL
            MOV CX, 233
   WAIT2: LOOP WAIT2
            DEC DX
            JNZ AGAIN
            POP DX
            POP CX
            POP BX
            POP AX
END;
END Sound.

The best of both worlds, what? :-)

> BASIC's appeal was its simplicity and immediacy. I don't agree with Wirth
> that it pollutes the mind irrevocably either, I mostly use C++ or Java these
> days and never have to use the much-maligned 'goto'. The only time I use

As one who had to unscramble and re-write some very lengthy BASIC code
with two-digit character names and very, very, few comments, multiple
statments on single lines, lots of gotos and gosubs, some of which
actually went nowhere in the end when earlier changes had been made in
the code, I can understand why the dislike for BASIC exists. BASIC is
great for small programs, but not so good for other things if
carelessly written. Of course, I can see where it helps some
programmers familiar with such spaghetti code to keep their jobs, as
replacing some of them may be difficult.

Disclaimer: Having writen some obfuscated C code, I have no right to
criticize the "spaghetti BASIC" coders. ...of course, as we all know,
C is a more legtimate language than BASIC, since it can be obfuscated
to a level far beyond the comprehension of BASIC programmers. ;-)

--
Copyright (C) 2001 R. D. Davis The difference between humans & other animals: 
All Rights Reserved            an unnatural belief that we're above Nature & 
rdd_at_rddavis.net  410-744-4900  her other creatures, using dogma to justify such
http://www.rddavis.net         beliefs and to justify much human cruelty.
Received on Fri Aug 17 2001 - 12:15:48 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:33 BST