Skip to content

nullable syntax update #1023

Description

@andrewrk
  • Replace a ?? b binary operator with a ifnull b. After this change, all control flow occurs with keywords only.
    • other suggestions instead of ifnull are welcome. ifnull is nice because it is 2 lowercase words squished together so nobody will miss the identifier name.
  • Remove ??x prefix operator. Replace it with x.?. After this change and Pointer Reform #770, this symmetry exists:
    • *T is used to make a pointer type, and x.* derefs
    • ?T is used to make a nullable type, and x.? de-nullifies
    • Both operations have assertions that are potentially unsafe - .* asserts the pointer is valid among other things and .? asserts the value is non-null.

Anecdotally, this will look a lot better syntactically, especially with C-translated code.

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

    acceptedThis proposal is planned.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions