From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Incompatible types for array conversion Date: Wed, 22 Jul 2015 16:22:35 +0200 Organization: A noiseless patient Spider Message-ID: References: Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 22 Jul 2015 14:21:05 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="28431"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VfQT6QbI/i9jAt5RJ+h6Gz7yzzAx+Nzo=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: Cancel-Lock: sha1:uHfPum9szwpArVItODZS9CxsxP0= Xref: news.eternal-september.org comp.lang.ada:26986 Date: 2015-07-22T16:22:35+02:00 List-Id: On 22.07.15 14:57, hreba wrote: >> That's exactly turning the accidental relationship due to >> assumed similarity of component types into a relationship >> of Direction and Position that does not exist in the physical world. >> Type error ;-) caused by assumptions about the implementation >> dictating specification. > > Wrong. It is common in physics to multiply a dimensionless direction > vector (typically a unit vector) with a scalar of some dimension > (length, velocity, whatever). OK, naming issue then. If the Position can be interpreted as a Point determining a direction, that's an excuse for scalar multiplication with subtype constraints, at the level of implementation, or some conversions. A comment would reduce condescension and unforeseen misunderstanding by non-peers. (If that's wanted.) Proper types and maybe operations would look cleaner to me. > I declared vectors of real types because I need to describe real > mathematical numbers (classical continuous physical quantities). There > might be a reason to rethink the solution in future, but in a way > different to your suggestion: my current implementation allows > multiplication of a Position variable with a Length variable resulting > in a Position vector. The physically correct dimension would be length > squared instead of length. Up to now I can live without that. That's one reason to toss assumptions: if it is not just a scalar multiplication (respecting units), and you don't use SI aspects, another type can do. There are packages for this, I believe Christoph Grein has some online.