Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Jik – a language with region-based memory management that compiles to C (github.com/jik-lang)
2 points by scorched_soy 35 days ago | hide | past | favorite
Hi HN,

I've been working on Jik, a statically typed programming language with region-based memory management, which compiles to C.

The purpose of Jik is to try to answer the following question:

Is there a region-based memory management model which is simple enough to implement and ergonomic enough for everyday use?

Here is a short example to give you a brief idea:

    struct Person:
        name: String
        age: int
    end

    func make_person(name, age, r: Region) -> Person:
        // trailing [r] means "allocate in region r"
        return Person{name = name, age = age}[r]
    end

    func main():
        // _ is reserved for the function's local region
        p := make_person("Ana", 30, _)
        println(p.name)
    end

More on the memory model can be found in the docs: https://github.com/jik-lang/jik/blob/main/docs/overview/08-m...

Jik is in alpha, but it is usable enough to try out: https://codespaces.new/jik-lang/try-jik?quickstart=1

Any feedback, especially on Jik's memory management concept, is highly appreciated!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: