Skip to content

change type none to type missing and improve type safety - #7491

Open
mccanne wants to merge 2 commits into
mainfrom
missing
Open

mccanne wants to merge 2 commits into
mainfrom
missing

Conversation

@mccanne

@mccanne mccanne commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

This commit addresses some confusion that has been arising regarding the difference between option types and a union (none|T). To do so, we renamed the none type as missing and introduce the concept that there are two types of nones: a missing none (i.e., none::missing), and an option none (i.e., none::option(T) aka none::T).

none::missing values can be cast to option(T) by casting the none to type T. While none::missing exists in the runtime as a transient value, they are not expected to be serialized anywhere (except for inside fusion values). That said, we allow their serialization for test and debug with the goal of making sure the runtime has sufficient type safety so that they can never be materialized, e.g., "values none" (which implies none::missing) should produce an error though we haven't implemented this yet. Option nones are always serializable.

Fusion now creates fused records with missing fields with the missing type. This seems to be less confusing.

The option type now includes vector.Missing to represent none case but we change the conventions so that the these none::missing values are never expressed out of an option value. Instead, option.Coalesce is called with default values or errors are expressed as nones.

We changed Apply so RipFusions does not rip options and RipOption continues to mean to separate the nones (as missings) and the somes. It's up to the caller of Apply to handle the option values appropriately. This moves that logic to the call sites where type-safe semantics can be implemented requiring users to specify queries that handle the none cases when they arise. (There are more cases to cover in the runtime, and the next step with the type checker is to catch at compile time as many as the option-handling type errors runtime as possiblea)

This commit addresses some confusion that has been arising regarding
the difference between option types and a union (none|T).
To do so, we renamed the none type as missing and introduce
the concept that there are two types of nones: a missing none
(i.e., none::missing), and an option none (i.e., none::option(T)
aka none::T).

none::missing values can be cast to option(T) by casting
the none to type T.  While none::missing exists in the runtime
as a transient value, they are not expected to be serialized
anywhere (except for inside fusion values).  That said, we allow
their serialization for test and debug with the goal of making
sure the runtime has sufficient type safety so that they
can never be materialized, e.g., "values none" (which implies
none::missing) should produce an error though we haven't
implemented this yet. Option nones are always serializable.

Fusion now creates fused records with missing fields with the
missing type.  This seems to be less confusing.

The option type now includes vector.Missing to represent none case
but we change the conventions so that the these none::missing
values are never expressed out of an option value.  Instead,
option.Coalesce is called with default values or errors are
expressed as nones.

We changed Apply so RipFusions does not rip options and RipOption
continues to mean to separate the nones (as missings) and the somes.
It's up to the caller of Apply to handle the option values
appropriately.  This moves that logic to the call sites where
type-safe semantics can be implemented requiring users to specify
queries that handle the none cases when they arise. (There are
more cases to cover in the runtime, and the next step with the
type checker is to catch at compile time as many as the option-handling
type errors runtime as possiblea)
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.

1 participant