Evolving languages faster with type tailoring
A proposed solution called "type tailoring" enhances type systems using metaprogramming, allowing better type inference for constructs like regex. The approach aims to improve programming language usability and efficiency.
Read original articleProgramming languages often evolve slowly, particularly in their type systems, which struggle to accommodate domain-specific constructs like regular expressions and SQL queries. This limitation forces programmers to handle type-checking manually, leading to cumbersome code. A proposed solution is "type tailoring," a concept introduced in a paper accepted at the European Conference on Object-Oriented Programming (ECOOP). Type tailoring allows programmers to enhance type systems using metaprogramming tools, enabling them to teach the type checker about specific constructs without altering the underlying language or compiler.
The paper outlines a high-level approach to type tailoring, where the type system can recognize the structure of regex captures, allowing for more accurate type inference. The authors present the "trivial library" for Typed Racket, which automates the insertion of necessary type checks and casts, streamlining the coding process. Essential features for effective type tailoring include type checking after elaboration, elaboration-time computation, and the use of abstract syntax trees (ASTs).
The authors also highlight existing projects that exemplify type tailoring, such as Rust's SQLx library and Julia's StaticArrays package. By defining type tailoring and identifying its key components, the paper aims to unify various efforts across programming languages and encourage further development in this area. The authors anticipate that their work will inspire more libraries and tools that leverage type tailoring to improve programming language usability and efficiency.
Related
Deriving Dependently-Typed OOP from First Principles
The paper delves into the expression problem in programming, comparing extensibility in functional and object-oriented paradigms. It introduces dependently-typed object-oriented programming, emphasizing duality and showcasing transformations. Additional appendices are included for OOPSLA 2024.
A reckless introduction to Hindley-Milner type inference (2019)
Hindley-Milner type inference balances expressiveness and legibility in programming languages like Elm and Haskell. It enhances correctness by enforcing strict type checking, limiting coding practices for improved type safety.
Evolving Languages Faster with Type Tailoring
Programming languages face limitations in understanding domain-specific aspects like regular expressions, causing errors. "Type Tailoring" proposes teaching type systems new tricks through metaprogramming tools for improved code efficiency and correctness.
A type system for RCL, part 2: The type system
Ruud van Asseldonk introduces RCL, a JSON extension with a strong type system. RCL enforces type safety, supports static and gradual typing, and addresses challenges like covariance to balance usability and error reporting.
Parse, Don't Validate
The article explores type-driven design in programming, emphasizing "Parse, don’t validate" in Haskell. It showcases using types for robust code, avoiding errors, and enhancing input parsing efficiency in various tasks.
Related
Deriving Dependently-Typed OOP from First Principles
The paper delves into the expression problem in programming, comparing extensibility in functional and object-oriented paradigms. It introduces dependently-typed object-oriented programming, emphasizing duality and showcasing transformations. Additional appendices are included for OOPSLA 2024.
A reckless introduction to Hindley-Milner type inference (2019)
Hindley-Milner type inference balances expressiveness and legibility in programming languages like Elm and Haskell. It enhances correctness by enforcing strict type checking, limiting coding practices for improved type safety.
Evolving Languages Faster with Type Tailoring
Programming languages face limitations in understanding domain-specific aspects like regular expressions, causing errors. "Type Tailoring" proposes teaching type systems new tricks through metaprogramming tools for improved code efficiency and correctness.
A type system for RCL, part 2: The type system
Ruud van Asseldonk introduces RCL, a JSON extension with a strong type system. RCL enforces type safety, supports static and gradual typing, and addresses challenges like covariance to balance usability and error reporting.
Parse, Don't Validate
The article explores type-driven design in programming, emphasizing "Parse, don’t validate" in Haskell. It showcases using types for robust code, avoiding errors, and enhancing input parsing efficiency in various tasks.