Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!mcvax!kth!sunic!enea!sommar
From: sommar@enea.se (Erland Sommarskog)
Newsgroups: comp.lang.misc
Subject: Re: Which language to teach first?
Message-ID: <169@enea.se>
Date: 8 Aug 89 22:24:04 GMT
Organization: Enea Data AB, Sweden
Lines: 118

Eugene Schwartzman (genesch@aplvax.jhuapl.edu) writes:
>	Why Pascal, it's just as strongly typed as ADA?

Certainly not. Pascal is a weakly typed language. Period.
Look at this:

    TYPE  Apple_type  = 0..Max_apples;
          Orange_type = 0..Max_oranges;
    ...
    PROCEDURE Macedonia(Apple  : Apple_type;
                        Orange : Orange_type);
    BEGIN
       ...
    END;
    ...
    VAR   Apple  : Apple_type;
          Orange : Orange_type;
    BEGIN
       ...
       Macedonia(Orange, Apple);    <--  Probably an error!
       ...
    END.

We forgot the order of the parameters and swapped them. But does
the compiler complain? No, integer to integer, perfectly OK. You
call that stronly typed? I don't. In Ada you can say:
    TYPE Apple_type IS NEW integer RANGE 0..Max_Apples;
and then similar for Orange_type. If you really want to mix apples
and oranges, you can do this with an explicit type conversion. If
you want do it often you can still declare the types similar to
Pascal.
  Add to this private types, limited private types and you already
have more devices in Ada than Pascal to enforce real data abstraction.

>#But as I said, that is for people who would grew up and be like me.
>
>	It seems to me that your are pushing ADA merely based on the fact that
>it is useful for the system *you* work with.

Now, you had the bad taste to quote my article in entirety. Didn't
you even read it? Read the line above again. Your observation is totally
superfluous.

>Why? Personal example - I wrote a *very* small
>program (2 -3 packages, ~10 lines/package) and it took me days to figure out
>why I kept getting certain syntax error (not that the errors themselves were
>very helpful).

One thing is true. It takes longer to time to get an Ada module
free from compilation errors. The reason is simple. The compiler
finds more errors for you. So you gain that when you debug. Yes,
correct, that is not applicable on syntax errors. Tell you what,
with a limited knowledge in Pascal and bad compiler messages you
would have exactly the same problem.
  Then it could also be added that Ada is not at optimum for programs
at that size, but it is never a real problem. Not even in a beginner's
course. As a contra, why don't you try to write a 2.000.000 line
artillery control system in standard Pascal. (One single source file!)

>but imagine a biginning student running into that.  You know what he'll 
>do - say "fuck this"drop class, and switch majors.  I know, because
>I've seen many people drop simply because they were having trouble 
>with the language.

A freshman would probably have less problems than you. His mind
wouldn't be set up thinking in Pascal ways. And, he would be just
as likely to run in those problems in Pascal. What about this one?
      IF Something THEN
         IF And_this_to THEN
            Do_this;
      ELSE
         Do_that;
First our student gets a syntax error on the ";" before ELSE which
he doesn't understand. (Believe. I have teached Pascal to freshmen.)
When he gets that he remove the semicolon, the program compiles, but
doesn't run corectly. Well, not really a novice error. I have had 
colleagues that have done the same error and been fooled by the 
indentation.
  As for giving up; if they give up because of the language, that might
be just as well. With that motivation I doubt that they would be any
good programmers anyway.

>As far as Lisp being a toy language, I would like to see you do AI work 
>in Ada....

Yes, but people like me don't write AI. :-) Seriously, I don't
doubt a second that Lisp is good in AI and similar small systems.
But with the stuff I'm involved in, it's not a serious alternative.
And, I might be totally wrong, but I have this idea that this
apply to the main bulk of programmers.

>but do to AI work, it's great.  As far as Ada being real-world,
>I'd have to disagree with you very loudly.  The only "real" world that uses it
>with any regularity is government and military.

Bill Wolfe has already commented this, but let me just second. The
talk that Ada is only used in military application is just a myth.
It's probably more common there than elsewhere, due to the require-
ments from the customers, but also because that military systems
often are big in size. And Ada was developed for large systems...

>restrictive.  If you really want to teach reusability, restrictiveness, etc..
>use Pascal, it has all of that, but Pascal also gives you lot's of freedom if
>needed, something Ada doesn't have.

This is where I have some problem to remain polite. That must be a joke.
Tell me you forgot the smiley. How the !"#$%&/() can Pascal be reusable
when there is no module concept in the language? You cannot reuse a
bloody thing from your one-file program, except by copying code, and,
believe me, that has nothing to do with reusability.

And before you go on and accuse me as you did with Bill Wolfe for
not knowing Pascal, I tell you. I work with the shit. Every day.
(VAX-Pascal though, which is a good deal better than standard
Pascal, but totally unportable.)
-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
"Hey poor, you don't have to be Jesus!" - Front 242