Get the latest tech news
Show HN: I implemented generics in my programming language
Generics Generic functions in Axe can be defined using type parameters, allowing a single function body to express behaviour that adapts to multiple concrete types. A simple example would look like this: def some_function[T](arg: T): T { when T is float { return arg * 2.0; } when T is i32 { return arg + 1; } return arg; } Here, the function’s logic is specialized at compile time based on the concrete type bound to T.
None
Or read this on Hacker News