BSON::Registry mutates MAPPINGS constant

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Ruby Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      In bson-ruby, the module BSON::Registry does the following:

      MAPPINGS = {}
      
      ...
      
      def register(byte, type)
        MAPPINGS[byte.ord] = type
        define_type_reader(type)
      end

      Mutating a constant like this is a no-no. Instead MAPPINGS should be a module variable @mappings.

              Assignee:
              Unassigned
              Reporter:
              Johnny Shields
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: