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

Re: expression of seconds (was Re: A new era for Temporal)

Thread Previous | Thread Next
From:
Jonathan Worthington
Date:
April 9, 2010 13:07
Subject:
Re: expression of seconds (was Re: A new era for Temporal)
Message ID:
4BBF88D8.3030504@jnthn.net
Darren Duncan wrote:
> Dave Rolsky wrote:
>> On a smaller point, I think second vs whole_second is the wrong 
>> Huffman coding. I'd think most people want the integer value.
>
> Well, whatever you call things, the most important thing is to keep 
> the seconds count as a single number which can do fractions, or if you 
> really must break them up, then have the fractional second part as a 
> real in 0..^1.  The whole 
> "nanosecond"-integer-fixed-onesizefitsall-subsecond-precision thing is 
> a terrible hack.  Keeping a single number for seconds is best from a 
> conceptual and a usability and a math point of view.  If users only 
> want the integer value, then they can just store the second as an 
> integer in the first place.  As for the name, well "whole_second" can 
> be made shorter, or its value could automatically truncate if users 
> assigned it to an Int.  
my Int $x implies a constraint, *not* a coercion. That's:

    $dt.seconds.Int

Though even clearer and same number of characters as whole_seconds is:

    $dt.seconds.round

Jonathan


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