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: > 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 Madsenhttp://www.allenmadsen.com > > > > On Fri, Oct 9, 2009 at 9:18 AM, Joran Greef <jorangr...@gmail.com> wrote: > > > 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---