comp.lang.ada
 help / color / mirror / Atom feed
From: "G.B." <bauhaus@futureapps.invalid>
Subject: Re: Incompatible types for array conversion
Date: Wed, 22 Jul 2015 16:22:35 +0200
Date: 2015-07-22T16:22:35+02:00	[thread overview]
Message-ID: <moo8sh$rof$1@dont-email.me> (raw)
In-Reply-To: <d19iapFknp1U1@mid.individual.net>

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.

  reply	other threads:[~2015-07-22 14:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22  1:19 Incompatible types for array conversion hreba
2015-07-22  5:20 ` Niklas Holsti
2015-07-22  7:13   ` Simon Wright
2015-07-22  7:41     ` Niklas Holsti
2015-07-22 12:32       ` Simon Wright
2015-07-27 23:12         ` Randy Brukardt
2015-07-22 13:00   ` hreba
2015-07-22 13:22     ` hreba
2015-07-22 17:50       ` Niklas Holsti
2015-07-22 19:02         ` Dmitry A. Kazakov
2015-07-22  6:49 ` Georg Bauhaus
2015-07-22 12:57   ` hreba
2015-07-22 14:22     ` G.B. [this message]
2015-07-23 13:21 ` hreba
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox