Skip to content

Return a list of maps in records:get_definition/2 #10822

@josevalim

Description

@josevalim

Today the type signature is:

-spec get_definition(Module :: module(), RecordName :: atom()) ->
                        {create_options(),
                         [{FieldName :: atom(), Default :: dynamic()} | (FieldName :: atom())]}.

However, if in the future, we want to add more properties to fields, the signature above won't support it. My suggestion is for it to return maps with default as an optional field:

                        {create_options(),
                         [#{field := FieldName :: atom(), default => Default :: dynamic()}]}.

Possible new properties could be private fields (only visible with the current module), user metadata, or anything unforeseen. Maybe this will never be added but this should be more forwards compatible.

If you don't beleive this is a good suggestion, feel free to close this issue. :)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions