Modules and Organization
Last modified: 24 May 2026
What is this?
Modules are ArkCode's package management and structural organization system, utilizing the pack, import, and implement keywords to orchestrate large codebases natively.
What is its purpose?
As applications grow from simple scripts into massive multi-directory architectures, robust organization becomes critical. The purpose is to allow you to scale your codebase without ever touching a Make or CMake config to link files.
Where and how it can be used
Use it at the top of your files to declare namespaces, pull in local source trees, or load external decentralized packages directly via URLs.
pack physics_engine
import std.math
// Import decentralized remote packages
import "https://raw.githubusercontent.com/user/repo/main/lib.arkc"How it works
During compilation or JIT startup, the compiler scans for import statements. If a local file path or standard library is requested, it resolves it immediately. If a URL string (beginning with http://, https://, or ://) is provided, the package manager uses curl to fetch the source file and cache it locally in the project's .aake_cache directory. Subsequent runs load the cached module directly, ensuring sub-millisecond execution times.
To ensure security, importing from an unencrypted http:// endpoint triggers a compile-time static analysis warning: [ArkCode Warning] Insecure package URL: http://....
Where it can't be used and why
You cannot use import to dynamically load raw C++ headers (.h) or external shared objects (.so) at runtime. The ArkCode module system only links against ArkCode packages or pre-compiled core engine wrappers. This constraint guarantees that the execution environment remains perfectly stable and immune to foreign binary corruption or unhandled segmentation faults.