[comp.lang.misc] Type and range checking

sommar@enea.UUCP (Erland Sommarskog) (01/11/87)

In article <3330@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes:
>Perhaps its semantics. You call it type-checking. I'll call it
>type-obsession. When type-checking becomes so strong as to make it
>impossible to write a general purpose sort() subroutine or string
>handling library then yes, it is type-checking gone mad.

("Type-obsession", that was almost funny.) But if you get the possibility
to write the general-pupose routine WITH type checking? Pascal doesn't
permit that, but Ada does. OK, you mainly talk of Pascal, but at least in your
prevoius article you talked about "Pascal and its successors". I would count
Ada to one of them.

>had a different multiply routine packaged in it. I don't see things
>as much different in the Pascal world. Software just isn't re-useable.
That's why we have Ada.
>Do you think writing a sort routine or string package once and reusing
>it a 'trick'?  How about a math library?
Once again, do it in Ada.

>
>   ... discussion that claims that Pascal was a mistake as an 
>       introductory langauge.
I agree with you on this point. What Wirth and no one else probably didn't
realize is that the language you learn first is the one you know best and
the one you prefer. My first programming course started with Fortran and
concluded with Pascal. Though I use Fortran very little I know it quite well.
The use of extentions in Pascal doesn't make things better.
  Wirth has since then introduced Modula-2 which is more or less just another
Pascal-extention. It's more flexible than Pascal, but it fails on the fact
that I/O isn't standardized.
  To attach to another current subject, teaching Ada as the first language
would be much better. Ada is large but you don't have to learn all at once, 
have you. 
>
>As to TeX, I know, it seems to be the only program ever written in
>standard pascal so everyone points it out when these things come up:
>	
>   ... lots of details of TeX
>
>If you think TeX is the shape of the future of software engineering
>than god help us all...

Well I do not. I just gave a counter example of your assertion that very
little useful software had been written in Pascal. TeX is useful, isn't?
Or did you mean useful in the sense "reuseable"? That's a completely other
thing.

And so to the next guy:
From: holloway@drivax.UUCP (Bruce Holloway)
>Let the compiler do the type checking... so long as it stays there. Pascal
>puts in a lot of code for array overruns, etc., that are unnecessary for
>a well-designed program. You could turn all this off on the Pascal I learned
>on, which made it tolerable. But I don't want anything in the program I didn't
>put there -- if I'd wanted subscript checking, I would have added it.

Of course one should have array and subrange checking as much as possible
during the testing. Adding them yourself? But if you make a careless mistake
that makes them go wrong? And the time to write them? Don't we have computers
to do such things automatically?
  Well-designed program? What about:
  WHILE A(.i.) <> 0 DO
and you forget to initiate i? Bad design? With range check there is a good
chance the programme crashes immediately revealing the error. Without
range checking you may have to search a long time for it.
  Of course a good compiler should have a switch to turn checking on and
off. I compile my programs /CHECK/DEBUG/NOOPTIMIZE (this is VMS) when I 
develop, and when I imagine that they work I switch to /NODEB/NOCHECK/
OPTIMIZE. (The reason I exclude the optimizer is because it is very 
fond of expanding procedures to inline code, which confuses you when 
debugging.)
 

lum@osupyr.UUCP (Lum Johnson) (01/14/87)

In article <1638@enea.UUCP> sommar@enea.UUCP (Erland Sommarskog) writes:
>In article <3330@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes:
>>   ... discussion that claims that Pascal was a mistake as an 
>>       introductory langauge.
>I agree with you on this point. What Wirth and no one else probably didn't
>realize is that the language you learn first is the one you know best and
>the one you prefer. My first programming course started with Fortran and
>concluded with Pascal. Though I use Fortran very little I know it quite well.
>The use of extentions in Pascal doesn't make things better.

Are you sure?  I started with BASIC, went rapidly through FORTRAN, PL/I,
ALGOL, and LISP, and ended up using assembly language because I can't cope
with all the "help" compilers want to give me without my asking for it.
I can't even tolerate PASCAL and its descendants.

However, my favorite and best understood language is TECO, the "assembly
language" in which EMACS is written.  Of course, although I can write it
quickly and easily, I can't really read it - almost no one can.

Lum Johnson  lum@ohio-state.arpa  ..!cbosgd!osu-eddie!lum