Skip to content

Bikeshedding type identifiers: align with TJSON? #36

Description

@tarcieri

ObjectHash presently uses the following single-letter identifiers for its types:

  • b: boolean
  • d: dict
  • f: float
  • i: integer
  • l: list
  • s: set
  • u: Unicode string

In TJSON I have slightly different single-letter identifiers which express a slightly larger range of types, including binary data (see also #22), and have names that align with the JSON data model:

  • A: array
  • O: object
  • S: set
  • b: boolean
  • d: binary data
  • f: floating point
  • i: signed integer
  • s: string
  • t: timestamp

Note the use of a capital to denote a non-scalar type.

I think it'd be great to agree on a common set of tags. I began working on an ObjectHash-alike using these identifiers, but I'd definitely prefer to use ObjectHash itself if possible.

If ObjectHash were to adopt the TJSON identifiers outright, it would require the following changes (old => new):

  • d => O
  • l => A
  • s => S
  • u => s

This would also free up d for use with binary data, which I think is a particularly nice thing to support (i.e. Unicode strings can be normalized prior to hashing, but binary data is hashed as-is).

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions