Title:
|
ENHANCING TYPE SYSTEMS WITH FIRST-CLASS PATTERNS |
Author(s):
|
Lutz Hamel, Timothy Colaneri and Oliver McLaughlin |
ISBN:
|
978-989-8704-44-3 |
Editors:
|
Hans Weghorn and Pedro Isaias |
Year:
|
2022 |
Edition:
|
Single |
Keywords:
|
Pattern Matching, First-Class Patterns, Type Systems, Programming Language Concepts and Design |
Type:
|
Short Paper |
First Page:
|
196 |
Last Page:
|
200 |
Language:
|
English |
Cover:
|
|
Full Contents:
|
click to dowload
|
Paper Abstract:
|
It has been observed that patterns and in particular first-class patterns can be used to enhance the type systems of procedural languages, especially dynamically typed procedural languages. Here we describe some recent findings of our ongoing research on the impact of first-class patterns on the type system of our Asteroid programming language, a dynamically typed, multi-paradigm programming language that supports first-class patterns. First, we show that first-class patterns allow us to specify subtypes of data types providing a light-weight mechanism for type checking function domains amongst other things. Next, we introduce the idea of a pure constraint pattern which is a pattern that functions like a regular pattern but does not introduce any spurious bindings into the current scope. This is particularly useful for preventing non-linearities in formal function arguments when using first-class patterns. Finally, we demonstrate that first-class patterns can be used to define abstract base types enabling subtype polymorphism. This is particularly powerful in object-based languages like Asteroid that lack inheritance and therefore cannot rely on that mechanism to provide subtype-supertype relationships between user defined types. |
|
|
|
|