flux icon indicating copy to clipboard operation
flux copied to clipboard

Merge the PolyType and Type interfaces in the semantic package.

Open nathanielc opened this issue 6 years ago • 0 comments

The compiler, interpreter and any thing else that interacts with Flux values and types will need to be aware of polymorphic types. As such we should change the values.Value interface to only have a single Type method that returns a single Type interface that understands both monomorphic and polymorphic types.

Currently the uses of Type and PolyType differ signifacantly, Type performs uniqueness checking and caching and always returns a pointer to the same type. This make using Types as map keys etc really useful. PolyTypes on the other hand are created and destroyed frequently so the effort required to cache and ensure uniqueness is expensive and not needed.

The pain of having to deal with the different types out weights their differing uses, I expect that there is a solution that is efficient for both uses that does not require keeping the type separate.

nathanielc avatar Oct 31 '18 22:10 nathanielc