Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!kth!sunic!enea!sommar
From: sommar@enea.se (Erland Sommarskog)
Newsgroups: comp.lang.misc
Subject: VAR vs. IN/OUT
Message-ID: <173@enea.se>
Date: 10 Aug 89 22:20:24 GMT
Organization: Enea Data AB, Sweden
Lines: 35

In the on-going Pascal-Ada war Eugene Schwartzman (genesch@aplvax.jhuapl.edu) 
compares Ada's IN/OUT with Pascal's VAR:
>#Ada
>#is better for students, because many problems I encounter are people who
>#cannot quite remember when to use 'var' in a paramater declaration.  'in'
>#and 'out' are very obvious.
>
>       Well, then they are just plain stupid and don't deserve to be in
>       programming to begin with.  The first programs I wrote all used
>       'var', we didn't even get into value passing until we ran into
>       recursion.  With Ada, you need to remember when to use in/out and
>       when not too, granted it is very obvious, but even still with them
>       you have in, out, in/out combinations, with 'var' you have just one
>       'VAR'.

So you mean that the beginner's shouldn't learn the differene between
different parameter modes? But how to avoid that they by accident modify
their inparameters? And how do you explain that they never can have
expression as actual parameters, but always must have a temporary variable 
for that. God! Are there really places teaching programming like this?
Yes, in Ada you must know when to use IN, OUT or IN OUT, but for heaven's
sake the distinction between those modes are compulsary in beginner's
programming course, no matter which language you are using. Ada just happen 
to have very suitable notation.
  When I learnt Pascal as a freshman (well, we had some Fortrans first)
we were told something like you use VAR when you want the parameter to
be modified, or if you are passing a large parameter to improve
performance. Confusing if anything.
  (And besides your ridiculous argument doesn't hold a second. If you
really want one passing mode only, fine. Just declare all parameters
IN OUT. Not to recommend, but neither would I recommend *any* Pascal
programmer to declare all his variables as VAR.)
-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
"Hey poor, you don't have to be Jesus!" - Front 242