prefixes and namespaces?
- Posted by Jeremy Cowgar <jeremy at c?wg?r.com> Apr 24, 2008
- 716 views
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:
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...
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:
include datetime.e as dt dt:now() dt:add_days(30) dt:from_unix(1029382) map:put(m, "name", "John") map:get(m, "name")
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 http://jeremy.cowgar.com