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

2010-04-11 Thread Dave Rolsky

On Fri, 9 Apr 2010, Darren Duncan wrote:

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


Users will not always control how the DateTime object is constructed. 
Nonetheless, when they want to know "what is the value for seconds", I 
think _most_ users will want an integer, not a floating point number.



-dave

/*
http://VegGuide.org   http://blog.urth.org
Your guide to all that's veg  House Absolute(ly Pointless)
*/


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

2010-04-09 Thread Jason Switzer
On Fri, Apr 9, 2010 at 3:06 PM, Jonathan Worthington wrote:

> Though even clearer and same number of characters as whole_seconds is:
>
>   $dt.seconds.round


This makes more sense to me than the first example you listed because when
dealing with time measurement, I rarely think of seconds that are broken
down to sub-measurements. Rather, I often think of seconds as an aggregation
of milliseconds, so rounding the fraction (a second is internally a fraction
of milliseconds) Just Makes Sense. The idea continues downwards to the
smallest represented unit of time and upwards to the largest represented
unit.

-Jason "s1n" Switzer


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

2010-04-09 Thread Darren Duncan

Jonathan Worthington wrote:

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


Yes, exactly, thank you Jonathan. -- Darren Duncan


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

2010-04-09 Thread Jonathan Worthington

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