It is interesting that I read your comment today, I recently had an idea about enabling seamless binary compatibility and binary polymorphism without having to change and recompile sum types.

Widget frameworks are very complicated and have intricate APIs.

With present day computer technologies it is difficult to mutate an API or interface that others are implementing or using. I think people also rely on side effects that aren't promised by APIs, which makes it harder to change things.

I want to be capable of refactoring my logic and code without breaking my data structure and I want to change my data structure without breaking my logic. These are at odds.

How many times has a library upgrade caused a compiler error for you?

When someone implements my Java API, it is difficult for me to change it. Breaking software upgrades is my common experience upgrading software libraries.

My idea is that we should trace the method names, field/properties names and parameters used of methods in an Abstract Syntax Tree of code and then turn it into a structure and hash the symbols in the structure to correspond to in-memory layout index offset. (We put the data for the member symbol for example "children" in the same memory position every time)

We can use heuristics with this AST that from any given symbol name, there is a traversal from one symbol to another.

My idea is to handle the seamless migration of types - such as replacing one type for another, new type, merging types, splitting up types into members, changing the associations of a type, changing the plurality of the type (is it a 1-to-1 or 1-to-many mapping or many-to-many mapping?)

The idea is to create a struct data layout from an AST symbol trace and turn it into deterministic arrangement of data at the machine code layer.

When I refer to a symbol on a computer, it is at a numerical position in memory, relative to other symbols, such as relative to a symbol with RIP relative addressing in assembly.

If the same symbol corresponds to the same numerical position every time regardless of the AST, we get binary compatibility regardless of the AST that created that symbol traversal.

If I change the AST, but the data has the same underlying associations, the data structure can be inferred. For example, git detects file moves based on file hashes.

We could define a list of keywords and hash them into buckets and then people use these symbol names and they get binary compatibility for free.

For example, if a library upgrade changes the object hierarchy and splits something off into a new object, or introduces a plurality (one to many) where there was none before? Such as having multiple addresses for a customer, or multiple email addresses and contact numbers for an account where previously there was only one.

The hash of the relationship diagram can map to a struct layout deterministically.

For example, take the following data associational hierarchy:

bussiness_unit-> department-> product -> manager

and managers now need to be responsible for departments, the associational diagram changes to

business_unit -> manager -> department -> product

can we sort and hash the fields of these relationship diagrams so that they always place fields at the same index offsets in memory?

hash "bussiness_unit-> department-> product -> manager"

hash "business_unit -> manager -> department -> product"

so business_unit_manager
manager_department
all produce the same indexes

there are fields on business_unit to manager and children of manager object for department and children on department for products, or something like this.

or similar. This kind of schema changes should be programmatically deterministic, because these kinds of migrations are so common.

This idea could also solve database migrations too.