Skip to content

core/datatype-1.0.0 byteorder underspecification #501

Description

@embray

This is a companion to #470. In that one I managed to understand that if the ndarray source is a binary block then specifying the datatype byteorder is required (unless the datatype is nested, in which case the byteorder is only required for individual fields).

I noticed however that at some point there was also a core/datatype-1.0.0 tag added. This tag never seems to be used inside the ndarray objects themselves, where it's just implicit (and that same datatype schema is already a sub-schema of the ndarray schema).

If I had to guess pulling out a separate datatype tag has two (I think good) motivations:

  • Factor it out from the ndarray schema which is already fairly complex
  • Make it usable in other custom tags where one might want to describe a datatype (e.g. a custom sparse array type)

That's all fine--however, the datatype schema allows the datatype to be a simple string like "int64". Without a byteorder specified it's ambiguous and at best implementation-defined. The schema documentation reads simply:

The byteorder for the field. If not provided, the byteorder of the datatype as a whole will be used.

But this provision is only meaningful for compound datatypes. It doesn't say what should be assumed if there is just a scalar datatype given.

Some options from which we could take a combination:

  • Patch datatype-1.0.0 to specify a default byte order to assume if not specified (should never just assume host datatype which is useless for an interchange format like ASDF)--this should be done I think regardless to eliminate the ambiguity
  • Update -> datetype-1.1.0 to add scalar datatype names like ">int32" and "<int32" to specify the byteorder where applicable (still would need to specify which is default without the prefix)
  • Update -> datatype-2.0.0 (breaking change) to disallow a standalone scalar datatype without a byteorder specified: This is the most drastic where it might be nicer just to specify a default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions