Skip to content

chore: Remove isNull & readNull from ShapeSerializer - #1138

Merged
jbelkins merged 6 commits into
mainfrom
jbe/throw_on_null
Aug 5, 2026
Merged

chore: Remove isNull & readNull from ShapeSerializer#1138
jbelkins merged 6 commits into
mainfrom
jbe/throw_on_null

Conversation

@jbelkins

@jbelkins jbelkins commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Description of changes

Removes the isNull() and readNull() methods from ShapeSerializer. Instead, when a null is encountered while a ShapeSerializer is reading, it will throw the DecodedNull error. This change streamlines the deserializer interface for Swift while not giving up any performance.

Reasons:

  • isNull() is the only method on the deserializer that "looks ahead" at data not yet deserialized. This adds complexity to the deserializer.
  • readNull() is an awkward interface that only may be called once isNull() has been used to verify that a null is present.

The reason for not using this approach cross-platform is that in most languages, throwing an error or exception unwinds the stack & generates a stack trace, which is costly & slow. In Swift, error handling does neither of those things and is therefore fast enough for routine flow control.

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jbelkins
jbelkins marked this pull request as ready for review August 4, 2026 20:32
@jbelkins
jbelkins requested a review from a team as a code owner August 4, 2026 20:32
@jbelkins
jbelkins merged commit 9fd82da into main Aug 5, 2026
45 checks passed
@jbelkins
jbelkins deleted the jbe/throw_on_null branch August 5, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants