dashbitco / nimble_options

A tiny library for validating and documenting high-level options. 💽
Apache License 2.0
507 stars 38 forks source link

Introduce a :or type #54

Closed whatyouhide closed 3 years ago

whatyouhide commented 4 years ago

It's missing docs still, but I think this is a pretty low hanging fruit. Reasons why I'm okay with this:

Thoughts before I write docs? :)

josevalim commented 4 years ago

Sounds good to me! I am just not sure if :or is the best name. As it can cause confusion with one_of. Not sure of suggestions though.

whatyouhide commented 4 years ago

@josevalim I know, it should be one_of for this feature and member_of for what today is called one_of 😭 Maybe we can call this :alternatives, not sure 😕

josevalim commented 4 years ago

I think it is fine to name this or if we name the one member_of or in. Maybe we can deprecate one_of as in.

whatyouhide commented 4 years ago

@josevalim I think the clearest options are:

If that's fine, I propose to:

  1. Rename :one_of to :member_of with warning
  2. Call this :or for now

In the next release, we can rename :or to :one_of if we want to, and call it a day. Thoughts?

josevalim commented 4 years ago

I would prefer to not do a double renaming. Which is why I went with in/or. In is also a common idiom in Elixir. I think anything starting with one_of will be ambiguous

whatyouhide commented 4 years ago

Okay, lets go with in and or 🙃

whatyouhide commented 3 years ago

@josevalim ready for another review :)