Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ravenwater opened this issue Dec 25, 2020 · 0 comments

Comments

@Ravenwater
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant