Skip to content
  • Elisha Hastings's avatar
    Add note explaining why protocol_ex is required. · d9b461f4
    Elisha Hastings authored
    In Elixir, you can't call a protocol on a module name - for instance
    when calling an implemented protocol with a struct, you have to pass
    the struct data as the first argument, not the struct module.
    
    When parsing some markup with a custom type, Mecto doesn't have the
    data, and can't just try create a struct from the module name as not
    all custom types will be structs (also it's a bit hacky).
    
    There are a few ways around this, but as this is a library a lot of
    them aren't feasible (you can't create a behaviour in a module from
    another project, for instance). The simplest solution seems to be
    using `protocol_ex`.
    d9b461f4