Optimize protocol consolidation to no longer load structs
Ensure protocol consolidation no longer stores outdated struct types. As a consequence, protocols types only track struct names at the moment
Module
32 changes across 19 versions
Changes by version
Optimize protocol consolidation to no longer load structs
Ensure protocol consolidation no longer stores outdated struct types. As a consequence, protocols types only track struct names at the moment
Improve protocol violation warnings
Type checking of protocols dispatch and implementations
defstruct/1 and defexception/1 are now disabled inside defprotocol as to not allow defining structs/exceptions alongside a protocol
Return correct implementation for an invalid struct pointing to nil
Add @undefined_impl_description to customize error message when an implementation is undefined
Add __deriving__/1 as optional macro callback to Protocol, no longer requiring empty implementations
Defining __deriving__/3 inside the Any implementation is deprecated, derive it inside the protocol definition itself
Expand :for in protocols with the appropriate env
Warn if a protocol has no definitions
Warn on zero arity callbacks inside protocols
Add defdelegate to the list of unallowed macros inside protocols as protocols do not allow function definitions
Warn if @callback, @macrocallback and @optional_callbacks are defined inside protocol
Ensure protocol metadata is deterministic on consolidation
Improve Protocol.UndefinedError messages to also include the type that was attempted to dispatch on
Optimize performance of dynamic dispatching for non-consolidated protocols
Ensure debug_info is kept in protocols
Ensure :debug_info is kept in protocols
Fix protocol consolidation when some chunks may be missing
Show available implementations on Protocol.UndefinedError if the protocol has been consolidated
Do not lose source compile info on protocol consolidation
Do not emit warnings when using protocols on opaque types
Warn when defimpl is called for a consolidated protocol
Guarantee that derived protocols go through Any instead of Map
Do not expose protocol convention on assert_impl!/2
Add Protocol.consolidate/2, Protocol.consolidated?/1 and a mix compile.protocols task for protocol consolidation
Add Protocol.derive/3 for runtime deriving of a struct
Protocols now provide impl_for/1 and impl_for!/1 functions which receive a structure and returns its respective implementation, otherwise returns nil or an error
@only and @except in protocols are now deprecated
Protocols no longer fallback to Any out of the box (this functionality needs to be explicitly enabled by setting @fallback_to_any to true)
Protocol no longer dispatches to Number, but to Integer and Float