Skip to content

Add sub-64-bit integer types as primitives. #29

@elucent

Description

@elucent

Basil should support integer types with widths less than 64 bits.

Similar to Go's primitive int types, I propose redefining the current Int type as a generic "best size" integer type equal to the word size of the target architecture. We'll augment this with types with explicit sizes: I propose I8, I16, I32, and I64 for brevity's sake.

Some open questions associated with this feature:

  • Should we include unsigned integers in the language? What should their semantics be (specifically w.r.t. type coercion)?
  • Is there a compelling reason to define a distinct equivalent of C's intptr_t? Word-sized Int should be equivalent to this on most modern systems - perhaps we could even specifically define Int as pointer-sized?
  • Should we consider generalizing ints for arbitrary bit-widths? I128 could have some uses. What about atypicalwidths like I7 or I50?

Metadata

Metadata

Assignees

No one assigned

    Labels

    planned featurePlanned feature for upcoming language revision.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions