Newsgroups: comp.lang.misc Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!lavaca.uh.edu!menudo.uh.edu!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Subject: Re: Dynamic typing (part 3) Message-ID: Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC References: <815@optima.cs.arizona.edu> Date: Tue, 19 Mar 91 22:56:24 GMT In article <815@optima.cs.arizona.edu> gudeman@cs.arizona.edu (David Gudeman) writes: > In article Peter da Silva writes: > ]But if you don't know that y is complex, you don't know if "y <= 0" is > ]legal or not... > If you don't know the length of A, you don't know whether "A[i]" is > legal or not. So? You should know the length of A and you should > know the type of y. In someone elses code, if you see "y <= 0", > then you can assume that y is not complex. In you own code, if you > know that y is not complex you can write "y <= 0". There is no > ambiguity. This is fine if the code is: Known to be correct and debugged, and/or Your code, and You wrote it recently, or You just finished tracing it all and thus know it intimately. For maintainable code you need to document all these things. Now you can either type in declaractions, or you can type in comments that are the equivalent, but the compiler can no longer use this information to help you support the software. > This is a trivial logical inference: > (1) y is complex implies "y <= 0" is not meaningful > (2) "y <= 0" is meaningful > therefore > (3) y is not complex > There is nothing sloppy or ambiguous about this reasoning. Sure, it's got an unstated and unsupported assumption: that the code is correct. -- Peter da Silva. `-_-' peter@ferranti.com +1 713 274 5180. 'U` "Have you hugged your wolf today?"