Skip to content

feat: Add Julia backend (community contribution welcome) #13

Description

@Goldziher

Goal

Add a Julia binding generator backend for alef, alongside the existing 16 backends.

Approach

Julia is a C FFI consumer via Julia's built-in ccall mechanism. No additional Rust-side bridge crate is needed; Julia loads the cbindgen-produced shared library directly through Libdl and calls into it with ccall expressions.

Reference implementation

  • crates/alef-backend-zig/src/gen_bindings.rs and crates/alef-backend-go/src/gen_bindings.rs — closest templates (both consume the C FFI library directly).
  • Reuse alef-codegen::c_consumer::{free_string_symbol, last_error_code_symbol, last_error_context_symbol}.

Suggested scope

  1. Stage A: New crate crates/alef-backend-julia/ + JuliaMapper: TypeMapper. Add JULIA_KEYWORDS to crates/alef-core/src/keywords.rs.
  2. Stage B: Emit .jl source — struct for DTOs, @enum for unit-only enums, parametric types or Union{} for tagged unions, function declarations wrapping ccall((:fn_name, library), ReturnType, (ArgTypes...), args...).
  3. Stage C: Result via Julia's exception system (error(...) / throw(...)); checked via last_error_code after each ccall.
  4. Stage 1b: scaffold (Project.toml, Manifest.toml), e2e (Test stdlib), publish (Julia General registry tarball).

Pin versions

  • Add template_versions::julia submodule for any test/lint dep versions with renovate markers.
  • Julia language version pin in template_versions::toolchain (e.g. JULIA_MIN_VERSION = \"1.10\").

Effort estimate

S–M (~3–5 days). Julia's ccall is straightforward; the main work is mapping IR types to Julia's parametric type system idiomatically.

Tracking

Part of Tier 2 per the language-backend expansion plan. Other Tier 2: Lua, OCaml, Nim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for Feature.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions