Hi everyone, Adding my 2 cents, I actually see `required` as a better option than `require`. Reasoning: I see `defstruct` as *kind of* a declaration. So the thinking goes like that: I'm declaring a structure who has fields x, y and z; the required fields are x and z. Also, `required` in this context gains a different semantic compared to `require` (as in `require_file`).
On a side idea, brainstorming a bit, something like `not_empty`, or `not_null` came to my mind. quarta-feira, 25 de Maio de 2016 às 12:58:53 UTC-3, José Valim escreveu: > > I like this feature a lot, but dislike the term enforce. IMO, it muddies >> things and is much less clear than require. In my experience, the term >> required is generally used to indicate fields that must be present. For >> example, JSON schema uses that term. enforce gives me the sense that >> some kind of validation policy is applied but does not describe what the >> validation policy is. Does it enforce the type of values allowed for the >> named fields? Does it enforce the fields are present? Does it enforce the >> named fields are *not* present? Does enforce: [:percent] validate that >> percent is between 1 and 100? >> > That's a very good point. I believe :require is better than :required > (thanks for that) but I still believe the require/required connotation can > be confusing. Also require may be a bit overloaded in Elixir (given the > require special form and Code.require_file). Can you think of other > options? :) > > quarta-feira, 25 de Maio de 2016 às 12:58:53 UTC-3, José Valim escreveu: > > I like this feature a lot, but dislike the term enforce. IMO, it muddies >> things and is much less clear than require. In my experience, the term >> required is generally used to indicate fields that must be present. For >> example, JSON schema uses that term. enforce gives me the sense that >> some kind of validation policy is applied but does not describe what the >> validation policy is. Does it enforce the type of values allowed for the >> named fields? Does it enforce the fields are present? Does it enforce the >> named fields are *not* present? Does enforce: [:percent] validate that >> percent is between 1 and 100? >> > That's a very good point. I believe :require is better than :required > (thanks for that) but I still believe the require/required connotation can > be confusing. Also require may be a bit overloaded in Elixir (given the > require special form and Code.require_file). Can you think of other > options? :) > > quarta-feira, 25 de Maio de 2016 às 12:58:53 UTC-3, José Valim escreveu: > > I like this feature a lot, but dislike the term enforce. IMO, it muddies >> things and is much less clear than require. In my experience, the term >> required is generally used to indicate fields that must be present. For >> example, JSON schema uses that term. enforce gives me the sense that >> some kind of validation policy is applied but does not describe what the >> validation policy is. Does it enforce the type of values allowed for the >> named fields? Does it enforce the fields are present? Does it enforce the >> named fields are *not* present? Does enforce: [:percent] validate that >> percent is between 1 and 100? >> > That's a very good point. I believe :require is better than :required > (thanks for that) but I still believe the require/required connotation can > be confusing. Also require may be a bit overloaded in Elixir (given the > require special form and Code.require_file). Can you think of other > options? :) > > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/cfe09b6a-80e9-46bd-bf9b-44ab8a70c531%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
