Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!aplcen!aplvax.jhuapl.edu!genesch
From: genesch@aplvax.jhuapl.edu (Eugene Schwartzman)
Newsgroups: comp.lang.misc
Subject: Re: Which language to teach first?
Message-ID: <2685@aplcen.apl.jhu.edu>
Date: 16 Aug 89 14:33:16 GMT
Sender: news@aplcen.apl.jhu.edu
Reply-To: genesch@aplvax.jhuapl.edu (Eugene Schwartzman)
Organization: The Johns Hopkins University Applied Physics Laboratory
Lines: 162

In article <169@enea.se> sommar@enea.se (Erland Sommarskog) writes:
#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.

	You yourself said that the above example would produce an error, granted
	I don't know whether you mean logical or compiler...  Honestly, I don't
	know how the compiler would handle it, but if I remember anything from
	one of my classes, it would gripe and tell you that they type are
	incompatible.  Also, the two ranges are different, sooner or later it
	would crash anyway and the problem would be discovered (hopefully, in
	the testing stages :-)

#  Add to this private types, limited private types and you already
#have more devices in Ada than Pascal to enforce real data abstraction.

	Ok, but why does a *beginning* level student need them?
#
#>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.

	I am not surehow you define debug, but I define it as fixing the logical
	problems.  So, if you spend more time figuring out syntax errors with
	Ada and same time for logical errors with Ada and Pascal, which one
	takes more time to write a program in?

#  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!)

	Are you crazy? :-) Who in their right mind would write something that
	big as a single source file?  Now, you'll tell me that Pascal cannot
	be split? To that I say, that according to a lot of my friends who
	have worked in the 'real' world with Pascal to write a large program,
	Pascal can be split up, very easily.
#
#>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.

	So what are you saying, that something like that can't happen in Ada?

#  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.

	True, but how many *good* programmers are out there vs. not very good
	ones.  I know, it would be an ideal world if only the best did all of
	the work, but unfortunately that is not the case and the poor ones are
	needed to do the work the good ones wont.  EEEhhhhh, maybe not a very
	good argument, but then again, there are many CS majors who do not
	want to do any programming, but want to do things like Numerical
	Anyalysis, Theory, etc... that don't require programming (or at least
	a lot of programming)  I can hear it now - "THEY SHOULD BE MATH MAJORS!"
	Well, maybe they should, but they chose CS, and losing them might be
	bad, especially if later they turn out to be very good.
#
#>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.

	I am not arguing with you at all on this issue.  All I am pointing out
	is just because a language is not right for you, does not mean that it
	is not right for others.  I would like to do work in AI, does that mean
	that Assemply is a toy language because it's not very useful for AI, NO!
	(Read all with a :-)
#
#>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.)

	Maybe that's the problem (VAX Pascal).  Let me tell you a story...
	In one of my classes, we had an asignment - write *4* *seperate*
	*modules* in Pascal that would each do a specific thing.  Write a
	test program to link them with and make sure they work.  Then, once
	thay are done, they would be linked in with our professor's code
	and he would test it.  This was done without knowing what the data
	staructure is/was.  All we were told was what will be passed in and
	out of the modules.  Now, you tell me, is there or is there not a
	module concept in Pascal (granted I was using Pascal/VS) (also see above
	in article).  Maybe there isn't one in VAX version, but there certainly
	is one. 

gene schwartzman
genesch@aplvax.jhuapl.edu
_______________________________________________________________________________
| GO BEARS, GO CUBS, GO WHITE SOX, GO BULLS, GO BLACKHAWKS, GO TERPS !!!!!    |
| Soccer is a kick in the grass (and sometimes on astroturf)!                 |
| GO DIPLOMATS, GO STARS, GO BAYS, GO BLAST !!!!		              |	
| CFL -> GO EDMONTON ESKIMOS!!!!   VFL -> GO CARLTON BLUES !!!!		      |
|_____________________________________________________________________________|
Disclaimer:  These are my opinions and not of my employer.