ThinkingElixir 056: Fly-ing Elixir Close to Users with Kurt Mackey Senior Elixir Engineer at MEDWING

Objext: An alternative to Struct and Protocol

I’ve always wanted Structs to be opaque by default.
So I built Objext which allows user to define opaque data structures.
For an “objext”, only the module that defines it can access its internal state, the other modules can only access these states via public functions.

Objext also provides macros to:

  1. define Protocol-like interfaces for “Objexts”.
  2. create mocks for testing purpose

Check it out and give it a try: