{"slug": "show-hn-jik-a-self-hosted-language-using-region-based-memory-management", "title": "Show HN: Jik – a self-hosted language using region-based memory management", "summary": "A developer released Jik, a statically typed programming language that compiles to C and manages memory through regions rather than garbage collection or manual heap allocation, with compiler checks preventing references across regions with incompatible lifetimes. Jik ships with type inference, optional type annotations, vectors, dictionaries, options, variants, exhaustive enum/variant tables, error handling, a standard library and a package ecosystem, and its toolchain requires a C compiler, auto-detecting clang, gcc, then cc on PATH, with only gcc and clang tested and MSVC untested. The release targets developers who want concise source code and predictable generated C without a runtime garbage collector.", "body_md": "*A readable, statically typed language that compiles to C and manages memory with regions.*\n\n*Open a ready-to-use Jik development environment.*\n\nJik is a statically typed programming language with a straightforward source-to-C compilation model. It avoids both garbage collection and manual heap allocation.\n\nIt provides type inference, optional type annotations, vectors, dictionaries, options, variants, exhaustive enum/variant tables, error handling, a standard library, and a growing package ecosystem. The result is concise source code and predictable generated C.\n\nJik's defining idea is its memory model: composite values are allocated into regions that determine their lifetime, while compiler checks prevent references across regions with incompatible lifetimes.\n\n## **Hello, Regions!**\n\nFunctions that return composite values let the caller choose the destination region:\n\n``` php\nfunc default_actions(r: Region) -> Vec[String]:\n    return [\"Open\", \"Save\", \"Quit\"][r]\nend\n\nfunc main():\n    actions := default_actions(_)\n    println(\"first action: \", actions[0])\nend\n```\n\n`_` is the current function's local region. For a longer-lived result, pass an explicit `Region` or the region of another composite value.\n\n## **Parsing a config**\n\n```\nuse \"jik/string\"\n\nfunc main():\n    text := \"host = localhost\\nport = 8080\\nmode = dev\\n\"\n    settings: Dict[String]\n\n    for line in string::split(text, \"\\n\", _):\n        parts := string::split(line, \"=\", _)\n        if len(parts) != 2:\n            continue\n        end\n        key := string::trim(parts[0], _)\n        value := string::trim(parts[1], _)\n        settings[key] = value\n    end\n\n    host := settings[\"host\"]\n    port := settings[\"port\"]\n    if host is Some and port is Some:\n        println(\"connecting to \", host?, \":\", port?)\n    end\nend\n```\n\n## **Error handling**\n\n```\nthrows func safe_div(x, y):\n    if y == 0.0:\n        fail(\"division by zero\")\n    end\n    return x / y\nend\n\nfunc show_div(x, y):\n    try value := safe_div(x, y):\n        println(x, \" / \", y, \" = \", value)\n    except:\n        println(\"cannot divide \", x, \" by \", y, \": \", error_msg())\n    end\nend\n\nfunc main():\n    show_div(12.0, 3.0)\n    show_div(7.0, 0.0)\nend\n```\n\nTo start programming in Jik:\n\n- [download the latest release](https://github.com/jik-lang/jik/releases/latest) for your platform\n- extract the release archive\n- add the extracted directory to `PATH`\n- from the extracted directory, run `jik help` to confirm the executable works\n- `jik run` and`jik build` require a C compiler. Jik automatically looks for`clang` ,`gcc` , then`cc` on`PATH` .\nTo select a specific compiler, use the`--cc` flag or set the`JIK_CC` environment variable.\n  - Windows tip: For a simple GCC setup, download from [WinLibs](https://winlibs.com/) , and add its`bin` directory to`PATH`\n- Windows tip: For a simple GCC setup, download from \n- run the included hello example: `jik run examples/hello.jik`\n- generate C output: `jik tran examples/hello.jik`\n- build an executable: `jik build examples/hello.jik`\n\nOnly `gcc` and `clang` host compilers were tested. MSVC was not tested.\n\nSee the [examples](https://github.com/jik-lang/jik/blob/main/examples) directory for [variants](https://github.com/jik-lang/jik/blob/main/examples/variants.jik), [tables](https://github.com/jik-lang/jik/blob/main/examples/tables.jik), more [error handling](https://github.com/jik-lang/jik/blob/main/examples/error_handling.jik), [word count](https://github.com/jik-lang/jik/blob/main/examples/word_count.jik), [Dijkstra](https://github.com/jik-lang/jik/blob/main/examples/dijkstra.jik), [Newton's method](https://github.com/jik-lang/jik/blob/main/examples/newton.jik), [Game of Life](https://github.com/jik-lang/jik/blob/main/examples/game_of_life.jik), [Forth](https://github.com/jik-lang/jik/blob/main/examples/forth.jik), and [C interop](https://github.com/jik-lang/jik/blob/main/examples/ffi_demo.jik).\n\n[Jik packages](https://github.com/jik-lang/jik-packages) provide reusable libraries and C bindings for writing larger programs.\n\n- [Play Missile Defence](https://jik-lang.org/showcase/missile-defence/) — a Jik game built with the[Raylib wrapper](https://github.com/jik-lang/jik-packages/tree/main/packages/raylib) .\n  - [Source code](https://github.com/jik-lang/jik-packages/tree/main/packages/raylib/examples/missile_defence)\n  - Note: the browser demo is a separate WebAssembly build\n\nYou need Make and Clang or GCC. From the repository root:\n\n```\nmake                       # Build jik\nmake test                  # Build and run the tests\nmake help                  # Show build commands\n```\n\nUse `make CC=gcc` to build with GCC; Clang is the default. The build uses the\nbundled C seed, so you do not need to download a Jik compiler. See the\n[development notes](https://github.com/jik-lang/jik/blob/main/docs/development.md) for bootstrap stages and release builds.\n\nDownload `jik-language-tools-*.vsix` from the [latest release](https://github.com/jik-lang/jik/releases/latest). In VS Code, open the Extensions view, select the `...` menu, choose **Install from VSIX...**, and select the downloaded file.\n\nThe extension provides syntax highlighting, import-aware standard-library completion, and hover documentation and signatures.", "url": "https://wpnews.pro/news/show-hn-jik-a-self-hosted-language-using-region-based-memory-management", "canonical_source": "https://github.com/jik-lang/jik", "published_at": "2026-11-01 19:51:54+00:00", "updated_at": "2026-11-01 20:21:14.484362+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Jik", "WinLibs", "Raylib", "gcc", "clang", "MSVC"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-jik-a-self-hosted-language-using-region-based-memory-management", "markdown": "https://wpnews.pro/news/show-hn-jik-a-self-hosted-language-using-region-based-memory-management.md", "text": "https://wpnews.pro/news/show-hn-jik-a-self-hosted-language-using-region-based-memory-management.txt", "jsonld": "https://wpnews.pro/news/show-hn-jik-a-self-hosted-language-using-region-based-memory-management.jsonld"}}