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

Get the Android app

Or read this on Hacker News

Read more on:

Photo of programming language

programming language

Photo of generics

generics

Related news:

News photo

Purrtran – ᓚᘏᗢ – A Programming Language for Cat People

News photo

Haiku OS Sees Port Of Go 1.18 Programming Language

News photo

Is Ruby Still a 'Serious' Programming Language?