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: http://perlgeek.de/blog-en/perl-6/real-world-strikes-back.html

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

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 interpretation.

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

Or am I missing something?

Richard

Reply via email to