dashbitco / nimble_strftime

A simple and fast strftime-based datetime formatter
37 stars 1 forks source link

Discuss the existing options API #9

Closed josevalim closed 5 years ago

josevalim commented 5 years ago

Hi @GuSilverFlame,

In the original proposal, we defined am_pm_names, month_names, and so on as functions. The idea of making them functions is that it makes it easy to wrap translations/localization tools around it. For example, with the current API, if we were to integrate it with Gettext, we would need 12 lookups every time we format a date to retrieve only the month names. The anonymous function would allow us to do that lazily, which would be more efficient.

Shall we move the options to the proposed API in the document? One option is to allow both lists and anonymous functions (but we should default to anonymous functions working with tuples as in the proposal, as that is more efficient).

GustavoSantosFe commented 5 years ago

I didn't know what was the reason to make it with anonymous functions, now that I knowI think it makes more sense to go that way