Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Units Of Measurement Options Stated Using Lowest Common Denominator Unit Practical
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joran Greef  
View profile  
 More options Oct 9, 9:18 am
From: Joran Greef <jorangr...@gmail.com>
Date: Fri, 9 Oct 2009 06:18:54 -0700 (PDT)
Local: Fri, Oct 9 2009 9:18 am
Subject: Units Of Measurement Options Stated Using Lowest Common Denominator Unit Practical
I've been using some Number extensions of my own for some time:
Number.seconds, Number.minutes, Number.hours etc. where (2).minutes()
would return the 2 minutes expressed as milliseconds e.g. 120000,
(2).seconds() would return 2000 etc.

It's been great for defining config files e.g.:

Config.Database.recentThreshold = (2).minutes();
Config.Http.timeout = (60).seconds();

I think Rails does the same and that may be where I got the idea from.
I've also added Number.kilobytes, Number.megabytes, etc.

It would be great if interfaces which receive a time or quantity value
as an option, such as PeriodicalExecuter, could expect the value to be
expressed in the lowest common denominator unit practical, i.e.
milliseconds rather than seconds. Java does it, and so does
Javascript's own setInterval, setTimeout etc. It would follow the
principle of least surprise and make units of measurement easier to
compare.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Allen Madsen  
View profile  
 More options Oct 9, 9:39 am
From: Allen Madsen <bla...@gmail.com>
Date: Fri, 9 Oct 2009 09:39:28 -0400
Local: Fri, Oct 9 2009 9:39 am
Subject: Re: [Prototype-core] Units Of Measurement Options Stated Using Lowest Common Denominator Unit Practical
Joran,

The type of number extensions you described aren't part of prototype.
Therefore, it is simpler for developers who aren't using such an
extension to use seconds. I'm not opposed to the switch, but I wanted
to throw out a possible explanation for the way it is today.

Allen Madsen
http://www.allenmadsen.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
T.J. Crowder  
View profile  
 More options Oct 10, 8:30 am
From: "T.J. Crowder" <t...@crowdersoftware.com>
Date: Sat, 10 Oct 2009 05:30:22 -0700 (PDT)
Local: Sat, Oct 10 2009 8:30 am
Subject: Re: Units Of Measurement Options Stated Using Lowest Common Denominator Unit Practical
I, for one, found the units used by Function#delay (for example) to be
very surprising when I first saw them, and I have to stop and think
every time I use Function#delay.  The usual unit for that sort of
thing in every language I've worked in other than BASIC is
milliseconds.

That said, I don't see changing them barring a wholescale Prototype
API rewrite.

-- T.J.

On Oct 9, 2:39 pm, Allen Madsen <bla...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobie Langel  
View profile  
 More options Oct 11, 10:25 pm
From: Tobie Langel <tobie.lan...@gmail.com>
Date: Sun, 11 Oct 2009 19:25:29 -0700 (PDT)
Local: Sun, Oct 11 2009 10:25 pm
Subject: Re: Units Of Measurement Options Stated Using Lowest Common Denominator Unit Practical
For the record, the unit of time measurement in Ruby is seconds, which
explains the reason behind that choice for Prototype.

Given the backwards compatibility issues, and the benefits of using
seconds rather than milliseconds in most but edge cases, there's litte
chance of seeing that change.

Best,

Tobie

On Oct 10, 2:30 pm, "T.J. Crowder" <t...@crowdersoftware.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joran Greef  
View profile  
 More options Oct 19, 5:24 am
From: Joran Greef <jorangr...@gmail.com>
Date: Mon, 19 Oct 2009 02:24:53 -0700 (PDT)
Local: Mon, Oct 19 2009 5:24 am
Subject: Re: Units Of Measurement Options Stated Using Lowest Common Denominator Unit Practical
Thanks Tobie.

Re: "...the unit of time measurement in Ruby is seconds, which
explains the reason".
Can we optimize for those familiar with Javascript? Is there any time-
related API in Javascript which uses seconds?

Re: "Given ... the benefits of using seconds rather than milliseconds
in most but edge cases".
Do you have some data on this?

Re: "backwards compatibility".
A semantically correct API may be better than a backwards compatible
API.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Izidor Jerebic  
View profile  
 More options Oct 21, 5:42 am
From: Izidor Jerebic <ij.l...@gmail.com>
Date: Wed, 21 Oct 2009 11:42:06 +0200
Local: Wed, Oct 21 2009 5:42 am
Subject: Re: [Prototype-core] Re: Units Of Measurement Options Stated Using Lowest Common Denominator Unit Practical

On 19.10.2009, at 11:24, Joran Greef wrote:

> Thanks Tobie.

> Re: "...the unit of time measurement in Ruby is seconds, which
> explains the reason".
> Can we optimize for those familiar with Javascript? Is there any time-
> related API in Javascript which uses seconds?

Well, programmers versed in more than one language can tell you that  
in general time APIs are in seconds, because second is canonical  
measure unit of time. Javascript is exception, and not in a good way.  
No need to follow bad examples...

> Re: "backwards compatibility".
> A semantically correct API may be better than a backwards compatible
> API.

Semantically correct API for time has units in seconds, because second  
is canonical unit for time, not 10e-3 seconds....

izidor


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google