Skip to content

Conversation

@schutm
Copy link

@schutm schutm commented Feb 7, 2023

I've added the possibility to have @type-specs added as @opaque-specs. I like to keep my structures hidden, so I'm able to change the types and other stuff.

So the following will create a opaque typespec for Person.t().

defmodule Entities do
  use Strukt

  defstruct Person do
    @opaque_fields true

    field :name, :string, required: true

    def name(person), do: person.name
  end
end

I'm not sure, whether:

  • this is a good addition to this library;
  • if the chosen interface is desirable;
  • the implementation is any good.

Any thoughts are appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant