Path: utzoo!utgpu!watmath!att!ucbvax!hplabs!hpfcdc!marc From: marc@hpfcdc.HP.COM (Marc[e] Sabatella) Newsgroups: comp.lang.misc Subject: Re: Ada Generics (was Which language to teach first?) Message-ID: <5160025@hpfcdc.HP.COM> Date: 16 Aug 89 22:30:36 GMT References: <6448@ux.cs.man.ac.uk> Organization: HP Ft. Collins, Co. Lines: 63 #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: > You yourself said that the above example would produce an error, granted > I don't know whether you mean logical or compiler He meant what he said - the complier does not complain, but the code is in fact wrong. So rather than finding your mistake at compile time, where the compiler can tell you the line number the error occurred on, you are forced to run the program, maybe notice the results are wrong, and then debug it. That is why some people consider it *good* when a compiler is able to find more of your errors, which is why these people like strong type checking. # 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? No, but when he takes the next course, he doesn't have to switch languages. > 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? No, the point is that some things that qualify only as "logical" errors in Pascal (ie, the apples and oranges type mismatch example above) and can be discovered earlier in Ada. A beginning programmer is likely to make the same number of mistakes in either language; in Ada, a higher percentage are discovered for you by the compiler. The fact that *you* spent a long time trying to deal with syntax error messages in Ada says more about you than about the language. No, not that you are stupid, but that you are probably approaching the problem from a Pascal standpoint, and are falling on Pascal-ism's which don't work in Ada. > Now, you'll tell me that Pascal cannot > be split? No, it can't. Read the language definition some time. Now, it is true that several 'real world' compilers (most, perhaps) allow it. Most don't do as much type checking as they could have with one source file, or as much as Ada could with its eyes closed and one hand tied behind its back. > In one of my classes, we had an asignment - write *4* *seperate* > *modules* in Pascal that would each do a specific thing. No, you had an assignment to write four separate modules in a nonstandard Pascal variant. Which is useless in the "real world", or on a different machine in school, or when you transfer to a different school, etc. (they will each have a different nonstandard Pascal variant). Unrelated to the issue of can you teach abstraction, modularity, and reusability in Pascal, but yet another strike against it - Pascal learned and written on one system is useless on another. This doesn't have much of a bearing on education, though, unless you advocate that students should learn the language they will use in the real world, in which case, the sad truth is still "learn COBOL, Fortran, and/or C". -------------- Marc Sabatella HP Colorado Language Lab marc%hpfcrt@hplabs.hp.com