Hi José the main reason I see is merely estetic and is to avoid retyping the "@enforced_keys" in "defstruct" but as Louis said I have not measured the impact on the ecosystem and for that reason it could better fit in a library.
Thank you for your feedback guys :) El domingo, 24 de diciembre de 2017, 16:59:21 (UTC-5), Juan Jose Lopez Tugores escribió: > > For example instead of > > defmodule Foo do > > @enforce_keys [:foo1, :foo2] > > defstruct [:foo1, :foo2, :foo3] > > end > > > I write > > defmodule Foo do > > @required_keys [:foo1, :foo2] > > @optional_keys [:foo3] > > @enforce_keys @required_keys > > defstruct @required_keys ++ @optional_keys > > end > > > But I think it could better be > > >> defmodule Foo do > > defrequired [:foo1, :foo2] > > defoptional [:foo3] > > end > > -- 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/a03dd6a6-d9e1-46dc-add6-172a0687d27c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
