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

Re: exponentiation of Duration's

Thread Previous
From:
Mason Kramer
Date:
November 17, 2010 06:11
Subject:
Re: exponentiation of Duration's
Message ID:
3375D832-68CF-45BC-821A-6176EBABC016@gmail.com
I still have uses for Durations.  

For instance, I want to dispatch a different .Stringy method to Durations than to Nums.  It's convenient to me that the difference between two Instants has a different type than the difference between 1654321681.123 and 1654321021.65438.

I just think Durations should be Liskov substitutable for Rats.  I don't give any credence at all to the school of thought that the language designer can think of every legitimate mathematical operation for the difference between two instants.  But I still want to use the type system to do MMD.

Cheers,

Mason

On Nov 17, 2010, at  08:56 AM, Carl Mäsak wrote:

> Mark (>):
>> 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.
> 
> Or, by Ockham, since Duration is now deprived of its only task --
> making life harder for the programmer -- remove it altogether from the
> language and just put a number type in its place, representing number
> of seconds.
> 
> // Carl


Thread Previous


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