Skip to content

Design an automatic enablement of conversion operators when two user-defined types are included in a program #197

@Ravenwater

Description

@Ravenwater

When a program includes two or more Universal Number Library types, it is likely that there is a need in the program to 'connect' the two types so that they can collaborate in an adaptive or multi-precision algorithm.

For example, arithmetic and geometric sequences, squares, cubes, factorials, Fibonacci sequences, etc.

https://en.wikipedia.org/wiki/List_of_integer_sequences

These sequences could be generated with arbitrary or adaptive integer representations, but then might want to be used in a Real number representation, such as a posit or a linear float, to calculate a golden ratio approximation. There are millions of use cases here.

When two types need to 'project' their value to the other, we'll need to solve three problems:
1- conversions in initializer lists, decorated constructors, or assignment operators require the type to be known, creating a module cycle
2- the value construction of the source type needs to be known by the receiving type
3- extend the arithmetic operators with the new value type, i.e. binary operators, such as, type-1 + type-2

One unifying design could be to create an oracle type that can represent any value, and define all conversions as a transformation to and from that oracle type. We need to explore this design space and implement a solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions