From: ralpht@meaddata.com (Ralph W. Trickey)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Newbie Wants Advice on C-Programming
Date: 29 Dec 1992 14:09:31 GMT
Organization: Mead Data Central, Dayton OH
Distribution: world
NNTP-Posting-Host: retina.meaddata.com

In article <1992Dec27.031157.27179@mole-end.matawan.nj.us>, mat@mole-end.matawan.nj.us writes:
|> In article <1992Dec25.070024.15672@grebyn.com>, malak@grebyn.com (Michael Malak) writes:
|> > In article <1hdpluINN1lv@agate.berkeley.edu> faustus@ygdrasil.CS.Berkeley.EDU (Wayne A. Christopher) writes:
|> > >In article <1992Dec24.172333.7339@grebyn.com> malak@grebyn.com (Michael Malak) writes:
|> 
|> > >> ...  I feel the following must be learned in order:
|> > >>   1) Pascal, with two semesters experience
|> 
|> > >IMHO, Pascal has nothing useful that C doesn't have, except for array
|> > >bounds checking.  You you use C++ you can use a vector class that
|> > >gives you that.
|> 
|> > Pascal has the following advantages over C:
|> >    1) It has structured syntactic blocks for constants, types and
|> >       variables.
|> 
|> This is no advantage.
|> 
|> A program is a model: an abstraction expressed in a representation.  The
|> Pascal seperation of constant, type, and variable classifies the tools of
|> representation; it is irrelevant within a program.  Would you require a
|> cook to measure out all the ingredients specified by tablespoons before
|> measuring any ingredient specified by cups?
|>  

The MS-DOS Pascals I have worked with allow more than one of each type
of block. You can have a type, followed by a const, followed by
another type.

|> >    2) It has nested procedures.
|> 
|> True to a point.  See Kernighan's _Why Pascal is not my Favorite Programming
|> Language_ for the limitations of nested procedures.
|>  
|> >    3) Most importantly, the good structured programming professors
|> >       wouldn't be caught dead teaching C (biggotry in my opinion).
|> 
|> Besides which, people who learn Pascal first seem to take three or four
|> times as long to learn how to use C pointers as people who don't learn
|> Pascal at all, and Pascal introduces people to some really poor
habits.

Could you explain why that might be? I see no difference between
pointers in Pascal and pointers in C. Could it be that the people that
were using Pascal were fresh out of college, as opposed to people that
had been programming professionally for a while?

|> 
|> The classical Pascal expression of a loop-and-a-half cannot be written
|> as a while() because Pascal's expression syntax is too weak.  It cannot
|> be written as a loop-and-a-half because Pascal doesn't allow a `break'
|> from a loop.  What results is a circumlocution involving more code in
|> control flow and temporary variable managing than in solving the problem;
|> worse, one branch of an  if-then  is related to the circumlocution and
|> one to the problem to be solved.  This is a very bad form of incohesion:
|> 
|> 	if not X
|> 		manage the loop
|> 	else
|> 		solve the problem
|> 
|> This seems to me as damaging to potential software designers as BASIC
|> is claimed to be to potential programmers.

  That was solved that a long time ago, simply create another nested
procedure that contains the loop, and exit from the nested procedure
to exit from the loop.

  In addition I believe that Metaware Pascal has had break
statements for at least the last 4 years (also iterators). Borland
Pascal 7.0 now includes break and continue statements.

  I will agree that ISO standard pascal would be a poor method of
learning, but take a look at a modern Pascal, like Borland's Pascal
7.0. It bears the same resemblance to ISO Pascal, that C++ bears to C.
It even has single inheritance.


-- 
Ralph Trickey       | (513) 865-6800                  |    	
Mead Data Central   | x4870                           |  Disclaimer
P.O. Box 933        | ralpht@meaddata.com             |  My opinions are my own
Dayton, Ohio  45401 | ...!uunet!meaddata!ralpht       |


Newsgroups: comp.os.msdos.programmer