Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.
This repository was archived by the owner on May 4, 2019. It is now read-only.

We need more Nullable types for promotion and conversion #95

@tshort

Description

@tshort

Nullable{Float64} doesn't act like a proper number. You can't do 3.5 + Nullable(4). You also can't do log(Nullable(4.0)). The rest of the Julia ecosystem has great conversion and promotion, and Nullables should, too. The existing lift mechanism for NullableArrays is also kludgey because we don't have promotion.

The main problem is that you can't have both of the following. I haven't heard of any planned enhancements to the type system that would allow that sort of relationship.

Nullable{T <: Float} <: AbstractFloat
Nullable{T <: Integer} <: Integer

Given that, I think we need more Nullable types, so each type can fit in at appropriate places in the type hierarchy to allow promotion and conversion, so 3.5 + NullableInt(4) == NullableFloat{Float64}(7.5).

I'm running into the same quandary in the PooledElements package. But there, I think there's less expectation that the user needs to perform arbitrary numerics on a PooledElementArray.

The big drawback is the amount of code needed to implement this. The other is deciding how far to take this concept.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions