Re: Standard library - date and time
- Posted by Matt Lewis <matthewwalkerlewis at ?mail.?om> Apr 22, 2008
- 1082 views
yuku wrote: > > Jeremy Cowgar wrote: > > 1. Let's not change the existing date() and time() functions. We are adding > > to the standard library, not redesigning it. > > > > 2. We should prefix some things. For instance, the map functions deal with > > maps > > and task function deal with tasks. > > > > I have found three email addresses for Carl (author of datetime) and have > > sent > > an email asking if it could be included in Euphoria. datetime has a > > copyright > > statement and no released license. > > Hi, > > I committed the prototype of datetime functions by adhering to the points > above. > We defined a new type: datetime (the implementation is not done, waiting > for the permission as mentioned above). > The prefix is datetime_ (should it be date_ ? but since the type name > is datetime, will it confuse users?) > > To maintain compatibility with built-in date(), the datetime object > can be created using datetime_from_date(). > The now function is named datetime_now(). > > Here are the function prototypes (some C-style for clarity). > Please give suggestions etc. <snip> I think we're going a bit overboard on the prefixing. As later posts mention, we should consider refactoring the library, possibly simplifying to reduce the types. Are they all even needed? We might want to split it out into a date and a time file (I haven't looked at the details, so I'm not sure if this is a good idea). Name clashes can be resolved by namespaces, assuming they happen. For example:
-- good datetime:to_seconds( my_date ) time:to_seconds( my_time) -- less good datetime_to_seconds( my_datetime ) time_to_seconds( my_time )
Matt