justinas / gettext

Gettext for Rust. Kind of.
MIT License
56 stars 8 forks source link

Add Catalog::empty to get an empty catalog #7

Closed elegaanz closed 5 years ago

elegaanz commented 5 years ago

Fixes #3

justinas commented 5 years ago

Any thoughts on Catalog::empty() vs Catalog::new() vs Default::default()? new() seems idiomatic, however while we have no methods to manipulate the catalog, new() would still always result in an empty catalog :man_shrugging:

If full catalog manipulation is ever implemented, empty() could be deprecated and replaced with new(). Being 0.x allows us easier deprecations.

elegaanz commented 5 years ago

Yes, I think keeping empty has a public alias to new is the best solution, otherwise people may be a bit confused, thinking they can manipulate the catalog (and as you said, if it becomes possible to manipulate it in the future, empty could be deprecated).

If you want I can also implement Default for Catalog in this PR.

justinas commented 5 years ago

Sounds good, maybe no need for Default::default() just yet then.