Type Theory: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:


And a code block is a list of type Statement.
And a code block is a list of type Statement.
== TypeSet ==
A TypeSet is an abstract type that can answer
* Does type X belong to typeset T
* What methods are available on typeset T
Interfaces and Tagged Unions are both typesets. I may make typesets the base thing in the compiler and move interface and union out to the standard library.


[[Category:Gryphon]]
[[Category:Gryphon]]

Revision as of 02:24, 17 October 2019

Hyper-Consistent

I'm really drawn to this. There are a lot of very similar structures in a program that could be brought in line. Although I'm afraid doing this is going to recreate lisp. This also ties into the data spec I'm working on.

The two fundamental container types are an ordered list and an associative array. In a strongly typed context an ordered list is either typed or tuple and fixed or variable length. A variable length tuple just means the last argument is variadic.

But an associative array can be constructed either from two lists zipped together or from a list of key/values. This means that something like a struct is an ordered associative array.

This becomes interesting because the arguments to a function and a struct definition are essentially the same thing.

 definition func(rID receiverType) Name <tupleDef> returnType {...}

And a code block is a list of type Statement.

TypeSet

A TypeSet is an abstract type that can answer

  • Does type X belong to typeset T
  • What methods are available on typeset T

Interfaces and Tagged Unions are both typesets. I may make typesets the base thing in the compiler and move interface and union out to the standard library.