BlockstreamResearch / simfony

Rust-like high-level language that compiles down to Simplicity bytecode. Work in progress.
26 stars 9 forks source link

Rename base types #19

Open uncomputable opened 7 months ago

uncomputable commented 7 months ago

TL;DR

"Base type" is a generic name that might be confusing.

Details

The Simfony type system comes with "fundamental" types: unit (), sum Either<A, B> and product (A, B).

Other Simfony types are defined as "macros": Option<A> = Either<(), A>, bool = Either<(), ()>, ...

At the moment, the Simfony type system expands all macros and works at the "fundamental" type level.

We want to pick a name for "fundamental" types that distinguishes them from "macro" types. Currently the former are called "base types".

Alternatively, we could enforce explicit casting between types. On the surface, this would make all types disjoint. Types with equal structure (Option<A>Either<(), A> etc.) would be available for casting.

apoelstra commented 7 months ago

We should use the term "structural types" which is a standard term for types which are defined (solely) by their structure.

That wiki page suggests the term "nominative types" for types which have names/explicit declarations, which I hadn't heard before but which I like.