# Implementation of Coalton like trait library in Julia

**URL:** <https://discourse.julialang.org/t/implementation-of-coalton-like-trait-library-in-julia/92236>\
**Category:** General Usage\
**Tags:** type-stability\
**Created:** [December 28, 2022, 5:22pm UTC](https://discourse.julialang.org/t/implementation-of-coalton-like-trait-library-in-julia/92236 "2022-12-28T17:22:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kishaloy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kishaloy/32/30127_2.png) [@kishaloy](https://discourse.julialang.org/u/kishaloy)\
**Post date:** [December 28, 2022, 5:22pm UTC](https://discourse.julialang.org/t/implementation-of-coalton-like-trait-library-in-julia/92236/1 "2022-12-28T17:22:51Z")

</div>

I was looking at the Coalton library in CL and I was quite impressed by what they have achieved in terms of getting an opt-in Haskell like typeclass system in Common Lisp.

> **[The Coalton Language](https://coalton-lang.github.io/)**
>
> Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.

Since traits and type-stability has been one of the major thrust in Julia, both for performance as well as correctness, I was wondering if it might be possible to implement such a library in Julia or is there something similar already in the works.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [December 28, 2022, 9:24pm UTC](https://discourse.julialang.org/t/implementation-of-coalton-like-trait-library-in-julia/92236/2 "2022-12-28T21:24:46Z")

</div>

Out of curiosity - what is the allure of this?

Is it a “static compilation checker” you want akin to Rust, where it lets you know if there is errors in types etc before execution?

Kind regards

---

<div class="post-metadata">

**Author:** ![kishaloy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kishaloy/32/30127_2.png) [@kishaloy](https://discourse.julialang.org/u/kishaloy)\
**Post date:** [December 29, 2022, 9:15am UTC](https://discourse.julialang.org/t/implementation-of-coalton-like-trait-library-in-julia/92236/3 "2022-12-29T09:15:59Z")

</div>

Well it wont be Rust level borrow check but yes it would lead to introduction of Trait based static system.

It wont directly help the compiler but by ensuring type stability of the final code, would enable very high optimization.

By introducing a trait system would also allow the development of an interface system that can allow more correct interfacing between different libraries.
