Am 17.11.2010 12:55, schrieb Richard Hainsworth:
On 11/17/10 14:03, Moritz Lenz wrote:
Am 17.11.2010 10:31, schrieb Kris Shannon:
$duration * $duration # WRONG, durations aren't geometric
$duration * 2 # ok, a duration twice as long
2 * $duration # same

What are your thoughts?

I've summarized my thoughts here, before I read your email:

Ignoring the sarcasm, Moritz's blog and reply seem reasonable about what
should be defined by perl.

Please note that my sarcasm applied only to one particular sentence, not to the whole mail :-)

Once a number has been generated, viz., by obtaining a duration, that
number can be manipulated however necessary. The interpretation of the
number is a matter for the programmer, not the language designer.

To illustrate, lets take a different problem. Suppose we have lengths in
$x and $y, then the dimension of $a = $x * $y is of area, not of length.
Is it really consistent to forbid $x = $x * $y in case the $x may be
mistakenly interpretted as a length and not an area?

In the same vein, $duration * $duration has the physical dimension of
duration squared. True that is not the dimension of duration, and so
assigning it to a duration variable might cause a problem of physical


Just as a data point, in physics duration squared does exist.

Just think of the definition of acceleration, which is the second time derivative of position. Approximation of derivative as a finite fraction makes it a = x / t^2.
(And I might add that it also appears in force, energy and power that way).

Neverthless, it doesn't seem to me that trapping dimension errors is
something a programming language should be doing.

Thank you for phrasing it much better than I managed to.


Reply via email to