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
- Stage A: New crate
crates/alef-backend-julia/ + JuliaMapper: TypeMapper. Add JULIA_KEYWORDS to crates/alef-core/src/keywords.rs.
- 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...).
- Stage C: Result via Julia's exception system (
error(...) / throw(...)); checked via last_error_code after each ccall.
- 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.
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
ccallmechanism. No additional Rust-side bridge crate is needed; Julia loads the cbindgen-produced shared library directly throughLibdland calls into it withccallexpressions.Reference implementation
crates/alef-backend-zig/src/gen_bindings.rsandcrates/alef-backend-go/src/gen_bindings.rs— closest templates (both consume the C FFI library directly).alef-codegen::c_consumer::{free_string_symbol, last_error_code_symbol, last_error_context_symbol}.Suggested scope
crates/alef-backend-julia/+JuliaMapper: TypeMapper. AddJULIA_KEYWORDStocrates/alef-core/src/keywords.rs..jlsource —structfor DTOs,@enumfor unit-only enums, parametric types orUnion{}for tagged unions,functiondeclarations wrappingccall((:fn_name, library), ReturnType, (ArgTypes...), args...).error(...)/throw(...)); checked vialast_error_codeafter eachccall.Project.toml,Manifest.toml), e2e (Teststdlib), publish (JuliaGeneralregistry tarball).Pin versions
template_versions::juliasubmodule for any test/lint dep versions with renovate markers.template_versions::toolchain(e.g.JULIA_MIN_VERSION = \"1.10\").Effort estimate
S–M (~3–5 days). Julia's
ccallis 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.