Skip to content

Multiple registries #157

@franzliedke

Description

@franzliedke

Thanks for this great library, which is fundamental to our business! 💚

As described in #69, having a flat registry namespace was a design decision. That's okay to me. What is problematic to us, though: the registry is a singleton / global.

We already see several console warnings because structs / records live in multiple Ruby namespaces and share the same class name, therefore overwrite each other in the registry. I assume that we currently avoid observable problems by explicitly loading only the records we need.

Of course, this is error-prone and bound to cause obscure runtime problems, also in relation to things like eager loading code. Maybe it hasn't happened yet because the code is only loaded in Rake tasks (i.e. short-lived processes).

The current situation works, kinda. A better fix would be to make sure the names of all records are unique. (Or your suggested workaround from #132.) However, even then a problem remains: We use bindata for parsing multiple formats, which are unrelated to each other. Having a shared registry means our parsers can (accidentally?) reference each other's datatypes. This problem is made worse by the flat namespace, but strictly speaking unrelated.

Would you be open to accept a PR? I'd be happy to spend time on supporting multiple / custom registries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions