Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!seismo!sundc!pitstop!sun!amdcad!ames!mailrus!bbn!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.std.c Subject: Re: Typedef names vs. new types. Message-ID: <10186@haddock.ima.isc.com> Date: 28 Oct 88 18:45:08 GMT Article-I.D.: haddock.10186 References: <3355@pt.cs.cmu.edu> <10006@haddock.ima.isc.com> <8755@smoke.BRL.MIL> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 27 In article <8755@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn) writes: >In article <10006@haddock.ima.isc.com> karl@haddock (Karl Heuer) writes: >>Let's enhance the syntax of declarations to include a dimension-specifier... > >Unfortunately this is too simplistic. For example, there are several >ways to combine the Cartesian-projected elements of a tensor to produce >a quantity having different dimension, but the resulting dimension is >not ascertainable from a syntactic analysis of the combination. Also, >units that people usually consider different turn out to be the same >when one has a sufficiently powerful physical theory. I think my proposal could handle the latter situation; if you want to freely mix (say) distance and time, you can declare them to be the same unit, while if you prefer to treat them as independent, you can explicitly multiply by speed_of_light (which would have value 1, so the compiler can optimize it out, but dimensions of velocity, so CDA would sanction it). If the tensor problem can't be resolved at compile-time, then of course CDA can't do anything about it. (But it can still pass it through with no warnings; CDA includes C as a trivial case.) I could live with that; it's no worse than what we have now. Similarly, I described the language as being able to handle dimensions that were a composite of additive and multiplicative units, but aside from the temperature-conversion example I can't think of any applications for it, so I'd probably drop that feature (provided it's still possible to get array-by-enum working). Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint