develooper Front page | perl.perl6.language | Postings from November 2010

Re: exponentiation of Duration's

Thread Previous | Thread Next
From:
Mark J. Reed
Date:
November 17, 2010 05:37
Subject:
Re: exponentiation of Duration's
Message ID:
AANLkTin3jg6RWAE5PM99n3HjAqq16J06u40sMkUTgcNE@mail.gmail.com
I'm not convinced that the type system shouldn't be helping with
dimensional analysis, but at least it shouldn't hurt.  By all means,
let the programmer raise a Duration to a power - but the type of the
result should not also be Duration.  In the absence of automatic
dimension tracking, just return a plain number.

On Wednesday, November 17, 2010, Moritz Lenz <moritz@faui2k3.org> wrote:
> Am 17.11.2010 14:02, schrieb Oha:
>
> On 11/17/2010 01:46 PM, Moritz Lenz wrote:
>
> Just as a data point, in physics duration squared does exist.
>
> On the other hand, i can see why an Instant can't be used as a linear
> value: it does not have a clear origin (or zero value).
>
>
> That's correct, and the reason that nobody argued for changing Instant so far.
>
>
> Therefore the multiplication of two Instant may results in different
> results based on where you place the zero, unless you first convert
> the Instant in a Duration (e.g. seconds since 1 jan 1970)
>
>
> Right. And therefore having to do the conversion explicitly is a good thing -- you immediately see which epoch was used.
>
> Cheers,
> Moritz
>

-- 
Mark J. Reed <markjreed@gmail.com>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About