Files
sakurac/docs/inconsistencies.md
T
2026-10-28 22:13:49 -05:00

3.3 KiB

Where the compilers disagreed

The places where the C compiler and the rebuild didn't agree, as the plans and their builds noted them. The C compiler is frozen, so the rebuild's behavior is the language (roadmap.md, decision 1), and the rules step 5 settled on 2026-10-20 are built. Probed again on 2026-10-28 with the rebuild alone: what was decided, or works in the rebuild, went, and what's left is where the rebuild still falls short of what C did or of what the README says. Probes leave out their imports. This file goes at the freeze.

What runs while compiling

What follows an if const only evaluating decides

def size_or_refuse<A, B>(): u64 {
  if const size_of::<A>() == size_of::<B>() { return size_of::<A>(); }
  compile_error("not the same size");
  return 0;
}

size_or_refuse::<u64, i64>() is refused: "not the same size (In size_or_refuse<uint, int>)". Where the checker decides an if const whose branch leaves, as T is integer, what follows it is compiled only where the branch isn't taken. Where only evaluating decides, as here, what follows is compiled either way, so its compile_error is reported whichever way the condition goes, as C reported every one. Within the branch, as simd::bits writes it, or in an else, it's reported only where evaluating chooses that branch: so since 2026-10-28, with the text it's given, in a property's accessors too.

A local constant reading another

def main(): void { const a: i64[3] = [1, 2, 3]; const b := a[1]; println($"{b}"); }

"A constant's value is known while compiling", where the constant read isn't a number. The same for a struct's field and a span given to a function. A global constant read this way, and local constants that are numbers, work.

remove_at, extend and string::append in a constant

std's containers work in a constant, but memcpy (core/mem.sakura) turns two addresses into numbers to compare them where it moves 8 bytes or more, so evaluating stops there: "Function does not run while compiling. at memcpy". Comparing the pointers themselves (p < q, q - p) runs in a constant, so memcpy could do without the numbers.

An address made a number while evaluating

Where it happens, evaluating says only "Evaluating h stopped: Function does not run while compiling.", with a trace. C said what happened: "An address is only known where the program runs, so pointers and integers do not convert while compiling."

A constant holding what is written through

const b: box<i64> = box::new(3);
const s: string = string::from("abc", nothing {});

The rebuild takes both, and a vector<i64> made by a function, on the machine, under --checks and in executables. The README's "a string doesn't" sides with C, which refused them: "A constant stands in memory the program only reads, so it holds *T and &T but not what is written through". Which is the language isn't decided.

decl_of of a built-in type

decl_of::<i64>() gives a declaration named i64, whose kind is target::all, 65,535, so decl_of::<T>().kind == target::structs is false of it but (kind & target::structs) == target::structs is true. The README says decl_of takes no number, and C refused it: "int is built into the language, so there is no declaration of it to describe."