Re: prefixes and namespaces?
- Posted by don cole <doncole at pacb?ll.n?t> Apr 24, 2008
- 686 views
Jeremy Cowgar wrote: > > Ok, another question now about the standard library. > > Currently, two files have been added that are prefixed.... map.e and > datetime.e. > Functions are like: > > }}} <eucode> > include map.e > map m > m = map_new() > m = map_put(m, "name", "John Doe") > puts(1, "Name: " & map_get(m, "name")) > > include datetime.e > datetime dt > dt = datetime_now() > dt = datetime_new(2008, 10, 20, 11, 12, 13) > dt = datetime_add_days(30) > -- ...etc... > </eucode> {{{ > > All function names in these two items thus far: map_new(), map_get(), > map_put(), > map_remove(), map_size(), map_keys(), map_values() and datetime_new(), > datetime_compare(), > datetime_from_date(), datetime_now(), datetime_dow(), datetime_to_unix(), > datetime_from_unix(), > datetime_add_seconds(), datetime_add_days(), datetime_diff_seconds(), > datetime_diff_days(). > Global constants: DT_YEAR, DT_MONTH, DT_DAY, DT_HOUR, DT_MINUTE, DT_SECOND. > > Should we omit the map_ and datetime_ and do things like: > > }}} <eucode> > include datetime.e as dt > > dt:now() > dt:add_days(30) > dt:from_unix(1029382) > > map:put(m, "name", "John") > map:get(m, "name") > </eucode> {{{ > > One concern I have is both map and datetime have the "new" function. Also, > datetime > has datetime_compare, which would become compare(). That does not matter if > you do include with a namespace but... > > Thoughts? > > -- > Jeremy Cowgar > <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a> \Hello all, as far as date and time I have written my own routines using the existing now. I call it more_dates.e in the archives. Such as getDayStr(),getDayDec().getStdTime(),getMilTime(), getESTime() etc... I don't see why everybody can't do that for their own preferences. I see no need to re write anything. Don Cole