Skip to content

Make MIME::Type immutable? #237

Description

@halostatue

Should MIME::Type objects be (mostly) immutable Data objects?

This would necessitate a serious rethink of how mime-types-data management works (since it currently depends on mutability) — but most of that could be resolved with using map instead of each and using MIME::Type#with.

Certain fields would no longer be assignable, but could be updated as long as they aren't frozen — extensions for example could have methods that add or remove values as long as we don't call extensions#freeze. We would want to #freeze all of the string values, although string interning would handle that for us.

If we do this, it's likely that we would want to be able to replace values in MIME::Types on update, preferably with specific methods for this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions