← Retour au blog
tech 5 September 2026

Deft: A Gradual Type System for Janet

Discover how Deft enhances the Janet language with a gradual type system, combining bidirectional inference, static analysis, and runtime checks.

Article inspired by the original source
deft: A gradual type system for Janet ↗ codeberg.org

Introduction

In the dynamic world of programming, the Janet language stands out for its flexibility and simplicity. However, this flexibility comes at a cost: the lack of strict typing can lead to hard-to-debug errors. This is where Deft comes in, a gradual type system that offers the best of both worlds: the flexibility of Janet and the robustness of a static type system.

What is Deft?

Deft is a gradual type system specifically designed for Janet. It allows developers to add type annotations to their code, making it easier to catch errors both at compile-time and runtime. With bidirectional inference, Deft can deduce types, reducing the cognitive load on the developer.

Key Features

Bidirectional Inference

One of the most powerful aspects of Deft is its bidirectional inference. This means the system can both infer types from usage (bottom-up) and propagate type constraints throughout the code (top-down). This inference model is particularly useful for dynamic languages like Janet, as it allows a great deal of language flexibility while adding a layer of safety.

Static Analysis and Runtime Checking

Deft offers robust static analysis that helps catch potential bugs even before the code is executed. For developers who prefer reinforced security, Deft also offers runtime checks, allowing for the detection of type errors in real-time.

Gradual Typing

Gradual typing allows for progressively annotating code with types. This means developers can start with untyped code and over time, add type annotations to strengthen the code's safety and maintainability.

Use Cases

Let's take a concrete example: a stock management API. In a dynamic environment, a type error in handling quantities can have costly consequences. With Deft, you can define types for "Product" and "Order" objects and use bidirectional inference to ensure that functions manipulating these objects adhere to type constraints.

Why Choose Deft?

In 2023, with 45% of companies adopting static typing systems to reduce errors (source: Stack Overflow Developer Survey 2023), Deft positions itself as a major asset for Janet. It offers a smooth transition to more rigorous typing without sacrificing the flexibility that has made Janet successful.

Conclusion

Deft is more than just an addition to the Janet language; it is a true tool for improving code quality. By combining bidirectional inference, static analysis, and gradual typing, Deft allows Janet developers to code with confidence.

Let's discuss your project in 15 minutes.

Janet type system gradual typing static analysis bidirectional inference
Deepthix newsletter · 100% AI · every Monday 8am

An AI agent reads tech for you.

Our AI agent scans ~200 sources per week and ships the best articles to your inbox Monday 8am. Free. One click to unsubscribe.

Visit the newsletter page →

Want to automate your operations?

Let's talk about your project in 15 minutes.

Book a call