AvailLang / Avail

The Avail programming language. Includes the virtual machine, standard library, and standard examples.
BSD 3-Clause "New" or "Revised" License
54 stars 5 forks source link

Phrase kinds should be parametric on their subphrases #101

Open toddATavail opened 9 years ago

toddATavail commented 9 years ago

Reported by todd on 8 Mar 2015 18:59 UTC Working with macros in user code currently involves numerous type cast expressions, because phrase kinds are not parametric on their subphrases. For instance, it is not possible to express a type like "assign phrase whose righthand side is a send phrase". If it were possible to express such a type, then a macro could dispatch directly on such a type; it would also be possible to provide semantic restrictions to strengthen phrase kind accessors. This extension would overall reduce boilerplate and the need for type casts when working with macros, thereby improving the user experience of working with macros.

markATavail commented 7 years ago

List phrase types are now covariantly parametric not only by the yield type, but by a tuple type of the subphrases' types. Permuted list phrase types also inherit this new parameterization.

There are not yet any primitives for creating such specialized list phrase types, nor extracting the subexpressions tuple type.